Commit Graph

6758 Commits

Author SHA1 Message Date
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 7409f2ea3b Merge pull request #4300 from code-yeongyu/fix/issue-3919-desktop-native-search
fix(tools/grep, tools/glob): Node-safe subprocess streaming for Desktop utility-process compatibility (#3919)
2026-05-22 20:58:08 +09:00
YeonGyu-Kim e6d8b3e7d3 Merge pull request #4299 from code-yeongyu/fix/issue-4128-ctx-dollar-guard
fix(session-notification-sender): guard ctx.$ availability with execFile fallback (#4128, #4061)
2026-05-22 20:49:16 +09:00
YeonGyu-Kim a51d22d33c Merge pull request #4301 from code-yeongyu/fix/issue-4256-duplicate-prompt-dispatch
fix(parent-wake-notifier): suppress duplicate parent wakes during promptAsync gate hold (#4256, #4019)
2026-05-22 20:48:02 +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
YeonGyu-Kim aded57ff1f fix(shared): harden ripgrep-cli, zip-extractor, binary-downloader subprocess paths
Same Web-Response-on-Node hazard existed in ripgrep auto-download flow,
zip extraction helpers, and binary downloader streams. Switch to the new
Node-safe reader and ensure no spawn path escapes as unhandledRejection.

Related to #3919.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-22 20:40:24 +09:00
YeonGyu-Kim d17b2127f2 fix(tools/grep, tools/glob): use Node-safe subprocess streaming (#3919)
OpenCode Desktop v1.14.41+ runs OMO inside a Node.js utility process.
The previous `new Response(proc.stdout).text()` call is Bun-/Web-API-specific
and crashed the Desktop sidecar on Windows when grep/glob were invoked.

Switch glob/grep cli to the new process-stream-reader + search-process-output
helpers. Behavior on Bun and CLI/Linux/macOS is unchanged. ripgrep auto-download,
PowerShell fallback, and rgSemaphore are preserved.

Fixes #3919

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-22 20:40:06 +09:00
YeonGyu-Kim 4ea7562f50 feat(shared): add Node-safe process stream reader and search output collector
Introduces:
- src/shared/process-stream-reader.ts: Buffer-concat stream reader compatible with both Bun and Node ChildProcess stdout (replaces Web Response API usage)
- src/tools/shared/search-process-output.ts: structured subprocess output collector with timeout, kill, and rejection cleanup
- bun-spawn-shim hardened: Node path forces windowsHide: true; spawn errors no longer escape as unhandledRejection

Foundation for #3919 fix.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-22 20:39:52 +09:00
YeonGyu-Kim bc8c462d28 fix(session-notification-sender): guard ctx.$ with execFile fallback for Desktop sidecar (#4128, #4061)
OpenCode Desktop's Electron sidecar runtime can omit Bun's ctx.$ helper.
The sender previously called ctx.$ unconditionally, throwing
TypeError: ctx.$ is not a function as unhandledRejection and crashing
the sidecar with exit code 1.

Add a runtime guard at every call site, falling back to Node.js
child_process.execFile (with windowsHide: true) when ctx.$ is missing.
The Bun ctx.$ path remains preferred when available. Every notification
path is wrapped in try/catch so no failure escapes as unhandledRejection.

Fixes #4128
Fixes #4061
2026-05-22 20:39:33 +09:00
github-actions[bot] b31ad3c892 @csxq0605 has signed the CLA in code-yeongyu/oh-my-openagent#4298 2026-05-22 10:23:40 +00: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
github-actions[bot] cb205e1479 @SpencerJung has signed the CLA in code-yeongyu/oh-my-openagent#4247 2026-05-22 04:23:24 +00:00
github-actions[bot] 16993291b4 @YOMXXX has signed the CLA in code-yeongyu/oh-my-openagent#4263 2026-05-22 03:51:49 +00:00
github-actions[bot] 0904e2378e @wolfkill has signed the CLA in code-yeongyu/oh-my-openagent#4261 2026-05-22 03:00:03 +00:00
YeonGyu-Kim 00d814ee0e chore: update bun.lock 2026-05-22 00:43:38 +09:00
github-actions[bot] 4e0dc7fa7b release: v4.3.0 2026-05-21 15:19:33 +00:00
YeonGyu-Kim abeb555c03 chore: regenerate config schema after default_mode/i18n/disabled_providers additions 2026-05-22 00:07:46 +09:00
YeonGyu-Kim f313eb1adf docs: add [Unreleased] section and #4225 known issue
CHANGELOG.md:
- Remove the stale [4.2.1] - Unreleased section (4.2.1 has shipped).
- Add [Unreleased] (next-minor or 4.3.0) covering all 240 unpublished
  commits, grouped by user impact rather than commit type.
  - Added: default_mode, i18n en/zh, disabled_providers,
    plan-format-validator, Prometheus spec-driven mode, per-agent skill
    filtering, look_at async, keyword-detector.enabled_expansions,
    tui-plugin doctor check, taskCleanupDelayMs, agent displayName i18n,
    Grok reasoningEffort, CLI setup alias.
  - Changed: 8-package layering refactor, model-core DI,
    prompt-async-gate modularization, additive OpenCode config dir,
    delegate_task defaults.
  - Fixed: background-agent stability, team-mode hardening, runtime
    fallback, Windows/WSL/MSYS2, tmux-subagent, skill-mcp survival,
    slash-command dedup, hyperplan .hpp false positive, todo
    continuation loop, tool.definition wiring, model parser guards,
    mcp_ prefix strip, prompt-shield XML tag, glob/grep symlink
    tolerance, chat-message cache refresh, skill short names, process
    cleanup.
  - Fixed in this release gate: the pre-publish review findings -
    notepad-guard wire+.omo, i18n init wire, start-work .omo affinity,
    default_mode ultrawork+ralph priority, multimodal-looker prompt
    alignment, delegate-task per-agent skill enforcement, model-core
    server_error pattern restore.
- Update footer comparison links: [Unreleased] points at v4.2.3...HEAD,
  [4.2.3] corrected to v4.2.2...v4.2.3.

docs/reference/known-issues.md:
- Add #4225: custom LSP config in .opencode/oh-my-openagent.jsonc is
  silently ignored after the LSP->MCP migration. Captures symptom,
  workaround, and the upstream tracking issue.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim 11c3da752c fix(default-mode,multimodal-looker,delegate-task): preserve user-expected behavior
default-mode (system-transform):
- e5463e2db introduced auto-activation of ultrawork+ralph-loop, and
  dc2e082ac then skipped the ultrawork system prompt whenever ralph_loop
  was also enabled. Net effect: the keyword-detector still showed
  'Default ultrawork mode enabled' to the user, but the first turn had
  none of the ultrawork behavior. Loop continuation kept the ultrawork
  prefix, so the contract was honored only on later iterations.
- Drop the skip so the initial turn matches what the toast advertises.
  New matrix test pins all four (ultrawork, ralph_loop) combinations.

multimodal-looker:
- Prompt claimed 'read' and 'call_omo_agent' were available, but the
  look_at invocation runtime explicitly disables both via READ_ENABLED
  and createAgentToolAllowlist([]). Small VL models trusted the prompt
  and looped on rejected tool calls (#4116).
- Rewrite the agent prompt to describe direct-attachment analysis and
  forbid tool/agent calls. Add a consistency test that extracts the
  prompt's 'available tools' claim and compares it against the
  configured allowlist.

delegate-task (skill-resolver):
- 088693697 filtered per-agent restricted skills at the skill tool and
  builtin agent prompt layers, but delegate-task itself happily injected
  whatever skill name a caller passed. A target agent could be force-fed
  a skill marked agent: oracle just by listing it in load_skills.
- Thread the target agent through resolveSkills and silently filter
  skills whose definition.agent does not include it. Public skills with
  no restriction are unaffected. Regression test pins the bypass.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim 7cce0ad230 fix(notepad-guard,start-work): wire dispatch and match .omo paths
notepad-write-guard:
- The hook was created by create-tool-guard-hooks but tool-execute-before
  never invoked it, so the guard was inert.
- It also only matched .sisyphus/notepads, missing the current
  .omo/notepads layout introduced by the workspace migration.
- Add the dispatch call alongside writeExistingFileGuard, and extend
  NOTEPAD_ROOTS to cover both paths via normalize() + sep. New
  integration test pins the wire and the .omo block; the existing unit
  test now asserts both paths.

start-work session-plan-affinity:
- PLAN_PATH_PATTERN only matched .sisyphus/plans, so sessions referring
  to plans under .omo/plans returned null and start-work missed the
  current session's own plan.
- Extend the regex to .(sisyphus|omo)/plans and add findPrometheusPlans
  in packages/boulder-state to scan both directories during the
  transition. New regression test pins .omo/plans matching; legacy
  .sisyphus/plans coverage preserved.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim 3f44b45fa2 feat(i18n): wire initI18n into production plugin startup
6ffea1bc3 added i18n with en/zh locales and plugin config support, but
the initI18n() call lived in the original src/index.ts. When src/index.ts
became an 18-line wrapper that delegates to
src/testing/create-plugin-module.ts createPluginModule(), the call site
was dropped on the floor. Result: i18n.locale config and LANG env both
ignored at runtime, every toast stayed English regardless of user
setting.

Inject initI18n as a managed dependency and call it in
createPluginModule() immediately after loadPluginConfig(), passing
pluginConfig.i18n?.locale through. Add an integration test that boots
the plugin with i18n.locale='zh' and asserts getLocale() returns 'zh'
and t('toast.task_completed') returns the Chinese string. Regression
locked - subsequent moves of the startup path will fail loudly.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim 2e2e33cfc0 test: fix stale imports after prompt-async-gate and model-core refactors
- prompt-async-gate.test.ts: refactor ced36bffc removed
  promptAsyncAfterSessionIdle in favor of the unified
  dispatchInternalPrompt({ mode: 'async', ... }). One call site at
  line 1441 was left behind. Replace it with the current API and pass
  the explicit dispatchTimeoutMs so the status-timeout semantics are
  preserved. Also switch the surrounding tests to the third-argument
  timeout form so Bun's typings stay happy.
- runtime-model-readers.test.ts: implementation moved to
  packages/model-core during the layering refactor; the orphaned test
  still pointed at './runtime-model-readers'. Switch to the package
  export via getModelCapabilities and keep the modality-reader
  coverage by deriving keys through the package API.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim 9c9e9885fe fix(model-core): restore OpenAI server_error retryable patterns (regression from package extraction)
c85d2f9bc added 'server_error' and 'an error occurred while processing'
to the retryable message patterns to fix #3799 - the OpenAI streaming
server_error case where runtime fallback never fired. The package
layering refactor (2748009ff) moved model-error-classifier into
packages/model-core but dropped these two patterns during the move.

Restore both patterns at the matching position. packages/model-core
tests now pass on the server_error retryable assertion, and runtime
fallback once again retries the OpenAI streaming server_error envelope.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim 9624914c25 test(disabled-providers): drop logger mock to fix global mock-module leakage
mock.restore() in afterAll is global in Bun, so the previous attempt to
satisfy mock-module-lifecycle-audit by pairing mock.module('./logger')
with afterAll(() => mock.restore()) tore down mocks owned by other
tests. Concretely, running this file before src/hooks/runtime-fallback
produced 42 cascading fallback test failures.

The logger mock was decorative - tests do not assert log calls, and the
real logger only writes to oh-my-opencode.log in the OS temp dir. Drop
the mock entirely so the audit has nothing to score and other tests
keep their mocks intact.
2026-05-22 00:07:46 +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
github-actions[bot] beed9e8906 @shipped-it has signed the CLA in code-yeongyu/oh-my-openagent#4253 2026-05-21 13:08:43 +00:00
YeonGyu-Kim f1bf61efb9 fix: resolve duplicate ANALYZE_MESSAGE/ANALYZE_PATTERN identifiers in keyword-detector constants 2026-05-21 17:26:19 +09:00
YeonGyu-Kim 2884ec9ff9 chore: regenerate config schema
bun run build:schema brings assets/oh-my-opencode.schema.json back in sync with the Zod source. Surfaces two fields that were already present in src/config/schema/ but missing from the published artifact:

- disabled_providers at the top level (from feat/config-disabled-providers)
- displayName on every agent override (from fix/schema-preserve-custom-agent-overrides)

No Zod source changes; only the generated artifact moves.
2026-05-21 16:19:38 +09:00
YeonGyu-Kim 8a5811bf84 chore(comment-checker): drop dead apply-patch-edits re-export shim
src/hooks/comment-checker/apply-patch-edits.ts was already a pure re-export over @oh-my-opencode/comment-checker-core after the core extraction landed. Every importer now reaches into the package directly, so the shim has no remaining call sites and can be removed.

Verified: rg "comment-checker/apply-patch-edits" src/ packages/ returns no matches.
2026-05-21 16:19:38 +09:00
YeonGyu-Kim 7c66aae0b8 refactor(rules-engine): centralize rule constants and AGENTS.md walk-up
Promote the project-rule constants (PROJECT_MARKERS, PROJECT_RULE_SUBDIRS, PROJECT_RULE_FILES, OPENCODE_USER_RULE_DIRS, USER_RULE_DIR, GITHUB_INSTRUCTIONS_PATTERN, RULE_EXTENSIONS, AGENTS_FILENAME, etc.) and the findAgentsMdUp walk-up helper out of the agents-md-core and rules-injector adapters and into @oh-my-opencode/rules-engine, the single owner of rule discovery.

- packages/agents-md-core/ drops the findAgentsMdUp/AgentsMdDiscoveryInput wrappers (now sourced directly from rules-engine) and its constants module re-exports AGENTS_FILENAME from rules-engine instead of duplicating it.
- src/hooks/directory-agents-injector/finder.ts pulls findAgentsMdUp from rules-engine directly while still re-exporting resolveFilePath from agents-md-core.
- src/hooks/rules-injector/constants.ts becomes a pure re-export shim over the rules-engine constants.

Add packages/agents-md-core/src/injector.test.ts to lock the root-skipping AGENTS.md injection order so future changes to findAgentsMdUp cannot silently regress the [Directory Context: ...] block format the injector emits.

Tests: bun test packages/agents-md-core packages/rules-engine src/hooks/directory-agents-injector src/hooks/rules-injector
2026-05-21 16:19:38 +09:00
YeonGyu-Kim edaa95fec0 refactor(model-core): host snapshot fetcher, suggestion parser, and context-limit resolver
Move three pure helpers from src/shared/ into @oh-my-opencode/model-core so the package can stand alone without depending on plugin internals:

- buildModelCapabilitiesSnapshotFromModelsDev + fetchModelCapabilitiesSnapshot (models.dev normalization)
- parseModelSuggestion (cross-provider ProviderModelNotFoundError suggestion extraction)
- resolveActualContextLimit (Anthropic GA 1M context override)

Split provider-model-id-transform into two variants exposed by model-core:

- transformModelForProvider keeps the runtime dash to dot Anthropic rewrite used by the SDK
- transformModelForProviderDisplay preserves hyphenated Anthropic IDs so the installer writes registry-compatible model strings, fixing the ProviderModelNotFoundError fresh installs hit when the dotted form leaks into the config

src/shared/* and src/cli/provider-model-id-transform.ts collapse to re-export shims that point at the new core modules. Stale src/shared/{known-variants,model-capability-aliases,model-capability-guardrails,model-capability-heuristics}.ts re-export files plus the duplicated context-limit-resolver test are removed in favor of the canonical model-core copies.

Tests: bun test packages/model-core src/shared/model-capabilities-cache.test.ts src/cli/provider-model-id-transform.test.ts
2026-05-21 16:19:38 +09:00
YeonGyu-Kim 4ea76365cd refactor(packages): extract hashline-core package
Move the hash-anchored edit core (hash computation, validation, edit operations, text normalization, chunk formatter, diff utilities, and a runtime-aware xxHash32 binding) into a new @oh-my-opencode/hashline-core workspace package.

The src/tools/hashline-edit/ surface becomes a set of thin re-export shims, so existing import paths in the plugin keep working while the pure logic lives behind a stable package boundary that has no opencode runtime dependencies.

Tests: bun test packages/hashline-core src/tools/hashline-edit
2026-05-21 16:19:38 +09:00
YeonGyu-Kim f29411a689 Merge pull request #4235 from code-yeongyu/fix/subagent-timeout-active-output
fix(background-agent): track active subagent output
2026-05-21 16:15:53 +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 53cabfe44d Merge pull request #3035 from code-yeongyu/fix/issue-2697-v2
fix: strip mcp_ prefix from tool names before dispatch
2026-05-21 15:26:49 +09:00
YeonGyu-Kim 90c38d16b4 Merge remote-tracking branch 'origin/dev' into fix/subagent-timeout-active-output 2026-05-21 15:23:59 +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 a562d5367f fix: strip mcp_ prefix from tool names before dispatch
The model emits tool names like mcp_background_output but the runtime
registry has them as background_output. While transformToolName already
handles the prefix for display purposes, the tool dispatch path in
tool-execute-before was not stripping it, causing 'unavailable tool' errors.

This adds mcp_ prefix stripping at the earliest point in the tool
execution pipeline, fixing background_output, background_cancel, and
all nocturne-memory_* tools.

Closes #2697
2026-05-21 15:23:28 +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 6c0252fae4 Merge pull request #3742 from mrosnerr/fix/schema-preserve-custom-agent-overrides
fix(schema): preserve custom agent overrides
2026-05-21 15:14:04 +09:00
YeonGyu-Kim 6e1e01ebe0 Merge pull request #4219 from sjawhar/fix/skill-discovery-opencode-config
fix(skill-discovery): load native OpenCode skills in task delegation
2026-05-21 15:07:39 +09:00
YeonGyu-Kim baa07dc912 Merge pull request #4232 from MoerAI/fix/hyperplan-hpp-file-extension
fix(keyword-detector): stop hyperplan firing on '.hpp' C++ header paths (fixes #4215)
2026-05-21 14:56:32 +09:00
MoerAI 61b812ffa9 fix(keyword-detector): stop hyperplan firing on '.hpp' C++ header paths (fixes #4215)
The hyperplan trigger \b(hyperplan|hpp)\b/i matched 'hpp' inside common C++ header references like 'check interface.hpp' or 'open buffer.hpp'. The leading '.' is a non-word character, so \b is already satisfied and the false positive fires the hyperplan-mode prompt on routine code questions.

Split the alternation so 'hpp' additionally requires that the preceding character is neither a word character nor a '.'. This preserves every existing trigger ('hpp do this', '/hpp ...', mid-sentence usage, mixed case) while rejecting filename uses of the .hpp extension. The longer 'hyperplan' keyword keeps the original \b boundary semantics.

Reproduction (added regression tests):
- 'please help to check interface.hpp' must NOT fire
- 'open src/include/audio/buffer.hpp and fix the leak' must NOT fire

All 14 cases in hyperplan.test.ts pass (12 existing + 2 new), broader keyword-detector suite stays green (92 pass), typecheck clean.
2026-05-21 13:39:34 +09:00
YeonGyu-Kim 94d6d5b495 Merge pull request #4231 from code-yeongyu/fix/post-4228-test-and-session-gone
Fix post-4228 test and session-gone follow-ups
2026-05-21 13:18:10 +09:00
YeonGyu-Kim 0feb125079 fix(background-agent): preserve missed polls on lookup errors 2026-05-21 13:13:14 +09:00
YeonGyu-Kim 98d475f95e test(agent): align remapper fallback display name 2026-05-21 13:12:57 +09:00
YeonGyu-Kim 7e8a61aed8 Merge pull request #2307 from SwiggitySwerve/feat/prometheus-spec-awareness
feat(prometheus): add spec-driven development framework awareness
2026-05-21 13:07:33 +09:00