Commit Graph

4682 Commits

Author SHA1 Message Date
YeonGyu-Kim ae3a8d628b fix(delegate-task): tighten subagent depth guard + add regression smoke tests
The depth limit (default maxDepth=3) was being silently bypassed when
sync-task.ts could not reach the manager's spawn enforcement methods --
the fallback hardcoded childDepth: 1, allowing infinite recursion of
delegate_task calls in degraded environments.

This was hard to catch because:
1. The fallback path took the dangerous default silently (no log).
2. There were no end-to-end smoke tests asserting that the depth value
   coming back from reserveSubagentSpawn is actually used.
3. The unit tests for resolveSubagentSpawnContext only covered error
   cases, not the actual depth calculation.

Changes:
- sync-task.ts: split the spawnContext fallback into an explicit if/else
  with a WARNING log when the manager is missing enforcement methods.
  This makes the dangerous path observable in logs.
- subagent-spawn-limits.test.ts: add depth calculation regression tests
  (root, depth-1, depth-2, depth at max, parent cycle detection).
- sync-task.test.ts: add two regression smoke tests:
  1. depth limit error from reserveSubagentSpawn must be propagated and
     must NOT create the session.
  2. spawnDepth recorded in metadata must equal what reserveSubagentSpawn
     returns -- guards against silent fallback to childDepth: 1.

15 new spawn-limits tests + 2 new sync-task tests pass.
Full suite: 5105 pass, 0 fail.
2026-04-07 19:56:51 +09:00
YeonGyu-Kim 8f129eb4ad fix(test): update plugin tests to use getAgentListDisplayName for agent assertions
- Update plugin-interface.test.ts expectations to use getAgentListDisplayName
- Update chat-message.test.ts expectations for agent display names
- Add smoke test for quoted plan name resolution in chat-message.test.ts
- Aligns test expectations with proper agent name formatting

🤖 Generated with OhMyOpenCode assistance
2026-04-07 19:05:14 +09:00
YeonGyu-Kim 0452343f2b fix(start-work): use getAgentListDisplayName for Atlas agent selection
- Use getAgentListDisplayName instead of getAgentDisplayName for Atlas in start-work-hook.ts
- Update test expectations in index.test.ts to match the correct display name format
- Ensures Atlas agent name uses proper list format (e.g., "Atlas - Orchestrator")

🤖 Generated with OhMyOpenCode assistance
2026-04-07 19:05:06 +09:00
YeonGyu-Kim 557c2db65a feat(start-work): add plan name normalization and quote stripping
- Add WRAPPING_QUOTES_PATTERN to parse-user-request.ts to strip quotes from plan names
- Add normalizePlanLookupValue() to context-info-builder.ts for slug normalization
- Enhanced findPlanByName() with normalized exact and partial matching
- Allows human-readable plan names (e.g., "my feature plan") to match slugged filenames (e.g., my-feature-plan.md)

🤖 Generated with OhMyOpenCode assistance
2026-04-07 19:04:58 +09:00
YeonGyu-Kim 83a80e21fb fix(ci): add skipLibCheck to script tsconfig to avoid bun-types/@types/node conflicts
CI ubuntu-latest has @types/node ambient types that conflict with
bun-types for CompressionStream/DecompressionStream declarations.
skipLibCheck skips checking .d.ts files from node_modules.
2026-04-07 18:36:56 +09:00
YeonGyu-Kim a00fe13122 fix(test): update normalizeAgentForPrompt expectations to dash format
Test expected legacy parenthesized names but display names now use
dash format (Sisyphus - Ultraworker, not Sisyphus (Ultraworker)).
This was the flaky CI failure on dev.
2026-04-07 16:09:37 +09:00
YeonGyu-Kim dcecf049a1 Merge pull request #3189 from code-yeongyu/fix/issue-3146
fix(plugin-loading): improve error handling for plugin installation failures (#3146)
2026-04-07 15:57:53 +09:00
YeonGyu-Kim f27a7f2c95 ci: retrigger after rebase 2026-04-07 15:52:14 +09:00
YeonGyu-Kim 6eb527c914 fix: remove ZWSP from agent display names (#3146) 2026-04-07 15:44:31 +09:00
YeonGyu-Kim b269f11522 Merge pull request #3181 from code-yeongyu/fix/issue-3144
fix(cli): include fallback_models when writing agent model config (#3144)
2026-04-07 15:43:57 +09:00
YeonGyu-Kim 2f19cd28f6 Merge pull request #3178 from code-yeongyu/fix/issue-3164
fix(jsonc): strip UTF-8 BOM before parsing JSONC files (#3164)
2026-04-07 15:43:55 +09:00
YeonGyu-Kim 360fd3211d ci: trigger workflows 2026-04-07 15:39:51 +09:00
YeonGyu-Kim b77c256943 fix(jsonc): strip BOM before parsing (#3164) 2026-04-07 15:39:51 +09:00
YeonGyu-Kim bb1bad8e02 fix(cli): include fallback_models when writing agent model config (#3144)
Installer now generates fallback_models array alongside explicit model
overrides, preserving the fallback chain.

46 tests pass, tsc clean.

Closes #3144
2026-04-07 15:39:21 +09:00
YeonGyu-Kim e8c8376db4 fix(boulder): support both structured and simple plan formats in getPlanProgress
Structured plans (with ## TODOs section) use strict numbered-label
parsing. Simple plans (without sections) fall back to regex checkbox
counting. This fixes 9 test failures from the #3066 merge.
2026-04-07 15:39:08 +09:00
YeonGyu-Kim cf04f51068 Merge pull request #3185 from code-yeongyu/fix/issue-2462
fix: detect token-limit errors to prevent todo-continuation infinite loop (#2462)
2026-04-07 15:35:48 +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 4e6e76179c Merge pull request #3186 from code-yeongyu/fix/issue-2689
fix: register custom user agents in delegate-task resolver (#2689)
2026-04-07 15:35:25 +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 aade99ee04 Merge pull request #3183 from code-yeongyu/fix/issue-2932
fix: prevent background agent race condition in session prompt (#2932)
2026-04-07 15:33:34 +09:00
YeonGyu-Kim d64cd66c7a Merge pull request #3182 from code-yeongyu/fix/issue-2964
fix: inject agent identity into system prompt for built-in agents (#2964)
2026-04-07 15:33:17 +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 fc009caaa1 fix: register custom user agents in delegate-task resolver (#2689)
agent-config-handler.ts now registers custom agents from
~/.config/opencode/agents/ into the task subagent registry.

5005 tests pass, tsc clean.

Closes #2689
2026-04-07 15:29:14 +09:00
YeonGyu-Kim a9c73986d7 fix: detect token-limit errors in todo-continuation to prevent infinite loop (#2462)
handler.ts now catches ContextLengthError/prompt-too-long errors and
stops continuation instead of retrying with an even larger context.

91 tests pass, tsc clean.

Closes #2462
2026-04-07 15:29:13 +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 b2e7ddfb73 fix: inject agent identity into system prompt for built-in agents (#2964)
Built-in agents (Sisyphus, Hephaestus, Atlas) now include explicit
identity section in their system prompts, matching custom agent behavior.

12 agent identity tests pass, 266 total pass, tsc clean.

Closes #2964
2026-04-07 15:29:10 +09:00
YeonGyu-Kim be562905d6 Merge pull request #3179 from code-yeongyu/fix/issue-3066
fix(start-work): add CHECKED_CHECKBOX_PATTERN for plan progress (#3066)
2026-04-07 15:16:18 +09:00
YeonGyu-Kim b4b9aea849 Merge pull request #3177 from code-yeongyu/fix/issue-3168
fix(mcp): bypass env var allowlist for trusted skill MCP configs (#3168)
2026-04-07 15:15:55 +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 6ebe1bf1ab Merge pull request #3176 from code-yeongyu/fix/issue-3113
fix(keyword-detector): start ralph-loop when ulw keyword detected (#3113)
2026-04-07 15:14:07 +09:00
YeonGyu-Kim 5b53f6fdc7 Merge pull request #3175 from code-yeongyu/fix/issue-3129
fix(auto-update): align PACKAGE_NAME with published package name (#3129)
2026-04-07 15:14:04 +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 b4baec75d3 Merge pull request #3173 from code-yeongyu/fix/issue-3081
fix(prompt): propagate variant field in all promptAsync continuation paths (#3081)
2026-04-07 15:13:58 +09:00
YeonGyu-Kim 0ab2370d4e fix(start-work): add CHECKED_CHECKBOX_PATTERN for plan progress tracking (#3066)
Plan progress now correctly counts checked checkboxes when determining
current task vs completed tasks.

TDD verified. tsc clean.

Closes #3066
2026-04-07 15:11:50 +09:00
YeonGyu-Kim 73d407fe73 fix(mcp): bypass env var allowlist for trusted skill MCP configs (#3168)
Added 'trusted' option to expandEnvVars. Skill MCPs are user-controlled
and now bypass the security allowlist. 3 files changed.

TDD verified. tsc clean.

Closes #3168
2026-04-07 15:11:47 +09:00
YeonGyu-Kim 717c976c66 fix(keyword-detector): start ralph-loop when ulw keyword detected (#3113)
Plain 'ulw' keyword now starts the continuation loop via
ralphLoop.startLoop(), matching README promise. Wired through
create-core-hooks.ts and create-transform-hooks.ts.

TDD: 40 keyword-detector tests pass, 1239 hook tests pass, tsc clean.

Closes #3113
2026-04-07 15:11:29 +09:00
YeonGyu-Kim eb8d7191ff fix(auto-update): align PACKAGE_NAME with published package name (#3129)
Changed PACKAGE_NAME from 'oh-my-openagent' to 'oh-my-opencode' in
auto-update-checker/constants.ts to match package.json. This fixes
getCachedVersion() returning null, causing 'unknown' in version toast.

TDD: red-green confirmed. 39 tests pass, tsc clean.

Closes #3129
2026-04-07 15:11:28 +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 aa528e42c0 fix: propagate variant field in all promptAsync continuation paths (#3081)
All 5 continuation paths now send variant as top-level body field:
- boulder-continuation-injector.ts
- ralph-loop/continuation-prompt-injector.ts
- todo-continuation-enforcer/continuation-injection.ts
- unstable-agent-babysitter-hook.ts
- session-recovery/resume.ts

Plus type/helper updates in atlas, todo-continuation-enforcer,
unstable-agent-babysitter, and session-recovery.

TDD: 18 regression tests added, all pass. tsc clean.
2026-04-07 15:10:38 +09:00
YeonGyu-Kim bf2c104c9e Merge pull request #3172 from code-yeongyu/fix/bom-strip-jsonc
fix(jsonc-parser): strip UTF-8 BOM before parsing
2026-04-07 14:51:00 +09:00
YeonGyu-Kim daae6ed05b fix(jsonc-parser): strip UTF-8 BOM before parsing to fix Windows "InvalidSymbol at offset 0" errors
Windows editors often save UTF-8 files with a BOM (Byte Order Mark: \uFEFF).
When this is present, jsonc-parser reports InvalidSymbol at offset 0 because
the BOM is not valid JSON/JSONC syntax.

This commit strips the BOM before parsing, fixing issues #3164 where Windows
users report their opencode.jsonc file fails to parse even though it appears
to start with a valid '{' character.

Fixes: #3164
Co-authored-by: Jobdori <agent@yeongyu.kim>
2026-04-07 14:48:30 +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 12106ffccc Merge pull request #3167 from code-yeongyu/fix/agent-header-validation
fix(agent-names): use HTTP-header-safe display names and config keys for API calls
2026-04-07 10:13:44 +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 ebfd4a41ee Merge pull request #3166 from code-yeongyu/fix/delegate-description-optional
fix(delegate-task): make description optional with auto-generation from prompt
2026-04-07 09:39:29 +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
github-actions[bot] 10eb8b9acf @Melivo has signed the CLA in code-yeongyu/oh-my-openagent#3160 2026-04-06 15:38:07 +00:00
YeonGyu-Kim 3e8fd5ff18 fix(start-work): always hand off to atlas regardless of current session agent (#3155)
/start-work is the "execute this plan with atlas" command.
Previously, if the user's current session agent was sisyphus (or any
non-prometheus/non-atlas agent), the hook would keep that agent instead
of switching to atlas. This caused sisyphus to execute the plan.

Fix: unconditionally select atlas (when registered) or sisyphus (fallback).
The current session agent is irrelevant to /start-work's intent.

Adds regression test: running /start-work from a sisyphus session must
always hand off to atlas when atlas is available.
2026-04-06 19:55:04 +09:00
YeonGyu-Kim 23180c6ba6 fix(schema): use zodToJsonSchema instead of z.toJSONSchema for zod v3 compat
z.toJSONSchema is a zod v4 API. We pin zod to ^3.24.0 for opencode
compatibility, so use zodToJsonSchema from zod-to-json-schema package.
2026-04-06 18:51:56 +09:00