Commit Graph

4123 Commits

Author SHA1 Message Date
MoerAI
5d5eb46f19 fix(delegate-task): honor user model override in category-resolver cold cache (fixes #2712) 2026-03-27 21:21:17 +09:00
YeonGyu-Kim
324dbb119c fix(#2791): await session.abort() in all subagent completion/cancel paths
Fire-and-forget session.abort() calls during subagent completion left
dangling promises that raced with parent session teardown. In Bun on
WSL2/Linux, this triggered a StringImplShape assertion (SIGABRT) as
WebKit GC collected string data still referenced by the inflight request.

Fix: await session.abort() in all four completion/error paths:
- startTask promptAsync error handler (launch path)
- resume promptAsync error handler (resume path)
- cancelTask (explicit cancel path)
- tryCompleteTask (normal completion path)

Also marks the two .catch() error callbacks as async so the await is
valid.

Test: update session.deleted cascade test to flush two microtask rounds
since cancelTask now awaits abort before cleanupPendingByParent.
2026-03-27 19:57:57 +09:00
YeonGyu-Kim
ab0b084199 Merge pull request #2884 from RaviTharuma/fix/runtime-fallback-hook-isolation
Verified: bun test src/plugin/event.test.ts src/hooks/runtime-fallback/index.test.ts -- 68/68 pass. tsc clean.
2026-03-27 19:10:06 +09:00
YeonGyu-Kim
f1f099fde9 fix(#2849): resolve platform binaries using current package name
The installer wrapper and postinstall script still hardcoded the old
oh-my-opencode-* platform package family. When users installed the renamed
npm package oh-my-openagent (for example via npx oh-my-openagent install on
WSL2/Linux), the main package installed correctly but the wrapper looked for
nonexistent optional binaries like oh-my-opencode-linux-x64.

Fix:
- derive packageBaseName from package.json at runtime in wrapper/postinstall
- thread packageBaseName through platform package candidate resolution
- keep legacy oh-my-opencode default as fallback
- add regression test for renamed package family
2026-03-27 18:29:36 +09:00
YeonGyu-Kim
6662205646 fix(#2748): pass browserProvider into skill() discovery
skill-context already filtered browser-related skills using the configured
browser provider, but the skill tool rebuilt discovery without forwarding
browserProvider. That caused skills like agent-browser to be prompt-visible
while skill() could still fail to resolve them unless browser_automation_engine.provider
was explicitly threaded through both paths.

Fix:
- pass skillContext.browserProvider from tool-registry into createSkillTool
- extend SkillLoadOptions with browserProvider
- forward browserProvider to getAllSkills()
- add regression tests for execution and description visibility
2026-03-27 17:58:38 +09:00
YeonGyu-Kim
76bf269b39 fix(#2754): include native PluginInput skills in skill() discovery
The skill tool previously only merged disk-discovered skills and preloaded
options.skills, so skills registered natively via ctx.skills (for example
from config.skills.paths or other plugins) were prompt-visible but not
discoverable by skill().

Fix:
- pass ctx.skills from tool-registry into createSkillTool
- extend SkillLoadOptions with nativeSkills accessor
- merge nativeSkills.all() results into getSkills()
- add test covering native PluginInput skill discovery
2026-03-27 17:42:43 +09:00
Ravi Tharuma
3e4b988860 fix: isolate event hook failures during dispatch 2026-03-27 09:30:43 +01:00
YeonGyu-Kim
d3dbb4976e fix(#2854): enable task system by default (oracle/subagent delegation)
task_system now defaults to true instead of false. Users on opencode-go
or other plans were unable to invoke oracle or use subagent delegation
because experimental.task_system defaulted off.

The task system is the primary mechanism for oracle, explore, and other
subagent invocations — it should not be behind an experimental flag.

Users can still explicitly set experimental.task_system: false to opt out.
2026-03-27 17:03:33 +09:00
YeonGyu-Kim
ec7a2e3eae fix(#2857): prevent npm scoped package paths from being resolved as skill paths
resolveSkillPathReferences: add looksLikeFilePath() guard that requires
a file extension or trailing slash before resolving @scope/package
references. npm packages like @mycom/my_mcp_tools@beta were incorrectly
being rewritten to absolute paths in skill templates.

2 new tests.
2026-03-27 16:59:04 +09:00
YeonGyu-Kim
c41e59e9ab fix(#2825): secondary agents no longer pruned after 30 min of total runtime
TTL (pruneStaleTasksAndNotifications) now resets on last activity:
- Uses task.progress.lastUpdate as TTL anchor for running tasks
  (was always using startedAt, causing 30-min hard deadline)
- Added taskTtlMs config option for user-adjustable TTL
- Error message shows actual TTL duration, not hardcoded '30 minutes'
- 3 new tests for the new behavior
2026-03-27 16:06:38 +09:00
YeonGyu-Kim
3b4420bc23 fix(#2735): check model availability before using custom subagent default model
subagent-resolver: when falling back to matchedAgent.model for custom
subagents, verify the model is actually available via fuzzyMatchModel
before setting it as categoryModel. Prevents delegate_task from using
an unavailable model when the user's custom agent config references
a model they don't have access to.

Test updated to include the target model in available models mock.
2026-03-27 15:50:16 +09:00
YeonGyu-Kim
3be26cb97f fix(#2732): enhance notification for failed/crashed subagent tasks
- completedTaskSummaries now includes status and error info
- notifyParentSession: noReply=false for failed tasks so parent reacts
- Batch notification distinguishes successful vs failed/cancelled tasks
- notification-template updated to show task errors
- task-poller: session-gone tests (85 new lines)
- CI: add Bun shim to PATH for legacy plugin migration tests
2026-03-27 15:48:07 +09:00
YeonGyu-Kim
e22e13cd29 fix(#2732): detect crashed subagent sessions with shorter timeout
When a subagent session disappears from the status registry (process
crashed), the main agent was waiting the full stale timeout before
acting. Fix:

- Add sessionGoneTimeoutMs config option (default 60s, vs 30min normal)
- task-poller: use shorter timeout when session is gone from status
- manager: verify session existence when gone, fail crashed tasks
  immediately with descriptive error
- Add legacy-plugin-toast hook for #2823 migration warnings
- Update schema with new config option
2026-03-27 15:43:01 +09:00
YeonGyu-Kim
6a733c9dde fix(#2823): auto-migrate legacy plugin name and warn users at startup
- logLegacyPluginStartupWarning now emits console.warn (visible to user,
  not just log file) when oh-my-opencode is detected in opencode.json
- Auto-migrates opencode.json plugin entry from oh-my-opencode to
  oh-my-openagent (with backup)
- plugin-config.ts: add console.warn when loading legacy config filename
- test: 10 tests covering migration, console output, edge cases
2026-03-27 15:40:04 +09:00
YeonGyu-Kim
127626a122 fix(#2822): properly cleanup tmux sessions on process shutdown
Two issues fixed:
1. process-cleanup.ts used fire-and-forget void Promise for shutdown
   handlers — now properly collects and awaits all cleanup promises
   via Promise.allSettled, with dedup guard to prevent double cleanup
2. TmuxSessionManager was never registered for process cleanup —
   now registered in create-managers.ts via registerManagerForCleanup

Also fixed setTimeout().unref() which could let the process exit
before cleanup completes.
2026-03-27 15:23:48 +09:00
YeonGyu-Kim
5765168af4 fix(#2731): skip unauthenticated providers when resolving subagent model
Background subagents (explore/librarian) failed with auth errors because
resolveModelForDelegateTask() always picked the first fallback entry when
availableModels was empty — often an unauthenticated provider like xai
or opencode-go.

Fix: when connectedProvidersCache is populated, iterate fallback chain
and pick the first entry whose provider is in the connected set.
Legacy behavior preserved when cache is null (not yet populated).

- model-selection.ts: use readConnectedProvidersCache to filter fallback chain
- test: 4 new tests for connected-provider-aware resolution
2026-03-27 14:38:02 +09:00
github-actions[bot]
e65a0ed10d @WhiteGiverMa has signed the CLA in code-yeongyu/oh-my-openagent#2877 2026-03-27 05:26:49 +00:00
YeonGyu-Kim
041770ff42 fix(#2736): prevent infinite compaction loop by setting cooldown before try
lastCompactionTime was only set on successful compaction. When compaction
failed (rate limit, timeout, etc.), no cooldown was recorded, causing
immediate retries in an infinite loop.

Fix: set lastCompactionTime before the try block so both success and
failure respect the cooldown window.

- test: add failed-compaction cooldown enforcement test
- test: fix timeout retry test to advance past cooldown
2026-03-27 14:25:38 +09:00
YeonGyu-Kim
7ce7a85768 fix(#2855): tmux health check fails across module instances in same process
The server-health module used module-level state for inProcessServerRunning,
which doesn't survive when Bun loads separate module instances in the same
process. Fix: use globalThis with Symbol.for key so the flag is truly
process-global.

- server-health.ts: replace module-level boolean with globalThis[Symbol.for()]
- export markServerRunningInProcess from tmux-utils barrel
- test: verify flag skips HTTP fetch, verify globalThis persistence
2026-03-27 14:17:06 +09:00
YeonGyu-Kim
19ab3b5656 fix(#2853): sync .sisyphus state from worktree to main repo before removal
When .sisyphus/ is gitignored, task state written during worktree execution
is lost when the worktree is removed. Fix:

- add worktree-sync.ts: syncSisyphusStateFromWorktree() copies .sisyphus/
  contents from worktree to main repo directory
- update start-work.ts template: documents the sync step as CRITICAL when
  worktree_path is set in boulder.json
- update work-with-pr/SKILL.md: adds explicit sync step before worktree removal
- export from boulder-state index
- test: 5 scenarios covering no-.sisyphus, nested dirs, overwrite stale state
2026-03-27 14:11:45 +09:00
YeonGyu-Kim
670d8ab175 fix(#2852): forward model overrides from categories/agent config to subagents
- fix(switcher): use lastIndexOf for multi-slash model IDs (e.g. aws/anthropic/claude-sonnet-4)
- fix(model-resolution): same lastIndexOf fix in doctor parseProviderModel
- fix(call-omo-agent): resolve model from agent config and forward to both
  background and sync executors via DelegatedModelConfig
- fix(subagent-resolver): inherit category model/variant when agent uses
  category reference without explicit model override
- test: add model override forwarding tests for call-omo-agent
- test: add multi-slash model ID test for switcher
2026-03-27 13:59:06 +09:00
YeonGyu-Kim
40a92138ea fix: resolve three open bugs (#2836, #2858, #2873)
- fix(context-limit): check modelContextLimitsCache for all Anthropic
  models, not just GA-model set; user config/cache wins over 200K default
  (fixes #2836)

- fix(agent-key-remapper): preserve config key aliases alongside display
  names so `opencode run --agent sisyphus` resolves correctly
  (fixes #2858)

- fix(tool-config): respect host permission.skill=deny by disabling
  skill/skill_mcp tools when host denies them (fixes #2873)

- test: update context-limit and agent-key-remapper tests to match new
  behavior
2026-03-27 13:32:18 +09:00
YeonGyu-Kim
a081ddcefb docs: update documentation for v3.13.1 feature changes
- Document object-style fallback_models with per-model settings
- Add model-settings compatibility normalization docs
- Document file:// URI support for prompt and prompt_append
- Add deterministic core-agent order (Tab cycling) docs
- Update rename compatibility notes (legacy plugin warning)
- Document doctor legacy package name detection
- Add models.dev-backed capability cache documentation
- Update Hephaestus default to gpt-5.4 (medium)
- Correct MiniMax M2.7/M2.5 usage across all docs
- Update all agent/category provider chain tables
- Fix stale CLI install/doctor options to match source
- Add refresh-model-capabilities command to CLI reference

Co-authored-by: Sisyphus <sisyphus@oh-my-opencode>
2026-03-27 12:59:50 +09:00
YeonGyu-Kim
8f4554e115 fix(lsp): accept directory as alias for filePath in lsp_diagnostics
Models frequently hallucinate a 'directory' parameter alongside filePath,
causing hard failures. Instead of rejecting, accept directory as an alias
for filePath and gracefully handle when both are provided (prefer filePath).

This prevents the 'filePath and directory are mutually exclusive' error
that users hit when models pass both parameters.

Fixes model confusion with lsp_diagnostics tool parameters.
2026-03-27 12:59:50 +09:00
github-actions[bot]
07793f35a7 @Jholly2008 has signed the CLA in code-yeongyu/oh-my-openagent#2871 2026-03-27 03:37:37 +00:00
YeonGyu-Kim
8ca93c7a27 Merge pull request #2863 from MoerAI/fix/task-schema-mutual-exclusion
fix(delegate-task): reject when both category and subagent_type provided (fixes #2847)
2026-03-27 12:30:46 +09:00
YeonGyu-Kim
a1b4e97e74 Merge pull request #2856 from potb/fix/publish-version-commitback
fix(publish): restore version commit-back to dev after npm release
2026-03-27 12:30:34 +09:00
YeonGyu-Kim
47e7d4afbb Merge pull request #2861 from MoerAI/fix/category-config-params
fix(delegate-task): apply category config temperature/maxTokens/top_p to categoryModel (fixes #2831)
2026-03-27 12:30:31 +09:00
YeonGyu-Kim
6d3172adc9 Merge pull request #2862 from MoerAI/fix/empty-text-with-tool-calls
fix(recovery): detect empty text parts alongside tool calls in fixEmptyMessages (fixes #2830)
2026-03-27 12:30:29 +09:00
YeonGyu-Kim
65dc3e4a3b Merge pull request #2865 from LTS2/fix/2803-hook-task-examples-missing-load-skills
Fix missing load_skills parameter in hook-injected delegate_task examples
2026-03-27 12:30:26 +09:00
YeonGyu-Kim
587ee704e8 Merge pull request #2866 from LTS2/fix/2830-empty-message-recovery-with-tool-calls
Fix empty message recovery when tool calls coexist with empty text parts
2026-03-27 12:30:23 +09:00
YeonGyu-Kim
3bafa88204 Merge pull request #2867 from MoerAI/fix/openai-tool-limit
fix(tools): add max_tools config to cap registered tools for OpenAI compatibility (fixes #2848)
2026-03-27 12:30:21 +09:00
YeonGyu-Kim
f2496158e8 Merge pull request #2859 from RaviTharuma/docs/fallback-model-objects
docs(config): document object-style fallback_models
2026-03-27 12:25:07 +09:00
YeonGyu-Kim
a7ac2e7aba merge: resolve conflicts with dev docs update 2026-03-27 12:24:51 +09:00
YeonGyu-Kim
a2c7fed9d4 docs: comprehensive update for v3.14.0 features
- Document object-style fallback_models with per-model settings
- Add package rename compatibility layer docs (oh-my-opencode → oh-my-openagent)
- Update agent-model-matching with Hephaestus gpt-5.4 default
- Document MiniMax M2.5 → M2.7 upgrade across agents
- Add agent priority/order deterministic Tab cycling docs
- Document file:// URI support for agent prompt field
- Add doctor legacy package name warning docs
- Update CLI reference with new doctor checks
- Document model settings compatibility resolver
2026-03-27 12:20:40 +09:00
MoerAI
98572c8dac fix: guard fallback override to preserve category config params when fallback fields are undefined 2026-03-27 12:20:19 +09:00
MoerAI
8136679b1c test: update test to expect mutual exclusion error for category+subagent_type 2026-03-27 11:53:54 +09:00
MoerAI
82d89fd5fc fix(tools): add max_tools config to cap registered tools for OpenAI compatibility (fixes #2848) 2026-03-27 11:11:56 +09:00
ewjin
b1735d4004 fix: detect empty text parts in messages with tool calls during session recovery 2026-03-27 11:04:42 +09:00
ewjin
8bde294978 fix: add missing load_skills parameter to hook-injected delegate_task examples 2026-03-27 10:56:49 +09:00
MoerAI
a476e557c9 fix(delegate-task): reject when both category and subagent_type provided (fixes #2847) 2026-03-27 10:35:48 +09:00
MoerAI
404390efda fix(recovery): detect empty text parts alongside tool calls in fixEmptyMessages (fixes #2830) 2026-03-27 10:18:20 +09:00
MoerAI
944cf429a7 fix(delegate-task): apply category config temperature/maxTokens/top_p to categoryModel (fixes #2831) 2026-03-27 10:01:23 +09:00
Ravi Tharuma
241224f7ab docs(config): document object-style fallback_models 2026-03-26 18:55:22 +01:00
YeonGyu-Kim
1c9f4148d0 fix(publish-ci): sync mock-heavy test isolation with ci.yml
Apply the same mock.module() isolation fixes to publish.yml:
- Move shared and session-recovery mock-heavy tests to isolated section
- Use dynamic find + exclusion for remaining src/shared tests
- Include session-recovery tests in remaining batch

Ensures publish workflow has the same test config as main CI run.
v3.14.0
2026-03-27 00:56:55 +09:00
YeonGyu-Kim
8dd0191ea5 fix(ci): isolate mock-heavy shared tests to prevent cross-file contamination
Move 4 src/shared tests that use mock.module() to the isolated test section:
- model-capabilities.test.ts (mocks ./connected-providers-cache)
- log-legacy-plugin-startup-warning.test.ts (mocks ./legacy-plugin-warning)
- model-error-classifier.test.ts
- opencode-message-dir.test.ts

Also isolate recover-tool-result-missing.test.ts (mocks ./storage).

Use find + exclusion pattern in remaining tests to dynamically build the
src/shared file list without the isolated mock-heavy files.

Fixes 6 Linux CI failures caused by bun's mock.module() cache pollution
when running in parallel.
2026-03-27 00:08:27 +09:00
YeonGyu-Kim
9daaeedc50 fix(test): restore shared Bun mocks after suite cleanup
Prevent src/shared batch runs from leaking module mocks into later files, which was breaking Linux CI cache metadata and legacy plugin warning assertions.
2026-03-27 00:08:20 +09:00
YeonGyu-Kim
3e13a4cf57 fix(session-recovery): filter invalid prt_* part IDs from tool_use_id reconstruction
When recovering missing tool results, the session recovery hook was using
raw part.id (prt_* format) as tool_use_id when callID was absent, causing
ZodError validation failures from the API.

Added isValidToolUseID() guard that only accepts toolu_* and call_* prefixed
IDs, and normalizeMessagePart() that returns null for parts without valid
callIDs. Both the SQLite fallback and stored-parts paths now filter out
invalid entries before constructing tool_result payloads.

Includes 4 regression tests covering both valid/invalid callID paths for
both SQLite and stored-parts backends.
2026-03-26 20:48:33 +09:00
Peïo Thibault
fb837db90d fix(publish): restore version commit-back to dev after npm release 2026-03-26 12:44:27 +01:00
YeonGyu-Kim
8e65d6cf2c fix(test): make legacy-plugin-warning tests isolation-safe
Pass explicit config dir to checkForLegacyPluginEntry instead of relying
on XDG_CONFIG_HOME env var, which gets contaminated by parallel tests on
Linux CI. Also adds missing 'join' import.
2026-03-26 19:54:05 +09:00