Commit Graph

1115 Commits

Author SHA1 Message Date
YeonGyu-Kim 39a549a3df Merge pull request #4381 from code-yeongyu/fix/team-mode-closure-prompts
fix(team-mode): make lead close teams on its own initiative
2026-05-24 15:37:28 +09:00
YeonGyu-Kim 5f1fb0c52a fix(team-mode): make lead close teams on its own initiative
The lead currently leaves teams alive after the task list drains because
none of the prompt surfaces tell it WHEN to close or HOW. omx-style
'self-closing' behavior was missing for four reasons (diagnosed via
prompt-engineering A/B/C: wrong / misframed / missing):

1. builtin team-mode skill 'Lifecycle' (B+C): 'phase ends / shape
   outgrown' is qualitative, so the model maps it to 'wait for user'.
   Step 6 jumped to team_delete without the request/approve pair the
   tool contract requires. Replaced with a 'Closure Contract' (a
   computable predicate over team_task_list + team_status) and an
   explicit 'Closure Sequence' (request -> approve -> delete, with
   force=true reserved for unrecoverable paths only).

2. TEAM_MESSAGE keyword injection (C): spent 100%% of its one-shot
   budget on routing ('do not substitute delegate_task'), 0%% on
   closure. Added the same closure rule in compressed form. Kept the
   'NEVER substitute with delegate_task' literal that
   keyword-detector/index.test.ts depends on.

3. team-mode-status-injector body (C): the only per-session injection
   for team mode had no closure obligation. Replaced the optional
   'load the team-mode skill ... otherwise use the team_* tools'
   sentence with a 'Closure invariant' clause that ties the check to
   every team_task_update.

4. member-guidance Wrap-up (A+B): step 3 said 'so the lead can decide
   whether to request shutdown', but team_shutdown_request is
   lead-only - members cannot initiate it. Step ordering also placed
   the completion message before team_task_update, so the lead's
   closable check would see stale data. Reordered to
   task_update -> check task_list for new work -> if nothing left,
   send a single 'closure-ready' message and idle. Test assertion
   updated to match the new accurate contract.

Also: stripped Korean alternation from TEAM_PATTERN per directive
('절대로 코드 내에 한국어 적지 마라'). Pattern is now
/\\bteam[\\s_-]?mode\\b/i. Removed 4 Korean test cases
(2 positive triggers + 2 false-positive guards) that the pattern no
longer needs to defend, and updated the keyword-detector AGENTS.md
row.

Net: -71 lines across prompt surfaces. The Closure Contract is the
only addition; everything else tightened.

Tests: 428/428 pass across src/features/team-mode/,
src/features/builtin-skills/, src/hooks/keyword-detector/,
src/hooks/team-mode-status-injector/, src/hooks/team-mailbox-injector/,
src/hooks/team-tool-gating/, src/hooks/team-session-events/.
LSP: no errors introduced (one pre-existing error in
keyword-detector/index.test.ts confirmed pre-existing on dev).
2026-05-24 15:21:24 +09:00
YeonGyu-Kim b3097e5693 fix(background-agent): suppress redundant parent wakes 2026-05-24 01:07:38 +09:00
YeonGyu-Kim 9e5c431817 Merge pull request #4297 from SpencerJung/fix/issue-4128-desktop-sidecar-crash
fix(background-agent): keep cleanup error listener active
2026-05-22 22:04:54 +09:00
YeonGyu-Kim 560569e369 fix(parent-wake-notifier): drop duplicate wakes during promptAsync gate hold (#4256, #4019)
In v4.1.0+, users observed duplicate assistant streams rendering the same
content in two languages simultaneously (e.g. Chinese + English), most often
at the end of a turn.

Root cause: ParentWakeNotifier.requeueWake() unconditionally requeued ANY
wake that arrived during the background-agent-parent-wake post-dispatch
hold window. When a duplicate completion edge fired during that hold, the
same wake was replayed after the hold expired, triggering a second prompt
dispatch and a parallel assistant stream.

The fix compares the new wake against dispatchedParentWakes.get(sessionID)
and drops identical wakes during the gate hold, while preserving the existing
requeue behavior for genuinely-new wakes and failed-dispatch retries.

Regression test added in given/when/then style covering the duplicate-during-
hold scenario (TDD red-then-green).

Fixes #4256
Fixes #4019
2026-05-22 20:40:37 +09:00
SpencerJung ec9997b7a6 fix(background-agent): keep cleanup error listener active
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-22 17:12:14 +09:00
YeonGyu-Kim bc0da0fad3 test: fix prometheus-prompt syntax + sync display name casing to lowercase
- prometheus-prompt.test.ts: close missing }) on the OpenSpec expanded
  commands describe block (introduced by d66b6bcbf, parse error).
- agent-sort-shim/agent-config-integration/continuation-injection/
  unstable-agent-babysitter/subagent-resolver/sync-executor/
  resolve-caller-team-lead tests: expect 'Sisyphus - ultraworker'
  (lowercase) to match production after cd39f8858, which lowercased the
  display name to dodge a TUI ZWSP rendering glitch. Legacy uppercase
  inputs that exercise the normalization path are preserved.
- sync-executor.ts + resolve-caller-team-lead.ts: route legacy display
  name inputs through normalizeAgentForPrompt so prompt agent names and
  caller team lead lookups produce the canonical lowercase form.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim dbfde0b056 fix(background-agent): ignore metadata stream output 2026-05-21 16:12:53 +09:00
YeonGyu-Kim 282010f97d fix(background-agent): gate stale timeout on abort success 2026-05-21 15:59:50 +09:00
YeonGyu-Kim 6d15ab86ab fix(background-agent): fail cancellation when abort fails 2026-05-21 15:50:28 +09:00
YeonGyu-Kim bd1a6e3d3b fix(background-agent): forward session stream activity 2026-05-21 15:49:58 +09:00
YeonGyu-Kim 0bf8a9df25 fix(background-agent): fail abort on SDK errors
Treat resolved abort responses with a non-null error payload the same as rejected aborts. This prevents stale-timeout cancellation bookkeeping from reporting success when the child session was not actually aborted.

Plan: .omo/plans/subagent-timeout-active-output.md
2026-05-21 15:23:52 +09:00
YeonGyu-Kim b68af25e41 fix(background-agent): track session.next activity
Convert OpenCode v2 session.next stream events into the existing message part activity path so child sessions that are still producing text, reasoning, or tool output refresh lastUpdate before stale polling runs.

This keeps the timeout poller from cancelling active subagents and preserves tool-call progress for session.next.tool.called events.

Plan: .omo/plans/subagent-timeout-active-output.md
2026-05-21 15:23:26 +09:00
YeonGyu-Kim 0feb125079 fix(background-agent): preserve missed polls on lookup errors 2026-05-21 13:13:14 +09:00
YeonGyu-Kim 3d40264456 Merge pull request #4228 from code-yeongyu/fix/delegate-stale-activity
Fix delegate stale timeout activity checks
2026-05-21 12:59:11 +09:00
YeonGyu-Kim deb13d8e86 Merge pull request #3241 from cpkt9762/fix/configurable-task-cleanup-delay
feat(background-task): make taskCleanupDelayMs configurable
2026-05-21 12:58:54 +09:00
YeonGyu-Kim 6678c2ae04 Merge pull request #3884 from leeyazhou/i18n
feat(i18n): add toast i18n with en/zh locale and plugin config support
2026-05-21 12:58:45 +09:00
YeonGyu-Kim e4049b7ab3 Merge pull request #4222 from andomeder/wip/pr1-skip-disconnected-explicit-provider-fallbacks
fix(background-agent): skip disconnected explicit-provider fallbacks
2026-05-21 12:57:58 +09:00
YeonGyu-Kim f7ceb03efe refactor(packages): extract boulder-state package 2026-05-21 12:49:33 +09:00
YeonGyu-Kim a5c1d71001 refactor(packages): extract utils package 2026-05-21 12:48:43 +09:00
YeonGyu-Kim 6e6f300c7d fix(background-agent): defer stale cancel on activity lookup errors 2026-05-21 12:43:51 +09:00
YeonGyu-Kim 927cc84fa5 fix(background-agent): refresh stale checks from session activity 2026-05-21 12:32:43 +09:00
YeonGyu-Kim 0ad4d974f1 fix(background-agent): preserve parent activity across idle events
Cubic caught that clearing recent parent activity on session.idle could reopen the stale-idle race. Keep the fresh activity marker until its normal expiry so background completions still defer while the parent turn is actively reasoning.

Red: parent idle after fresh reasoning delta dispatched an unexpected parent wake. Green: focused parent-wake regression suite passes.
2026-05-21 12:07:40 +09:00
YeonGyu-Kim a8201726ef fix(background-agent): defer parent wakes during active turns
Record fresh parent session message activity before parent-wake flushing so stale idle status cannot dispatch a background completion into a live reasoning turn.

Add regression coverage for the Discord 4.2.3/OpenCode 1.15.5 duplicate-branch repro shape where a parent reasoning delta arrives before the background all-complete wake.

Refs #4212

Refs #4019

Refs #3774

Plan: plans/background-notification-active-turn-queue.md
2026-05-21 11:50:30 +09:00
William Obino 5a965fb44f fix(background-agent): skip disconnected explicit-provider fallbacks 2026-05-21 02:55:18 +03:00
YeonGyu-Kim 2a4f5f2877 Merge pull request #2958 from kui123456789/fix/context-injector-prt-prefix
fix(context-injector): prefix synthetic part ids with prt_
2026-05-21 00:56:26 +09:00
YeonGyu-Kim ace15a6afe Merge pull request #3785 from Biemmmmm/fix/resolve-plugin-root-in-commands
fix: resolve ${CLAUDE_PLUGIN_ROOT} in plugin commands, agents, and skills
2026-05-21 00:48:33 +09:00
YeonGyu-Kim d0719ff7b7 Merge pull request #3875 from jollyxenon/fix/3846-opencode-config-dir-additive
fix(config): align OPENCODE_CONFIG_DIR with additive OpenCode semantics
2026-05-21 00:48:00 +09:00
YeonGyu-Kim 6dcb2afd41 Merge pull request #3838 from NICxKMS/fix/team-mode-windows-atomic-write
fix(team-mode): sync atomic writes through writable handle
2026-05-21 00:46:24 +09:00
YeonGyu-Kim 2185babd28 Merge pull request #3936 from wjiuxing/fix/flaky-spawner-test-polling
fix: replace brittle setTimeout(50) with polling waitForCondition in spawner tests
2026-05-21 00:46:06 +09:00
YeonGyu-Kim cad63c97bd Merge pull request #4052 from PeterPonyu/fix/3505-attach-retry-until-session-ready
fix(tmux-subagent): wait for session readiness before spawning attach pane
2026-05-21 00:45:15 +09:00
YeonGyu-Kim 0e49767a3e Merge pull request #4026 from dihak/fix/graceful-shutdown-exit
fix(process-cleanup): call process.exit() after SIGTERM cleanup
2026-05-21 00:43:32 +09:00
YeonGyu-Kim e824115a2f Merge pull request #4063 from PeterPonyu/fix/3963-server-url-port-zero
fix(team-mode): surface port-0 fallback and silent layout skip (#3963)
2026-05-21 00:42:20 +09:00
YeonGyu-Kim cb124f75a5 Merge pull request #4065 from PeterPonyu/fix/3987-team-create-hard-reject-validation
fix(team-mode): reject team_create from hard-reject agents (#3987)
2026-05-21 00:42:04 +09:00
YeonGyu-Kim a1f03c8461 Merge pull request #4066 from PeterPonyu/fix/2887-filter-terminal-probe-replies
fix(tmux-subagent): drain terminal probe replies during delegated pane startup (#2887)
2026-05-21 00:41:57 +09:00
YeonGyu-Kim 6637a18450 Merge pull request #4067 from PeterPonyu/fix/3898-fallback-preserve-team-context
fix(team-mode): preserve team membership across model fallback (#3898)
2026-05-21 00:41:11 +09:00
YeonGyu-Kim 343d9ed2fe Merge pull request #4099 from sjawhar/fix/mcp-reload-survival
fix(skill-mcp): allow MCP manager to accept connections after disconnectAll
2026-05-21 00:13:29 +09:00
YeonGyu-Kim 7a5b8d831e Merge pull request #4100 from sjawhar/fix/tmux-isolated-close-no-layout
fix(tmux): skip layout enforcement when closing isolated container pane
2026-05-21 00:11:55 +09:00
YeonGyu-Kim aa5eeaf892 Merge pull request #4102 from sjawhar/fix/skill-directory-param
fix(skill): pass directory to getAllSkills + fix async test timing
2026-05-21 00:08:40 +09:00
YeonGyu-Kim 3e9c3f8ada Merge pull request #4146 from LYY/fix/skill-shortname-fallback
fix: support unambiguous short skill names in delegated skill loading
2026-05-20 23:42:44 +09:00
YeonGyu-Kim 791825fc20 Merge pull request #4153 from MoerAI/fix/fallback-model-string-guard
fix(shared,delegate-task,claude-code-agent-loader): guard model parsers against non-string input (fixes #4145)
2026-05-20 23:40:33 +09:00
YeonGyu-Kim fd6a7aed17 Merge pull request #4176 from jangByeongHui/fix/skill-mcp-env-allowlist-bypass-3995
fix(skill-mcp-manager): trust explicit skill MCP env vars (#3995)
2026-05-20 23:09:12 +09:00
YeonGyu-Kim 4611856176 Merge pull request #4172 from MoerAI/fix/team-mode-base-dir-chmod-eperm 2026-05-20 18:59:59 +09:00
YeonGyu-Kim 330e437f08 docs(agents): regenerate hierarchical AGENTS.md for 2026-05-20
Sync the AGENTS.md hierarchy to current code state:

Drift fixes in 11 existing files
- Root: 2026-05-20 commit 39aadbf9f, ~2167 TS files, 120 barrel index.ts,
  57 src/hooks dirs, 297 (179 non-test) src/shared files, 11 OpenCode hook
  handlers in plugin-interface.ts, packages list adds ast-grep-mcp + rules-core,
  first-prompt-watchdog 206 LOC, parent-wake-notifier 587 LOC
- src/AGENTS.md: file counts, plugin-interface handler count
- src/shared/AGENTS.md: title + counts 278/170 -> 297/179
- src/hooks/AGENTS.md: 57 dirs, note unwired WIP (task-reminder,
  hashline-edit-diff-enhancer)
- src/features/AGENTS.md: module map with NON-TEST counts + sub-AGENTS.md
  column, 7 modules without sub-doc
- src/features/background-agent/AGENTS.md: add 12 newer files (parent-wake-
  notifier 587 LOC, loop-detector, error-classifier, fallback-retry-handler,
  process-cleanup, subagent-spawn-limits, session-status-classifier,
  compaction-aware-message-resolver, etc.)
- src/plugin/AGENTS.md: 11 handlers, add system-transform.ts + command-
  execute-before.ts + build-team-idle-wake-hint-client.ts
- src/config/AGENTS.md: note schema/internal/permission.ts
- src/cli/AGENTS.md: 8 commands including 'version'
- src/plugin-handlers/AGENTS.md, packages/web/AGENTS.md: date bump

New AGENTS.md in 4 directories
- packages/AGENTS.md: index of 15 packages (11 platform binaries + 2 MCP
  packages + rules-core + web), role map, conventions
- docs/AGENTS.md: WHERE TO LOOK table for 19 docs across 6 subdirs
- .opencode/AGENTS.md: 5 skills + 4 slash commands + relationship to .agents/
- .agents/AGENTS.md: superset migration target (9 skills + 4 commands)
2026-05-20 17:18:44 +09:00
YeonGyu-Kim 11d2cfb8a8 fix(background-agent): re-enqueue parent wake on same-source reservation instead of dropping
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:24:08 +09:00
YeonGyu-Kim ee8b80a5e2 test(background-agent): add red test for parent-wake drop on same-source reservation hold (BUG-E)
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:24:08 +09:00
YeonGyu-Kim da5aa7f32e test(team-mode): allow reclaimed reservations to stay readable
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:05:57 +09:00
YeonGyu-Kim f79da77fe0 test(team-mode): decouple resume history fixture from session routing
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 13:00:48 +09:00
YeonGyu-Kim af42f0ac70 test(team-mode): stabilize resume stale reservation history check
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 12:52:00 +09:00
YeonGyu-Kim 655dffbc2a fix(team-mode): release reservation on ambiguous failure, commit on success-path mark failure
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-20 12:30:02 +09:00