Commit Graph

86 Commits

Author SHA1 Message Date
YeonGyu-Kim 1ea192b3f4 fix(background-task): retry transient missing output tasks
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-14 18:51:38 +09:00
YeonGyu-Kim 1e7a7600a2 docs(agents-md): regenerate hierarchical AGENTS.md knowledge base for v4.1.1
Refresh all AGENTS.md files to reflect codebase state at 5ffbe0e24 (was cd31d2a1a, 197 commits behind).

Key drift corrections across 45 modified + 1 new file:

Root AGENTS.md:
- TS file counts: 1967 -> 2034 in src/ (1337 source + 697 test)
- LOC: 278k -> 292k
- Barrel index.ts: 120 -> 122
- Hook tier composition: 52/59 -> 54/61 (base/with team-mode)
- Tool Guard hooks: 14 -> 16 (add fsync-skip-warning, bash-file-read-guard)
- Add boulder feature, agent-ordering schema, .agents/ directory, v4.1.1 release tag
- Add generated/ directory entry

src/AGENTS.md:
- Subsystem inventory: agents 96->102, hooks 570->581, tools 306->314,
  features 389->400, shared 258->278, cli 150->158, plugin 55->56
- LOC totals refreshed for every subsystem
- Schema files: 32 -> 30

src/hooks/AGENTS.md:
- Tier 2 (Tool Guard): 14 -> 16 hooks, add fsyncSkipWarning row
- Total: 52 base / 59 team-mode -> 54 base / 61 team-mode
- zauc-mocks count: 7 -> 5

src/features/AGENTS.md:
- background-agent: 47 -> 57 files, mention archive fallback
- opencode-skill-loader: 33 -> 30
- tmux-subagent: 34 -> 32

src/plugin/AGENTS.md:
- Tool Guard composer count: 14 -> 16
- Aggregator total: 43 -> 45

src/cli/AGENTS.md:
- Add new boulder subcommand (BoulderState inspector)
- Command count: 6 -> 7

NEW: src/features/boulder-state/AGENTS.md
- Document the new Boulder work tracking feature
- Schema v2 with BoulderState/BoulderWorkState/TaskSessionState
- Lifecycle, storage, integration points with atlas/ralph-loop hooks

All other AGENTS.md files: Generated date 2026-05-08 -> 2026-05-14.
2026-05-14 12:57:46 +09:00
YeonGyu-Kim d5fbada13d test: make unsafe test coercion explicit
Move test coercion out of a hidden global and require each test to import the helper so review tools and runtime scripts can see the unsafe boundary.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-12 15:51:31 +09:00
YeonGyu-Kim fb135d047c test(tools): remove unsafe test assertions
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-12 15:48:46 +09:00
YeonGyu-Kim 50699e3af1 fix(background-task): disambiguate background output task ids 2026-05-10 14:32:50 +09:00
YeonGyu-Kim 838b5ae216 docs(agents): refresh hierarchical AGENTS.md with team-mode coverage
Update root + 43 directory-level AGENTS.md files to reflect current state:
- Root AGENTS.md rewritten with accurate counts (1967 TS files, 1304 source +
  663 test, 278k LOC, 120 barrel index.ts), 7-step init flow, 5-tier hook
  composition, and full Team Mode section (12 team_* tools, eligibility,
  storage layout, config gate)
- src/AGENTS.md adds team-mode init step, current per-subdir file/LOC table
- src/tools/AGENTS.md documents conditional gates (team-mode +12, task
  system +4, hashline +1, interactive_bash +1, look_at +1) with always-on
  baseline of 20
- src/hooks/AGENTS.md splits into 5 tiers + 4 conditional team-mode hooks
- src/features/team-mode/AGENTS.md surfaces 12 tools, eligible agents,
  spawn-race-safe invariants, and integration points
- src/features/builtin-skills/AGENTS.md tracks 10 skills incl. team-mode
- src/agents/AGENTS.md, src/plugin/AGENTS.md, src/config/AGENTS.md updated
  for team-mode awareness, accurate counts, and current schema field list
- All other AGENTS.md files refreshed to 2026-05-08 generation date
2026-05-08 12:08:42 +09:00
YeonGyu-Kim 786b06518a test(background-task): mock notification shell chain
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-06 14:20:50 +09:00
YeonGyu-Kim da251c9b30 refactor(background-agent): normalize task ID field naming
Rename BackgroundTask and attempt ID fields to camelCase across background-agent consumers while moving BackgroundManager construction to a single config object.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-02 03:01:03 +09:00
Choi Kijin / 최 기진 / チョイ キジン 79054ea3e5 feat(background-task): render retry timelines and links
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-28 15:29:49 +09:00
YeonGyu-Kim 2892ca4adf fix(delegate-task): align metadata with opencode core task tool
Match opencode core 'task' tool behavior for metadata consistency:

1. Model fallback: When categoryModel/task.model/resumeModel is undefined,

   fall back to parentContext.model so subagent metadata always includes

   model info. Thread parentContext into executeSyncContinuation for parity.

2. Task ID consistency: unstable-agent-task was missing taskId and

   backgroundTaskId in metadata. background_output used inconsistent

   snake_case 'task_id' vs camelCase 'taskId' elsewhere. Standardize on

   camelCase: taskId = sessionID (resume id), backgroundTaskId = bg task id.

Update text output blocks to use buildTaskMetadataBlock helper.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-17 17:22:14 +09:00
YeonGyu-Kim d89e257d8a refactor(task): align continuation ids with task_id 2026-04-16 23:13:44 +09:00
YeonGyu-Kim c6a407c486 refactor(tools): migrate producers to shared metadata bridge
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-04-16 13:52:20 +09:00
YeonGyu-Kim 0c5cd3a1c4 chore(agents): update all AGENTS.md generation dates to 2026-04-11
🤖 Generated with OhMyOpenCode assistance
2026-04-11 22:33:22 +09:00
YeonGyu-Kim 137c2459f7 fix(prompt): prevent immediate BackgroundOutput polling after background task launch
Tool return values contained CTAs ("Use background_output to check") that
caused models to immediately poll instead of waiting for <system-reminder>
notifications. Unified all 5 tool return messages with explicit "Do NOT call
background_output now" guard, added pre-notification warning to BackgroundOutput
tool description, and strengthened Background Result Collection sections across
all 3 Sisyphus prompt variants (default, gpt-5-4, main) with BLOCKING
anti-pattern enforcement.

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-04-06 17:18:47 +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 56cf16c4c5 refactor(background-task): stop cancelling launched tasks during session wait 2026-03-31 15:11:05 -07:00
YeonGyu-Kim b2497f1327 fix: resolve 3 community-reported bugs (#2915, #2917, #2918)
- background_output: snapshot read cursor before consuming, restore on
  /undo message removal so re-reads return data (fixes #2915)
- MCP loader: preserve oauth field in transformMcpServer, add scope/
  projectPath filtering so local-scoped MCPs only load in matching
  directories (fixes #2917)
- runtime-fallback: add 'reached your usage limit' to retryable error
  patterns so quota exhaustion triggers model fallback (fixes #2918)

Verified: bun test (4606 pass / 0 fail), tsc --noEmit clean
2026-03-29 04:53:43 +09:00
YeonGyu-Kim e87075b9a4 fix(background-task): restore opt-in full session output
Bring background_output back to the legacy contract so callers only get full session transcripts when they explicitly ask for them.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-16 10:38:55 +09:00
YeonGyu-Kim f2a7d227cb fix: omit sessionId from metadata when not yet assigned (#2441) 2026-03-12 01:02:12 +09:00
YeonGyu-Kim f28ee0e21a fix(background-task): default background_output to full session 2026-03-11 18:17:49 +09:00
YeonGyu-Kim e4fd29ac8b fix: prevent agents from duplicating delegated subagent work
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-11 17:42:42 +09:00
YeonGyu-Kim 23dcd99c9a docs(agents): refresh generated AGENTS guides
🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-06 17:59:05 +09:00
ismeth 389625cb20 Update constants.ts 2026-03-05 11:41:39 +01:00
ismeth e916d564a9 fix(background-task): clarify timeout unit is milliseconds in description 2026-03-05 09:05:29 +01:00
YeonGyu-Kim 33d39597ae docs(agents): regenerate AGENTS.md hierarchy with updated metrics and model configs
- 1208→1243 TS files (+35), 143k→155k LOC (+12k)
- Update all agent models: Sisyphus, Hephaestus, Oracle, Librarian, Atlas, Metis, Momus
- Add 6 new hook directories (39→45 dirs): beast-mode-system, hashline-edit-diff-enhancer, anthropic-image-context, task-reminder, compaction-todo-preserver, runtime-fallback
- Update category models: visual-engineering/artistry gemini-3-pro→gemini-3.1-pro
- Add 2 config schema files: fallback-models.ts, runtime-fallback.ts
- Timestamp: 2026-03-02 | Commit: 1c2caa09

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-03-02 23:40:38 +09:00
YeonGyu-Kim 685b8023dd fix(background-task): make background_output block=true actually wait for task completion
Closes #2115
2026-02-26 20:55:11 +09:00
YeonGyu-Kim 73453a7191 docs(agents): update hook counts 44→46, add hashline-edit documentation
- Update root AGENTS.md: hook count 44→46, commit fcb90d92, generated 2026-02-24
- Update src/AGENTS.md: core hooks 35→37, session hooks 21→23
- Update src/hooks/AGENTS.md: 46 hooks total, add modelFallback/noSisyphusGpt/noHephaestusNonGpt/runtimeFallback, jsonErrorRecovery moved to tool-guard (tier 2)
- Create src/tools/hashline-edit/AGENTS.md (93 lines): documents three-op model, LINE#ID format, execution pipeline
- Refresh timestamps: 2026-02-21→2026-02-24 on 28 files
- Update plugin/AGENTS.md hook composition counts

🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-02-25 00:02:05 +09:00
YeonGyu-Kim e11c217d15 fix(tools/background-task): respect block=true even when full_session=true
Move blocking/polling logic before full_session branch so that
block=true waits for task completion regardless of output format.

🤖 Generated with assistance of oh-my-opencode
2026-02-24 03:52:20 +09:00
YeonGyu-Kim 66aebb1b59 fix: resolve ultrabrain review findings
- Remove runtime-fallback gate from session.status retry handler — runtime-fallback
  has no session.status handler, so gating it causes retry signals to be silently dropped
- Fix background_output full_session arg description: default is true, not false
2026-02-21 16:40:15 +09:00
YeonGyu-Kim fe415319e5 fix: resolve publish blockers for v3.7.4→v3.8.0 release
- Fix #1991 crash: optional chaining for task-history sessionID access
- Fix #1992 think-mode: add antigravity entries to HIGH_VARIANT_MAP
- Fix #1949 Copilot premium misattribution: use createInternalAgentTextPart
- Fix #1982 load_skills: pass directory to discoverSkills for project-level skills
- Fix command priority: sort scopePriority before .find(), project-first return
- Fix Google provider transform: apply in userFallbackModels path
- Fix ralph-loop TUI: optional chaining for event handler
- Fix runtime-fallback: unify dual fallback engines, remove HTTP 400 from retry,
  fix pendingFallbackModel stuck state, add priority gate to skip model-fallback
  when runtime-fallback is active
- Fix Prometheus task system: exempt from todowrite/todoread deny
- Fix background_output: default full_session to true
- Remove orphan hooks: hashline-edit-diff-enhancer (redundant with hashline_edit
  built-in diff), task-reminder (dead code)
- Remove orphan config entries: 3 stale hook names from Zod schema
- Fix disabled_hooks schema: accept arbitrary strings for forward compatibility
- Register json-error-recovery hook in tool-guard pipeline
- Add disabled_hooks gating for question-label-truncator, task-resume-info,
  claude-code-hooks
- Update test expectations to match new behavior
2026-02-21 16:24:18 +09:00
YeonGyu-Kim b1eccf7425 docs: update all 31 AGENTS.md files with current project state 2026-02-21 04:38:18 +09:00
Ze-Xuan Liu d556937c8e fix(background-output): stop defaulting full_session=true for running tasks
background_output auto-enabled full_session when the task was still
running, returning the entire session transcript on every poll. When
the parent agent had no other work and polled in a tight loop, this
caused massive token waste because each response dumped thousands of
tokens into the conversation history.

Default full_session to false so running-task checks return a compact
status table (~200 tokens). Callers can still pass full_session=true
explicitly when they need the full transcript.
2026-02-19 19:30:45 -06:00
YeonGyu-Kim a28e989f83 docs: add module-level AGENTS.md for mcp-oauth, atlas, rules-injector, background-task, call-omo-agent, lsp
🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
2026-02-19 10:46:40 +09:00
YeonGyu-Kim d3b79064c6 refactor: remove orphaned modules/ directory from background-task 2026-02-17 14:08:30 +09:00
YeonGyu-Kim bad63b9dd6 fix: force include_thinking and include_tool_results for running background tasks 2026-02-16 22:47:51 +09:00
YeonGyu-Kim e624f982ed feat: auto-enable full_session, thinking, and tool_results for running background tasks 2026-02-16 22:37:27 +09:00
YeonGyu-Kim 1ba330f8ca refactor: remove unused code from background-agent, background-task, call-omo-agent 2026-02-16 22:11:29 +09:00
YeonGyu-Kim cb601ddd77 fix: resolve category delegation and command routing with display name agent keys
Category-based delegation (task(category='quick')) was broken because
SISYPHUS_JUNIOR_AGENT sent 'sisyphus-junior' to session.prompt but
config.agent keys are now display names ('Sisyphus-Junior').

- Use getAgentDisplayName() for SISYPHUS_JUNIOR_AGENT constant
- Replace hardcoded 'sisyphus-junior' strings in tools.ts with constant
- Update background-output local constants to use display names
- Add remapCommandAgentFields() to translate command agent fields
- Add raw-key fallback in tool-config-handler agentByKey()
2026-02-16 21:32:33 +09:00
YeonGyu-Kim 8e0d1341b6 refactor: consolidate duplicated Promise.all dual reads into resolveMessageContext utility 2026-02-16 18:20:27 +09:00
YeonGyu-Kim 291a3edc71 feat: migrate tool callers to SDK message finders on SQLite backend 2026-02-16 16:13:40 +09:00
YeonGyu-Kim c9c02e0525 refactor(shared): consolidate 13+ getMessageDir copies into single shared function 2026-02-16 16:13:39 +09:00
YeonGyu-Kim 1199e2b839 fix(background): Wave 2 - fix interrupt status checks, display text, error recovery grace, LSP JSONC
- fix(background): include "interrupt" status in all terminal status checks (3 files)
- fix(background): display "INTERRUPTED" instead of "CANCELLED" for interrupted tasks
- fix(cli): add error recovery grace period in poll-for-completion
- fix(lsp): use JSONC parser for config loading to support comments

All changes verified with tests and typecheck.
2026-02-10 22:00:54 +09:00
YeonGyu-Kim 498fda11a0 feat(background-agent): handle "interrupt" in notifications, output, and formatting
Update notification systems to display INTERRUPTED status.

Add interrupt handling to background_output tool (terminal status).

Add interrupt-specific status note to formatTaskStatus.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-09 18:26:16 +09:00
YeonGyu-Kim f67a4df07e fix: integrate dev background_output task_id title resolution 2026-02-08 21:24:08 +09:00
YeonGyu-Kim 46a30cd7ec Merge remote-tracking branch 'origin/dev' into refactor/modular-code-enforcement
# Conflicts:
#	src/agents/utils.ts
#	src/config/schema.ts
#	src/features/background-agent/spawner/background-session-creator.ts
#	src/features/background-agent/spawner/parent-directory-resolver.ts
#	src/features/background-agent/spawner/tmux-callback-invoker.ts
#	src/features/tmux-subagent/manager.ts
#	src/hooks/interactive-bash-session/index.ts
#	src/hooks/task-continuation-enforcer.test.ts
#	src/index.ts
#	src/plugin-handlers/config-handler.test.ts
#	src/tools/background-task/tools.ts
#	src/tools/call-omo-agent/tools.ts
#	src/tools/delegate-task/executor.ts
2026-02-08 19:05:41 +09:00
YeonGyu-Kim 23bca2b4d5 feat(tools/background-task): resolve background_output task_id title 2026-02-08 17:54:59 +09:00
YeonGyu-Kim ee72c45552 refactor(tools/background-task): split tools.ts into focused modules under 200 LOC
- Create modules/ directory with 6 focused modules:
  - background-task.ts: task creation logic
  - background-output.ts: output retrieval logic
  - background-cancel.ts: cancellation logic
  - formatters.ts: message formatting utilities
  - message-processing.ts: message extraction utilities
  - utils.ts: shared utility functions
- Reduce tools.ts from ~798 to ~30 lines (barrel pattern)
- Add new types to types.ts for module interfaces
- Update index.ts for clean re-exports
- Follow modular code architecture (200 LOC limit)

🤖 Generated with assistance of OhMyOpenCode
2026-02-08 17:52:00 +09:00
YeonGyu-Kim 119e18c810 refactor: wave 2 - split atlas, auto-update-checker, session-recovery, todo-enforcer, background-task hooks
- Extract atlas/ into 15 focused modules (hook, event handler, tool policies, types, etc.)
- Split auto-update-checker into checker/ and hook/ subdirectories with single-purpose files
- Decompose session-recovery into separate recovery strategy files per error type
- Extract todo-continuation-enforcer from monolith to directory with dedicated modules
- Split background-task/tools.ts into individual tool creator files
- Extract command-executor, tmux-utils into focused sub-modules
- Split config/schema.ts into domain-specific schema files
- Decompose cli/config-manager.ts into focused modules
- Rollback skill-mcp-manager, model-availability, index.ts splits that broke tests
- Fix all import path depths for moved files (../../ -> ../../../)
- Add explicit type annotations to resolve TS7006 implicit any errors

Typecheck: 0 errors
Tests: 2359 pass, 5 fail (all pre-existing)
2026-02-08 15:01:42 +09:00
YeonGyu-Kim a691a3ac0a refactor: migrate delegate_task to task tool with metadata fixes
- Rename delegate_task tool to task across codebase (100 files)
- Update model references: claude-opus-4-6 → 4-5, gpt-5.3-codex → 5.2-codex
- Add tool-metadata-store to restore metadata overwritten by fromPlugin()
- Add session ID polling for BackgroundManager task sessions
- Await async ctx.metadata() calls in tool executors
- Add ses_ prefix guard to getMessageDir for performance
- Harden BackgroundManager with idle deferral and error handling
- Fix duplicate task key in sisyphus-junior test object literals
- Fix unawaited showOutputToUser in ast_grep_replace
- Fix background=true → run_in_background=true in ultrawork prompt
- Fix duplicate task/task references in docs and comments
2026-02-06 21:35:30 +09:00
YeonGyu-Kim 49c933961e fix(background-cancel): skip notification when user explicitly cancels tasks
- Add skipNotification option to cancelTask method
- Apply skipNotification to background_cancel tool
- Prevents unwanted notifications when user cancels via tool
2026-02-03 16:56:40 +09:00