Commit Graph

773 Commits

Author SHA1 Message Date
YeonGyu-Kim 359f74132a fix(delegate-task): strip ZWSP from agent names on background launch path
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-08 17:17:26 +09:00
YeonGyu-Kim 94449e0a24 test(delegate-task): update isPlanAgent test for exact match fix
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-08 13:33:18 +09:00
YeonGyu-Kim 35f778db2d test(skill-mcp): add scope field to test fixtures
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-08 13:11:28 +09:00
YeonGyu-Kim fa140b0375 fix(skill-loader): propagate scope to MCP connections
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-08 13:10:41 +09:00
YeonGyu-Kim a419857b46 fix(delegate-task): use exact match for isPlanFamily to allow Metis/Momus
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-08 13:09:31 +09:00
YeonGyu-Kim e8d83b5f98 fix(zwsp): strip zero-width chars in delegate-task tools
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-08 13:02:05 +09:00
YeonGyu-Kim 5188df903f fix(types): revert task-tool type inference workarounds
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-08 13:00:17 +09:00
YeonGyu-Kim 62cc74b23e Merge pull request #3187 from code-yeongyu/fix/issue-2687
fix: propagate project skills to background task sessions (#2687)
2026-04-07 15:35:28 +09:00
YeonGyu-Kim 505c7ef0cf Merge pull request #3184 from code-yeongyu/fix/issue-3163
fix: allow variant override even with agent model config (#3163)
2026-04-07 15:33:58 +09:00
YeonGyu-Kim 2465205356 fix: propagate project skills to background task sessions (#2687)
prompt-builder.ts now includes project-level skills from
.opencode/skills/ when building delegated session prompts.

5007 tests pass, tsc clean.

Closes #2687
2026-04-07 15:29:16 +09:00
YeonGyu-Kim ee8410ce03 fix: allow variant override even with agent model config (#3163)
model-selection.ts now separates model selection from variant/reasoning
tier, so agent model overrides don't lock the variant.

34 tests pass, 5009 total, tsc clean.

Closes #3163
2026-04-07 15:29:12 +09:00
YeonGyu-Kim 5622d154fd fix: prevent background agent race condition in session prompt (#2932)
Added await for session ready state before sending prompt in
background-agent/manager.ts. Also improved image resizer error handling.

132 tests pass, tsc clean.

Closes #2932
2026-04-07 15:29:11 +09:00
YeonGyu-Kim 062b8cd718 Merge pull request #3169 from code-yeongyu/fix/sisyphus-junior-model
fix(model-fallback): respect user model override for sisyphus-junior category sessions (#2941)
2026-04-07 15:14:09 +09:00
YeonGyu-Kim 5db6bfd97d Merge pull request #3174 from code-yeongyu/fix/issue-3033
fix(look-at): make multimodal-looker prompt conditional on Read availability (#3033)
2026-04-07 15:14:01 +09:00
YeonGyu-Kim b1c536ddd8 fix(look-at): make multimodal-looker prompt conditional on Read availability (#3033)
When Read tool is disabled (attachment mode), the agent prompt now
instructs to analyze the attached content directly instead of
trying to use Read. 3 new tests, 55 total pass.

Closes #3033
2026-04-07 15:11:26 +09:00
YeonGyu-Kim 889294a5fd fix(model-fallback): respect user model override for sisyphus-junior category sessions (#2941)
When users configure agents.sisyphus-junior.model, category sessions
should use that model without falling back to hardcoded
AGENT_MODEL_REQUIREMENTS. Two leaks existed:

1. Launch-time: category-resolver.ts did not check overrideModel when
   deciding whether to use the hardcoded fallbackChain. Fixed by adding
   overrideModel to the suppression condition.

2. Runtime retry: model-fallback hook.ts treated undefined fallbackChain
   (from setSessionFallbackChain(id, undefined)) as 'no override' and
   fell through to AGENT_MODEL_REQUIREMENTS on session.error/status
   retry. Fixed by storing explicit empty array and checking .has()
   instead of truthiness.

Tests added:
- hook.test.ts: explicit empty session fallback suppresses agent chain
- event.model-fallback-2941.test.ts: session.error does not arm retry
- category-resolver.test.ts: overrideModel suppresses fallbackChain
- tools.test.ts: sisyphusJuniorModel override assertion
2026-04-07 11:20:42 +09:00
YeonGyu-Kim f8c626086e fix(agent-names): use HTTP-header-safe display names and config keys for API calls (#3138)
Display names with parentheses like 'Atlas (Plan Executor)' cause HTTP
header validation errors in x-opencode-agent-name. This was blocking
Atlas/Prometheus from working via /start-work and auto-retry.

Changes:
- Display names: parens -> dashes ('Atlas - Plan Executor')
- Hooks (start-work, no-hephaestus-non-gpt, no-sisyphus-gpt): use
  config keys ('atlas', 'sisyphus', 'hephaestus') for agent API fields
- auto-retry: use config key instead of display name for promptAsync
- agent-override-protection: handle dash-suffix normalization
- Updated all test expectations to match new format

Closes #3138
2026-04-07 10:08:04 +09:00
YeonGyu-Kim bd37e6676a fix(delegate-task): make description optional with auto-generation from prompt (#3162)
When weaker models (GLM-5, MiniMax) omit the description parameter on
delegate_task, the tool now auto-generates it from the first 4 words of
the prompt instead of throwing an error.

Changes:
- Schema: description is now optional (tool.schema.string().optional())
- Runtime: auto-generates from prompt when missing/empty/whitespace
- DelegateTaskArgs.description type stays as string (guaranteed by auto-gen)
- Tests: 3 new cases - missing/empty/explicit description handling
- Metadata title set after description resolution (correct ordering)
2026-04-07 09:30:22 +09:00
YeonGyu-Kim 137c2459f7 fix(prompt): prevent immediate BackgroundOutput polling after background task launch
Tool return values contained CTAs ("Use background_output to check") that
caused models to immediately poll instead of waiting for <system-reminder>
notifications. Unified all 5 tool return messages with explicit "Do NOT call
background_output now" guard, added pre-notification warning to BackgroundOutput
tool description, and strengthened Background Result Collection sections across
all 3 Sisyphus prompt variants (default, gpt-5-4, main) with BLOCKING
anti-pattern enforcement.

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-04-06 17:18:47 +09:00
YeonGyu-Kim 213cee27cc fix(types): resolve zod v3 type inference differences in task tools
zod v3 infers .default([]) fields as string[] | undefined in z.infer
output type (unlike v4 which marks them as string[]). Add nullish
coalescing guards and use any[] for the readJsonSafe result array
to avoid the type mismatch in task-list and task-update.
2026-04-06 14:20:30 +09:00
YeonGyu-Kim afd554b2d9 fix(delegate-task): validate description parameter and handle undefined in notifications
OpenCode's fromPlugin wrapper skips Zod validation for plugin tools, so
LLMs can omit required args like description without getting an error.
When Atlas orchestrates and the model omits description, it flows through
as undefined to manager.launch() and background task notifications show
'undefined' for all completed tasks.

Two fixes:
- Add runtime validation for description in delegate-task tool (matches
  existing run_in_background and load_skills validation pattern)
- Defensive fallback in notification template: use task ID when
  description is missing instead of rendering 'undefined'
2026-04-05 17:18:10 +09:00
YeonGyu-Kim d5dfaaa3ad fix(delegate-task): remove kimi from unstable agent detection, harden callID resolution for metadata store
- Remove kimi from auto-detected unstable agents in category-resolver (only gemini/minimax remain)
- Add resolveCallID() to safely resolve callID/callId/call_id variants from tool context
- Use resolveCallID across all 5 delegate task execution paths (sync, background, unstable, continuations)
- Update writing category test to verify kimi runs sync when kimi provider is available
- Add atlas metadata preservation tests confirming tool-execute-after does not clobber metadata

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-04-05 15:30:36 +09:00
auyua9 0bb16e5149 fix(session-manager): use sdk data in getSessionInfo 2026-04-05 14:38:13 +09:00
YeonGyu-Kim 7b7526e2f6 docs(src): update counts across tools, features, config, cli AGENTS.md
- tools: 15 -> 16 dirs, writing model kimi-k2p5 -> gemini-3-flash
- features: builtin skills 6 -> 8 (+review-work, +ai-slop-remover)
- config: schema files 24 -> 27 (+git-env-prefix, model-capabilities, openclaw)
- cli: commands 5 -> 6 (+refresh-model-capabilities)
- plugin-handlers: 13 -> 14 non-test files
- shared: 95+ -> 100+ utility files
2026-04-05 14:12:31 +09:00
YeonGyu-Kim 130f4ac080 fix: resolve #3124 #3125 #3127 session tools, cache priming, and compaction loop
- #3124: Session tools now merge SDK and file-backed sessions for SQLite backend
- #3125: Cache priming fixed for OpenCode >=1.3.14 empty workspace
- #3127: Activity-based progress detection prevents infinite compaction on Kimi/Minimax

All 29 new tests pass, 4885 total tests passing.
2026-04-05 09:30:19 +09:00
YeonGyu-Kim da86b57f23 test: fix CI test isolation - upgrade Bun, fix mock contamination and fresh-import patterns 2026-04-05 01:01:19 +09:00
YeonGyu-Kim acfed926f8 test: isolate subagent-resolver.test.ts to prevent mock contamination 2026-04-04 21:31:28 +09:00
YeonGyu-Kim feaa674963 test: fix imports for mcp-index and subagent-resolver isolation 2026-04-04 21:30:42 +09:00
YeonGyu-Kim ba26b6f29d test: isolate skill-tools and mcp-index tests to prevent mock contamination
Moves test files with mock.module() calls into zauc-mocks-* directories
to prevent process-global mock pollution affecting subsequent tests.

- src/tools/skill/tools.test.ts -> zauc-mocks-skill-tools/
- src/mcp/index.test.ts -> zauc-mocks-mcp-index/

Fixes remaining 21 CI failures (resolveSubagentExecution + slashcommand).
2026-04-04 20:49:47 +09:00
YeonGyu-Kim 00f73de8d9 Merge pull request #3063 from code-yeongyu/fix/issue-3040
fix: respect user-configured category model over fallbackChain defaults
2026-04-04 20:34:12 +09:00
YeonGyu-Kim 55d5ecb9fb test: fresh-import remaining contamination-prone modules 2026-04-04 20:14:50 +09:00
YeonGyu-Kim a4db240d47 test: localize mock.module setup to fresh imports 2026-04-04 19:49:25 +09:00
YeonGyu-Kim f8398dbec3 fix(delegate-task): restrict task-callable agent modes 2026-04-04 19:33:11 +09:00
YeonGyu-Kim e40d3fb37a fix(session-manager): fall back to file storage on SDK outages 2026-04-04 16:42:51 +09:00
YeonGyu-Kim 1fae073009 fix(sync): forward delegated model tuning params
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-04 15:40:37 +09:00
YeonGyu-Kim e860108b60 refactor: replace em dashes with hyphens in test files and docs
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-04 14:35:49 +09:00
YeonGyu-Kim fd252ea82e refactor: remove AI-generated code smells from prepublish changes
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-04 02:02:12 +09:00
YeonGyu-Kim 468827d08f test(skill): stabilize async description refresh assertion
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-04 01:28:01 +09:00
YeonGyu-Kim fabbcaa4b7 refactor(runtime): replace unicode dashes in prompt strings
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-04 01:27:51 +09:00
YeonGyu-Kim 53eeac3f31 fix(ci): simplify test runner to plain bun test by fixing mock.module() leakage
- Add afterAll(() => { mock.restore() }) to 52 test files missing cleanup
- Rewrite create-tool-guard-hooks.test.ts to use spyOn instead of barrel mock
- Fix skill-mcp-manager OAuth tests with missing mockTokens/mockLogin definitions
- Fix start-work hook: show worktree active block on resume with existing worktree_path
- Extract createWorktreeActiveBlock to worktree-block.ts to avoid circular import
- Replace 80-line isolated test runner CI config with single `bun test` command
2026-04-04 00:34:03 +09:00
YeonGyu-Kim 22283fca6d refactor(tools): fix empty catches, remove AI slop from code comments 2026-04-03 19:17:09 +09:00
YeonGyu-Kim 3689ecd5b0 refactor(tools): decompose skill/tools.ts into focused tool creators 2026-04-03 19:17:03 +09:00
YeonGyu-Kim 3ce1f30310 refactor(tools): split delegate-task constants into category-specific modules 2026-04-03 19:16:57 +09:00
YeonGyu-Kim 8f449e1627 fix: respect user-configured category model over fallbackChain defaults
When a user configures a custom model for a category (e.g. quick.model),
the hardcoded CATEGORY_MODEL_REQUIREMENTS fallbackChain was overriding it.
This caused the user's model to be ignored and replaced with the default
(e.g. openai/gpt-5.4-mini).

Fix:
- Use userModelOverride directly instead of potentially stale actualModel
- Suppress hardcoded fallbackChain when explicitCategoryModel is provided
- Add regression test verifying user category model takes precedence

Closes #3040
2026-04-03 18:27:26 +09:00
YeonGyu-Kim ed06428ba3 fix(delegate-task): strip wrapping chars from subagent_type before lookup
LLMs sometimes wrap agent names in backslashes, quotes, or slashes
(e.g. \hephaestus\ instead of hephaestus). The trim() call only
removed whitespace, causing "Agent not found" errors during delegation.

Now strips leading/trailing backslashes, quotes, and slashes before
the case-insensitive agent lookup.

Adds regression tests for backslash-wrapped, double-quoted, and
single-quoted agent names.

Fixes: release blocker — delegate_task to hephaestus failing in
pre-publish review sessions.
2026-04-03 17:13:11 +09:00
YeonGyu-Kim 027a6b0039 fix(skill-mcp): use correct sessionID when registering skill MCP connections
Fixes #3021
2026-04-02 15:45:39 +09:00
YeonGyu-Kim f0309dff24 Merge pull request #3016 from code-yeongyu/fix/issue-3003-ripgrep-autodownload
fix(grep): enable ripgrep auto-download when not found in PATH
2026-04-02 15:10:35 +09:00
YeonGyu-Kim 5bf3aa1cfb fix(test): remove mock.module tests that corrupt other test suites
Bun's mock.module() leaks across test files in single-process runs,
causing 357 unrelated test failures. Removing these tests for now.
The code fix is correct and verified manually.
2026-04-02 13:57:05 +09:00
YeonGyu-Kim 4c4efc416a fix(grep): enable ripgrep auto-download when not found in PATH
The auto-download mechanism for ripgrep existed but was never called.
When 'rg' wasn't in PATH, the grep tool silently fell back to GNU grep,
which wastes ~10% token budget due to noisy results.

Changes:
1. Wired up resolveGrepCliWithAutoInstall() in the CLI resolution path
2. When 'rg' is not found in PATH, auto-downloads ripgrep v14.1.1
3. Caches the downloaded binary in OpenCode data directory
4. Falls back to GNU grep only if auto-download fails (with warning)

Fixes #3003
2026-04-02 13:32:23 +09:00
YeonGyu-Kim a637cca702 Merge pull request #3013 from code-yeongyu/fix/issue-2971-skill-shortname
fix(skill): resolve namespaced skills by short name
2026-04-02 10:43:52 +09:00