Commit Graph

3723 Commits

Author SHA1 Message Date
YeonGyu-Kim 9b72bf8e68 Merge pull request #3467 from code-yeongyu/refactor/delegate-task-metadata-hardening
refactor: harden delegate-task metadata pipeline
2026-04-16 15:12:38 +09:00
YeonGyu-Kim 7bc170fb86 fix: installer writes hyphenated anthropic IDs, variant=max Anthropic OAuth compat (#3429, #3459) 2026-04-16 14:28:56 +09:00
YeonGyu-Kim c6a407c486 refactor(tools): migrate producers to shared metadata bridge
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-16 13:52:20 +09:00
YeonGyu-Kim 4da3005797 fix(plugin): harden metadata recovery and extraction
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-16 13:52:12 +09:00
YeonGyu-Kim 80d3339c4c feat(background-agent): add wait-for-task-session helper
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-16 13:52:04 +09:00
YeonGyu-Kim a1842f2de7 feat(tool-metadata): add shared metadata contract and bridge
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-16 13:51:58 +09:00
YeonGyu-Kim ccb2715ada fix: hide native plan agent when replace_plan is true (#3443)
When replace_plan is true (default), the native plan agent was demoted to
subagent but remained visible in the agent picker. This caused Sisyphus to
route planning to the native plan agent instead of Prometheus.

Add hidden: true to buildPlanDemoteConfig(), consistent with how the build
agent is hidden when default_builder_enabled is false.
2026-04-15 17:04:54 +09:00
YeonGyu-Kim 0764526aca fix(posthog): disable exception autocapture to stay within free tier
Error tracking exceeded 100K free tier limit (188K in 5 days).

Top exceptions were mostly noise:
- ProviderModelNotFoundError: 75K (user config issues)
- EPIPE/EOF/stream destroyed: 40K (normal pipe closures)
- ENOSPC: 3K (user disk space issues)

Manual captureException() for critical errors in runner.ts
is preserved. Only automatic unhandled exception capture is
disabled.
2026-04-15 15:30:40 +09:00
YeonGyu-Kim 47aa3025db fix(cli): use getAgentRuntimeName for agent resolution in run command 2026-04-15 14:46:50 +09:00
YeonGyu-Kim a47f898636 Merge pull request #3321 from rlavkvmflzk/fix/grep-windows-crlf-and-drive-letter
fix(grep): handle Windows drive-letter paths and CRLF in parseOutput
2026-04-15 12:35:16 +09:00
YeonGyu-Kim e1b2f97bfd fix: isPlanFamily regression tests, code-review -> review-work in test data (#3312, #3285, #3290) 2026-04-15 11:27:07 +09:00
YeonGyu-Kim ab11f2eb4e fix(tests): replace mock.module with spyOn to prevent test pollution
The opencode-config-agents-reader.test.ts was using mock.module() which
permanently replaced the module in bun's module cache, causing state
pollution in downstream tests (plugin-detection, write-omo-config,
config-loader). Replaced with spyOn() pattern that properly restores
in afterEach.
2026-04-15 11:14:52 +09:00
YeonGyu-Kim e5d3fe96c4 fix(agents): address all PR #2299 code review findings
Blocking fixes:
- B1: Return empty restrictions for unknown/custom agents instead of
  EXPLORATION_AGENT_DENYLIST, allowing custom agents full tool access
- B2: Use Object.create(null) consistently across all 5 agent-loading
  result objects to prevent prototype pollution
- B3: Add code comment documenting custom agent bash access trust model
- B4: Mock getOpenCodeConfigDir in opencode-config-agents-reader tests
  to prevent global config dir leakage

Non-blocking fixes:
- N1: Use resolveAgentDefinitionPaths with project boundary enforcement
  in opencode-config-agents-reader for path containment
- N2: Add session-scoped 30s TTL cache to resolveCallableAgents to
  avoid redundant SDK IPC calls per tool invocation
- N3: Extract shared parseToolsConfig into src/shared/parse-tools-config.ts
  replacing 4 duplicated local implementations
- N4: Add .min(1) to AgentDefinitionPathSchema rejecting empty paths
- N5: Add resolve-agent-definition-paths.test.ts covering tilde expansion,
  relative paths, boundary enforcement, and null containmentDir
- N6: Validate agent mode against allowed values instead of bare type
  assertion in opencode-config-agents-reader
2026-04-15 10:58:16 +09:00
Brandon Webb 4c77045c47 fix(agents): use null-prototype accumulator to prevent __proto__ pollution
Addresses cubic-dev-ai P1 review: Object.hasOwn() alone doesn't prevent
a crafted '__proto__' agent name from mutating the result object's
prototype chain. Using Object.create(null) eliminates inherited properties
entirely, making both the hasOwn checks and property assignments safe.
2026-04-15 10:57:54 +09:00
Brandon Webb cf4b231553 fix(agents): replace 'in' with Object.hasOwn() for prototype-safe property checks
Addresses cubic-dev-ai review: using 'in' on plain objects can skip valid
agent names that match inherited properties (toString, constructor, etc.).
Switched both occurrences in opencode-config-agents-reader.ts to
Object.hasOwn() for safe own-property checks.
2026-04-15 10:57:54 +09:00
Brandon Webb 42445f5130 fix(agents): address cubic review findings on agent loader
- Case-insensitive .md extension stripping for agent name extraction
- Resolve project agent_definitions paths relative to config dir (.opencode/)
- Use getOpenCodeConfigDir() to respect OPENCODE_CONFIG_DIR/XDG_CONFIG_HOME
- First-write-wins semantics for both inline and definition-file agents
  so project-level agents always take precedence over global-level
2026-04-15 10:57:54 +09:00
Brandon Webb 3d0fb22cda fix(call-omo-agent): adapt dev's model override tests to use createMockCtx factory
Dev added 4 tests (#2852, model variant, category-derived overrides) that
referenced the old mockCtx constant. Our branch replaced it with a
createMockCtx() factory. Replace all 4 references.
2026-04-15 10:57:54 +09:00
Brandon Webb 39bda91bc7 feat(agents): wire agent_definitions and opencode.json agents into precedence chain
- Modified agent-config-handler.ts to load and integrate both new agent sources
- Added loadAgentDefinitions() and readOpencodeConfigAgents() calls in loading phase
- Integrated both sources into agent precedence chains (both Sisyphus-enabled and disabled paths)
- Added detailed logging for new agent sources
- Added filtering logic to respect disabled_agents configuration
- Extended agent-config-handler.test.ts with 7 new integration tests
- All tests passing (18/18 integration, 65/65 loader suite)

Wave 3 of agent definitions enhancement complete.
2026-04-15 10:57:54 +09:00
Brandon Webb 5755a90c3b feat(agents): add agent definitions file loader and opencode.json reader
- Add loadAgentDefinitions() for explicit file path loading (.md/.json/.jsonc)
- Add readOpencodeConfigAgents() for independent opencode.json(c) reading
- Extract parseMarkdownAgentFile() from loader.ts for reuse
- Refactor loader.ts to use extracted parser (-50 LOC)
- Add comprehensive test coverage (13 tests for definitions loader, 10 tests for opencode reader)
- Support inline agents + agent_definitions paths in opencode.json(c)
- Inline agents override definition-file agents (correct precedence)

Part of agent definitions enhancement (Wave 2/3)
2026-04-15 10:57:54 +09:00
Brandon Webb fd28f7e668 feat(agents): add agent_definitions schema, eager path resolution, and JSON agent loader
Wave 1 of agent definitions enhancement (PR #2299):

Schema & Configuration:
- Add agent_definitions field to oh-my-opencode config schema
- Support list of file paths to .md or .json agent definition files
- Add to PARTIAL_STRING_ARRAY_KEYS for Set-union merge semantics
- Implement eager path resolution in loadPluginConfig() before merging

Path Resolution:
- Create resolve-agent-definition-paths.ts helper
- User-level paths resolve from ~/.config/opencode/ (no containment)
- Project-level paths resolve from project root (with containment check)
- Homedir expansion, absolute/relative path handling

JSON Agent Loader:
- Create parseJsonAgentFile() for .json/.jsonc agent definitions
- Validate required fields (name, prompt)
- Support tools as string (comma-separated) or array
- Map model via mapClaudeModelToOpenCode()
- Comprehensive test suite (7 test cases, all passing)

Type Extensions:
- Extend AgentScope: add 'definition-file' and 'opencode-config'
- Add AgentJsonDefinition interface for JSON agent schema

All automated checks passing:
- lsp_diagnostics clean on all changed files
- json-agent-loader.test.ts: 7/7 passing
- Full typecheck: zero new errors
- QA evidence saved to .sisyphus/evidence/
2026-04-15 10:57:54 +09:00
Brandon Webb 1e85a88db0 fix(agent-restrictions): restore EXPLORATION_AGENT_DENYLIST as default fallback for unknown agents 2026-04-15 10:57:17 +09:00
Brandon Webb da91c53536 fix(call-omo-agent): address cubic review findings and add requirement-based tests
- Fix agent-resolver.ts: add defensive validation on agent name (typeof, trim, filter)
- Fix tools.test.ts: correct mock to return {data: agents} matching SDK contract
- Fix agent-config-handler.ts: include opencode global/project agents in customAgentSummaries
- Add agent-resolver.test.ts: 14 requirement-based tests covering R1-R7 behavioral specs
- Add tools-edge-cases.test.ts: 5 integration tests for rollback, whitespace, dedup, session_id
2026-04-15 10:56:50 +09:00
Brandon Webb 76c5356a80 test(agent-config): add regression tests for agent merge priority order 2026-04-15 10:56:50 +09:00
YeonGyu-Kim 1d8f8a03ca Merge pull request #3437 from code-yeongyu/fix/bug-batch-2
fix: Git Bash shell detection, legacy agent name resolution, backup spam
2026-04-15 10:53:46 +09:00
YeonGyu-Kim 62c60ae9d8 fix: numeric skill names, ultrawork missing run_in_background, ZWSP agent lookups
- #3354: Coerce data.name to String in loadSkillFromPath/loadSkillFromPathAsync
  to prevent crash when YAML parses numeric skill names (e.g., name: 12306)

- #3416: Add required run_in_background parameter to all task() examples in
  ultrawork prompts (default, gpt, gemini, planner) to match tool schema

- #3379/#3417/#3418/#3337/#3335: Strip ZWSP (U+200B) before agent name
  comparisons in agent-tool-restrictions, sync-prompt-sender, tool-execute-after,
  tool-execute-before, oracle-verification-detector, call-omo-agent,
  recovery-prompt-config, and agent-variant to prevent ZWSP-prefixed display
  names from breaking exact-match lookups
2026-04-15 10:46:41 +09:00
YeonGyu-Kim 0dab3116b7 fix: resolve 3 bugs (#3366, #3272, #3222)
- shell-env: detect Git Bash via MSYSTEM env var when SHELL is unset (#3366)
  On some Git Bash installations SHELL is not set but MSYSTEM (MINGW64/MSYS)
  is always present. Check MSYSTEM before PSModulePath to avoid emitting
  PowerShell syntax in bash shells.

- session-state: resolve legacy agent names in resolveRegisteredAgentName (#3272)
  Historical sessions stored agent names like 'Sisyphus (Ultraworker)' which
  don't match the current registered format. Fall back to getAgentConfigKey
  for legacy/parenthesized name resolution before returning the raw name.

- config-migration: skip backup when file content is unchanged (#3222)
  Compare serialized config with existing file content before creating a
  timestamped .bak file. Only create backup when the on-disk content
  actually differs from the migrated content.
2026-04-15 10:43:44 +09:00
YeonGyu-Kim b525055590 fix(telemetry): guard PostHog init failures 2026-04-14 02:50:50 +09:00
YeonGyu-Kim 1b36194b51 fix(cli): treat missing session status as idle in run completion 2026-04-13 22:57:12 +09:00
YeonGyu-Kim 4ce1dde32d CLI: isolate provider model id transforms from shared mocks 2026-04-13 21:45:23 +09:00
YeonGyu-Kim 01a1b141e9 fix(delegate-task): reject primary agents in task subagent resolution
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-13 17:03:37 +09:00
YeonGyu-Kim f1cd4d73d6 Merge pull request #3376 from matchai/feat/vercel-ai-gateway
feat(provider): add Vercel AI Gateway support
2026-04-13 15:58:29 +09:00
YeonGyu-Kim e3b5c2be2e fix: address review feedback for Vercel AI Gateway PR
- Add --vercel-ai-gateway CLI option to install command
- Fix librarian/explore priority: native providers (ZAI, Copilot) now take precedence over Vercel gateway
- Add hasVercelAiGateway to installer no-provider warning conditions
- Add hasVercelAiGateway: false to all test file InstallConfig fixtures
- Fix test expectations for model ID format (claude-opus-4.6 vs claude-opus-4-6)
2026-04-13 15:31:28 +09:00
YeonGyu-Kim 680d05a28b Prometheus: keep planner primary-only 2026-04-13 14:28:07 +09:00
Matan Kushner 569addd3b0 docs(provider): add comments to vercel transform logic 2026-04-13 14:05:29 +09:00
Matan Kushner effae16c14 refactor(provider): replace per-model string replacements with generic regex
Claude version transforms now use a single regex
claude-(\w+)-(\d+)-(\d+) -> claude-$1-$2.$3 instead of one
.replace() per model. New claude models need zero changes.
2026-04-13 14:01:17 +09:00
Matan Kushner 34e334eabe feat(provider): add vercel to all gateway-supported fallback entries
Adds vercel to every fallback entry where the model exists on the
gateway (kimi-k2.5, glm-5, glm-4.6v, minimax-m2.7, grok-code-fast-1,
gpt-5-nano). Adds inferSubProvider mappings for minimax, moonshotai,
and zai. Updates librarian/explore special cases to prefer minimax
via gateway over claude-haiku.
2026-04-13 13:44:50 +09:00
Matan Kushner 542dc890f9 fix(provider): use gateway-specific model IDs for vercel transform
The gateway uses google/gemini-3-flash (no -preview suffix) unlike the
direct Google API. Give the vercel provider its own transform instead
of delegating to sub-provider transforms blindly.
2026-04-13 12:51:56 +09:00
Matan Kushner 6f72ec754d test: add integration tests for Vercel AI Gateway model resolution 2026-04-13 11:26:30 +09:00
Matan Kushner aac1713583 test: add vercel provider transform tests 2026-04-13 11:23:11 +09:00
Matan Kushner dac0c99e8c feat: add Vercel AI Gateway as a provider
Adds 'vercel' as a recognized provider throughout the model resolution
system, enabling users with Vercel AI Gateway to use it as a universal
fallback for OpenAI, Anthropic, and Google models.

The gateway transform infers the sub-provider from canonical model names
(claude->anthropic, gpt->openai, gemini->google) and delegates to the
appropriate provider-specific transform, producing model strings like
vercel/anthropic/claude-opus-4.6.
2026-04-13 11:22:22 +09:00
YeonGyu-Kim 3d2eb6e471 fix(config): preserve explicit git_master overrides during merge
Prevent project config defaults from re-enabling git_master fields that users explicitly disabled. Rebuild git_master from explicit user and project keys so include_co_authored_by and commit_footer merge predictably.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-12 18:18:37 +09:00
YeonGyu-Kim 051ab840d6 Merge pull request #3348 from code-yeongyu/refactor/ulw-repo-cleanup-20260411
refactor: simplify nullish guards and remove dead no-op paths
2026-04-12 18:04:43 +09:00
code-yeongyu 3053d5901a Merge branch 'dev' into fix/user-agents-callable-v2
Resolves conflicts with ZWSP agent ordering, display name unification, and test file migration to zauc-mocks split.
2026-04-12 06:13:52 +09:00
YeonGyu-Kim c5c5bc36bc fix(delegate-task): consume fallback chain on sendSyncPrompt failure (#2691)
setSessionFallbackChain stored the fallback chain but the sync path
never consumed it when sendSyncPrompt returned an error. Added a
retry loop that iterates getNextFallback() until the prompt succeeds
or the chain is exhausted, preserving the finally-block cleanup.

🤖 Generated with OhMyOpenCode assistance
https://github.com/code-yeongyu/oh-my-opencode
2026-04-12 02:30:32 +09:00
YeonGyu-Kim aed8dbfa3e fix(delegate-task): fetch session result before honoring abort signal (#2702)
The sync poller returned 'Task aborted' immediately when the abort
signal fired, even when a terminal assistant message had already
arrived during the previous wait. Now attempts one final fetch and
returns the completion result if available before emitting the
abort message.

🤖 Generated with OhMyOpenCode assistance
https://github.com/code-yeongyu/oh-my-opencode
2026-04-12 02:30:22 +09:00
YeonGyu-Kim eb495793db fix(event): prefer real session.idle over recent synthetic dedup (#2667)
The dedup logic dropped real session.idle events when a synthetic
idle had fired within the dedup window, losing data that downstream
hooks needed. Now real idle events always reach dispatchToHooks while
synthetic duplicates are still dropped when a real event came first.

🤖 Generated with OhMyOpenCode assistance
https://github.com/code-yeongyu/oh-my-opencode
2026-04-12 02:30:11 +09:00
YeonGyu-Kim 3bfa3bd608 fix(background-agent): pass query directory to session.get in 4 call-sites (#2937)
resolveSubagentSpawnContext and related lookups called client.session.get
without the query.directory parameter, causing project-scoped sessions
to 404 under newer OpenCode SDK versions. Threaded directory through
SpawnerContext/BackgroundManager so all four call-sites pass it.

🤖 Generated with OhMyOpenCode assistance
https://github.com/code-yeongyu/oh-my-opencode
2026-04-12 02:30:01 +09:00
YeonGyu-Kim d8b9bf1aad fix(doctor): check comment-checker lazy-download cache path (#2911, #3315)
Doctor's comment-checker probe only checked system PATH and the
package binary while the runtime resolution path checks the
lazy-download cache first. Aligned the doctor resolution order
with runtime so the cached binary is recognized as installed.

🤖 Generated with OhMyOpenCode assistance
https://github.com/code-yeongyu/oh-my-opencode
2026-04-12 02:29:49 +09:00
YeonGyu-Kim 64e5593697 fix(multimodal-looker): instruct explicit Read tool usage for PDFs (#2998)
The agent prompt described PDF handling but did not tell the agent
to call the Read tool, which is its only allowed tool. Added
explicit instruction so PDFs and documents are actually loaded
before extraction.

🤖 Generated with OhMyOpenCode assistance
https://github.com/code-yeongyu/oh-my-opencode
2026-04-12 02:29:39 +09:00
YeonGyu-Kim 796a646c63 fix(non-interactive-env): use detectShellType instead of hardcoded win32 check (#3310, #3338)
Hardcoded platform check forced PowerShell env syntax on Windows
regardless of the actual shell. Replaced with detectShellType() so
Git Bash, WSL, and similar environments use unix prefixes while
native PowerShell continues to get powershell prefixes.

🤖 Generated with OhMyOpenCode assistance
https://github.com/code-yeongyu/oh-my-opencode
2026-04-12 02:29:28 +09:00