Commit Graph

4590 Commits

Author SHA1 Message Date
YeonGyu-Kim 9199dd545f feat(atlas): enhance session-last-agent with timestamp-based ordering
- Sort messages by creation timestamp for accurate last agent detection
- Add fallback to filename sorting for deterministic ordering
- Add JSON backend test coverage
- Update SQLite backend tests for timestamp-aware sorting

🤖 Generated with assistance of OhMyOpenCode
2026-04-05 17:18:10 +09:00
YeonGyu-Kim ec49bd553f feat(boulder-state): add session_origins tracking for direct vs appended sessions
- Add session_origins field to BoulderState type
- Track direct vs appended session origins in storage layer
- Add migration logic for existing state files
- Add comprehensive tests for session origin tracking

🤖 Generated with assistance of OhMyOpenCode
2026-04-05 17:18:10 +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
github-actions[bot] 6e8fc1464a @lukecartledge has signed the CLA in code-yeongyu/oh-my-openagent#3140 2026-04-05 08:13:57 +00:00
YeonGyu-Kim ae3217369b fix(atlas): use raw agent key instead of display name for API calls (#3138) 2026-04-05 17:04:50 +09:00
YeonGyu-Kim 97ccbf1da3 test: add comprehensive tests for boulder lineage and completion
Add tests for descendant session detection, agent mismatch handling,
background task retry logic, and start-work functionality.

🤖 Generated with assistance of OhMyOpenCode
2026-04-05 15:34:22 +09:00
YeonGyu-Kim 91c1c32c13 feat(atlas): update boulder continuation injector with lineage support
Update continuation injector to work with new lineage detection.
Refine idle event handling for proper subagent session tracking
and agent mismatch detection.

🤖 Generated with assistance of OhMyOpenCode
2026-04-05 15:34:13 +09:00
YeonGyu-Kim 24ca704821 feat(run): implement boulder lineage detection in continuation state
Make getContinuationState async to support client-side lineage checks.
Add hasActiveBoulderContinuation with agent eligibility verification
and subagent session tracking for proper boulder session inheritance.

🤖 Generated with assistance of OhMyOpenCode
2026-04-05 15:34:02 +09:00
YeonGyu-Kim c708d4e526 feat(atlas): add isInjectingContinuation flag to SessionState
Add flag to track when continuation is being injected to prevent
race conditions in boulder session management.

🤖 Generated with assistance of OhMyOpenCode
2026-04-05 15:33:54 +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
YeonGyu-Kim ccfc54ab38 feat(atlas): add background task session tracking with retry scheduling
- Add background-launch-session-tracking.ts to persist delegated sessions
- Add task-context.ts for task context resolution utilities
- Modify idle-event.ts to schedule retries when background tasks are running
- Update tool-execute-after.ts to integrate session tracking
- Add comprehensive tests for background task retry behavior

🤖 Generated with assistance of OhMyOpenCode
2026-04-05 14:59:03 +09:00
YeonGyu-Kim 90407a9789 Merge pull request #3135 from jim80net/fix/agent-not-found-fallback
fix(background-agent): retry with fallback agent on Agent not found
2026-04-05 14:46:08 +09:00
github-actions[bot] f846b3a47b @andrescera has signed the CLA in code-yeongyu/oh-my-openagent#3136 2026-04-05 05:45:58 +00:00
YeonGyu-Kim cbc06385f9 Merge pull request #3134 from auyua9/fix/session-info-sqlite-sdk-auyua9
fix(session-manager): use sdk data in getSessionInfo
2026-04-05 14:39:58 +09:00
auyua9 0bb16e5149 fix(session-manager): use sdk data in getSessionInfo 2026-04-05 14:38:13 +09:00
Jim Park f8d086ded1 fix: remove overly broad agent+undefined error pattern
The (message.includes("agent") && message.includes("undefined"))
pattern could match unrelated errors like "The agent returned undefined
for the configuration", triggering a false fallback that hides the real
failure.

The two precise patterns are sufficient:
- "Agent not found" — canonical SDK validation error
- "agent.name" — property access error on undefined agent config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 22:31:22 -07:00
YeonGyu-Kim d7c2b6249b fix(config): fall back to legacy path when migration fails and use canonical basename everywhere (#3133)
Root cause: loadPluginConfig() unconditionally switched userConfigPath to the
canonical name after calling migrateLegacyConfigFile(), even when migration
failed (e.g. file lock on Windows, permission denied). This left the config
path pointing to a non-existent file, so the plugin config silently loaded
as empty defaults.

Additionally, several fallback/default paths were hardcoded to the legacy
'oh-my-opencode' basename instead of using CONFIG_BASENAME ('oh-my-openagent'),
causing CLI config commands (writeOmoConfig, detectCurrentConfig) to write to
the wrong filename.

Changes:
- plugin-config.ts: check migrateLegacyConfigFile() return value; only switch
  to canonical path if migration succeeded OR the canonical file already exists
- opencode-config-dir.ts: use CONFIG_BASENAME for omoConfig path in
  getOpenCodeConfigPaths()
- config-context.ts: getOmoConfigPath() now uses detectPluginConfigFile() to
  find whichever name variant actually exists on disk
- plugin-config.ts: default fallback paths use CONFIG_BASENAME instead of
  hardcoded legacy name
- Added test: loadPluginConfig still loads config when migration fails
  (read-only directory simulation)
2026-04-05 14:27:24 +09:00
Jim Park 51508c4949 fix: address cubic review — broaden error detection, add test coverage
1. isAgentNotFoundError now handles:
   - Plain objects with .message field (not just Error instances)
   - "agent.name"/"undefined" error variants from SDK validation
   - The original "Agent not found" format

2. New tests:
   - agent.name/undefined error variant triggers fallback
   - Plain object errors with .message field trigger fallback
   - "fallback also fails" test now verifies retry was attempted (callCount=2)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 22:17:22 -07:00
github-actions[bot] 2ae9a757fb @jim80net has signed the CLA in code-yeongyu/oh-my-openagent#3135 2026-04-05 05:16:14 +00:00
Jim Park 9470cbe090 fix: address systems review findings for agent-not-found fallback
1. [HIGH] Tool restrictions recomputed for fallback agent via
   buildFallbackBody() — no longer inherits original agent's restrictions.

2. [HIGH] Double-retry race prevented — handleSessionErrorEvent now
   returns early for agent-not-found errors, since the prompt catch
   block already handles them with agent fallback. This prevents
   tryFallbackRetry from racing with a model-level retry on the same
   error (the "not found" pattern in RETRYABLE_MESSAGE_PATTERNS).

3. [MEDIUM] task.agent updated to FALLBACK_AGENT after successful
   fallback — notifications, toast, and logging reflect actual agent.

4. [MEDIUM] FALLBACK_AGENT exported from spawner.ts and imported into
   manager.ts — single source of truth.

5. [LOW] resumeTask fallback now uses promptWithModelSuggestionRetry
   (consistent with startTask), getting timeout protection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 22:13:05 -07:00
YeonGyu-Kim 4b6dfc9077 docs(orchestration): fix deep category model GPT-5.3 Codex -> GPT-5.4 2026-04-05 14:12:31 +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 3697809c11 docs(hooks): update hook inventory to match current 52 hooks
- Session: 23 -> 24 (add legacyPluginToast)
- Tool Guard: 12 -> 14 (add bashFileReadGuard, readImageResizer,
  todoDescriptionOverride, webfetchRedirectGuard)
- Transform: 4 -> 5 (add toolPairValidator)
- Remove deleted dirs: anthropic-image-context, beast-mode-system
- Add new dirs: legacy-plugin-toast, todo-description-override,
  tool-pair-validator, webfetch-redirect-guard
2026-04-05 14:12:30 +09:00
YeonGyu-Kim 6d66659025 docs(src): update hook composition counts in src and plugin AGENTS.md
- Core hooks: 39 -> 43 (Session 24, ToolGuard 14, Transform 5)
- Total hooks: 48 -> 52
- Add transform hooks tier to plugin composition table
- Update session/tool-guard hook name lists
2026-04-05 14:12:30 +09:00
YeonGyu-Kim 8dd186f0be docs(AGENTS.md): update root project metadata to match codebase
- TS files: 1268 -> ~1602, LOC: 160k -> ~214k
- Hooks: 48 -> 52 (Session 24, Tool-Guard 14, Transform 5)
- Config schema: 24 -> 27 files, barrel exports: 98 -> 104
- Hook handlers: 8 -> 10 (add compacting handler)
- CI table: fix refresh-model-capabilities trigger description
- Conventions: add CI bun version, inline test comment style
2026-04-05 14:12:30 +09:00
Jim Park 050502f8d0 fix(background-agent): retry with fallback agent on Agent not found error
When a model/mode switch happens while a background task is in-flight,
the oh-my-openagent agent registry can be rebuilt without custom agents
(e.g., Sisyphus-Junior). The SDK then rejects the promptAsync call with
"Agent not found", killing the task.

This adds retry logic: when promptAsync fails with "Agent not found",
retry with the "general" agent (always available in opencode). The
original prompt, model, and skill content are preserved — only the
agent routing changes.

Fixes both the spawner (startTask/resumeTask) and manager (inline
launch) code paths. Also improves the error message detection in
manager.ts to recognize "Agent not found" alongside the existing
"agent.name"/"undefined" checks.

Related: #2052, #2875, #2882

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 21:57:37 -07:00
YeonGyu-Kim a8ab137ee9 fix(test): cache-bust mcp-server-loader import to prevent mock leak 2026-04-05 13:55:10 +09:00
YeonGyu-Kim 52150fb60b fix(test): use dynamic import in discovery tests to prevent mock.module leak from loader.test.ts
When run-ci-tests.ts groups the claude-code-plugin-loader directory,
loader.test.ts mocks ./discovery with name: 'demo'. This mock leaked
into discovery.test.ts because both ran in the same process.

Fix: dynamic import with cache-busting query string ensures each test
gets a fresh module instance, immune to sibling test mocks.
2026-04-05 13:51:26 +09:00
github-actions[bot] c9be5bb51b @auyua9 has signed the CLA in code-yeongyu/oh-my-openagent#3134 2026-04-05 04:44:57 +00:00
YeonGyu-Kim 33b17519e5 test(config-dir): align opencode config basename
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-05 13:42:37 +09:00
YeonGyu-Kim 67d05f54d0 fix(hephaestus): restore GPT-5.4 prompt test contract
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-05 13:42:37 +09:00
YeonGyu-Kim 709706378b test(plugin-loader): isolate discovery name derivation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-05 13:41:38 +09:00
YeonGyu-Kim 7243bfa483 fix(tool-registry): use interactive bash availability for tool registration
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-04-05 13:27:55 +09:00
YeonGyu-Kim 07ccbd2047 fix(event): respect tmux integration disabled state in event forwarding
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-04-05 13:27:50 +09:00
YeonGyu-Kim c9c7b75269 test(tmux): add create-managers test coverage
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-04-05 13:27:45 +09:00
YeonGyu-Kim 14bf48a6d7 fix(tmux): conditionally mark server running and add interactive bash helper
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-04-05 13:27:41 +09:00
YeonGyu-Kim 5d065da7a1 refactor(hephaestus): clarify tool call philosophy for direct tools vs agents
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-04-05 13:27:38 +09:00
YeonGyu-Kim a8450d6509 fix(test): prevent directory contamination in discovery tests
The discovery tests were failing in CI with "demo" plugin name instead
of expected names. The root cause was test directory structure:

**The Bug:**
Original test code created installPath as a subdirectory:
```typescript
const installPath = join(createTemporaryDirectory("omo-plugin-install-"), "oh-my-openagent")
```

This created: `/tmp/omo-plugin-install-XXXXXX/oh-my-openagent`

If another test created `/tmp/omo-plugin-install-YYYYYY/.claude-plugin/plugin.json`
with name "demo", and the test execution order caused the discovery test
to pick up the wrong temp directory, it would read the manifest with "demo".

**The Fix:**
Changed tests to use unique temp directories directly:
```typescript
const installPath = createTemporaryDirectory("omo-npm-plugin-")
```

This creates: `/tmp/omo-npm-plugin-XXXXXX`

Each test now has its own unique temp directory that cannot be contaminated
by other tests.

**Also included:**
- mock.module() for process isolation in CI runner
- pluginsHomeOverride parameter for plugins database isolation

Fixes CI failure on dev branch.
2026-04-05 11:45:43 +09:00
YeonGyu-Kim 4b0592c045 fix(test): isolate discovery tests using mock.module to force CI isolation
The discovery tests were failing in CI with "demo" plugin name instead of
expected names. This happened because:

1. The CI test runner (run-ci-tests.ts) groups tests by directory
2. Tests using mock.module() are run in isolated processes
3. Tests without mock.module run in a shared batch
4. Other tests in the shared batch were creating plugin state that
   contaminated the discovery tests

Fix adds mock.module() to discovery tests:
- Mocks the logger module to avoid noise
- Forces CI runner to run these tests in isolated process
- Prevents cross-test contamination

Combined with previous pluginsHomeOverride parameter fix, this ensures
tests are properly isolated both at the parameter level and process level.

Also removes debug logging that was added for troubleshooting.

Fixes CI failure on dev branch.
2026-04-05 11:40:01 +09:00
YeonGyu-Kim 23582ea9a5 fix(test): isolate discovery tests from global env var contamination
The discovery.test.ts was using process.env.CLAUDE_PLUGINS_HOME to set
the plugins directory, but this global state could be affected by other
tests running in parallel, causing flaky failures with errors like:
  Expected: "oh-my-openagent"
  Received: "demo"

Changes:
- Added pluginsHomeOverride option to PluginLoaderOptions type
- Modified discoverInstalledPlugins to accept optional pluginsHomeOverride
- Modified loadInstalledPlugins to accept optional pluginsBaseDir
- Updated all 3 discovery tests to use pluginsHomeOverride instead of
  relying on global process.env.CLAUDE_PLUGINS_HOME

This makes the tests properly isolated and deterministic regardless of
test execution order or parallelization.

Fixes CI failure on dev branch.
2026-04-05 11:34:32 +09:00
YeonGyu-Kim 3517017ee1 refactor(hephaestus): rewrite GPT-5.4 prompt with entropy-reduced XML architecture
🤖 Generated with assistance of OhMyOpenCode
2026-04-05 11:24:10 +09:00
YeonGyu-Kim 852859ed9c refactor(config-manager): remove legacy config path detection and migration logic
🤖 Generated with assistance of OhMyOpenCode
2026-04-05 11:24:10 +09:00
YeonGyu-Kim 98c2f92251 refactor: convert config path constants to getter functions for dynamic OPENCODE_CONFIG_DIR support
🤖 Generated with assistance of OhMyOpenCode
2026-04-05 11:24:10 +09:00
YeonGyu-Kim b14665f174 fix: cache plugin component loading results
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-05 11:24:10 +09:00
YeonGyu-Kim e67fcb95ba test: cover plugin component cache behavior
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-05 11:24:10 +09:00
YeonGyu-Kim f22935cb28 Config-manager: migrate legacy OMO config path 2026-04-05 11:24:10 +09:00
YeonGyu-Kim 0cbfdec76e fix(model): treat 'bad request' as retryable error for GitHub Copilot fallback (#3130)
GitHub Copilot performs rolling model updates which sometimes return
'400 Bad Request' when a model is temporarily unavailable. This error
was not in the retryable message patterns, causing model fallback to
not trigger and users getting stuck.

Changes:
- Added 'bad request' to RETRYABLE_MESSAGE_PATTERNS in model-error-classifier.ts
- Added test cases for 'bad request' pattern matching

Fixes #3130
2026-04-05 10:18:15 +09:00
github-actions[bot] 1562b7d148 release: v3.15.1 2026-04-05 00:54:58 +00:00
YeonGyu-Kim aff29a9856 chore: bump version to 3.15.1 2026-04-05 09:39:35 +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