Skip to content

fix: peek/status timeout on opencode sessions#100

Merged
c-h- merged 1 commit into
mainfrom
fix/opencode-peek-timeout
Mar 6, 2026
Merged

fix: peek/status timeout on opencode sessions#100
c-h- merged 1 commit into
mainfrom
fix/opencode-peek-timeout

Conversation

@c-h-
Copy link
Copy Markdown
Collaborator

@c-h- c-h- commented Mar 5, 2026

Summary

  • peek(): Only reads message parts for the last N assistant messages instead of all messages — avoids O(M*P) file reads for long sessions
  • status(): Uses lightweight PID check (persisted metadata + recency heuristic) instead of expensive getOpenCodePids() which runs ps aux + lsof per process
  • Daemon routing: session.peek now tries all adapters when session isn't tracked, instead of defaulting to claude-code

Fixes #97

Test plan

  • Existing 55 opencode adapter tests pass
  • New test: peek only reads parts for last N messages (50 messages, lines=3)
  • New test: status detects running session via persisted metadata without calling getPids
  • New test: status detects running session via recent update heuristic
  • Full suite: 449 tests pass, typecheck clean

🤖 Generated with Claude Code

@c-h- c-h- enabled auto-merge (squash) March 5, 2026 22:33
@c-h- c-h- force-pushed the fix/opencode-peek-timeout branch from e2a31e7 to 360ea3d Compare March 5, 2026 22:34
@c-h- c-h- force-pushed the fix/opencode-peek-timeout branch from 360ea3d to d4a1f57 Compare March 5, 2026 22:52
Three root causes:
1. peek() read message parts for ALL assistant messages before slicing
   to last N — O(M*P) file reads for long sessions. Now filters first.
2. status() called getOpenCodePids() which runs ps aux + lsof per
   process — extremely slow. Now uses lightweight check via persisted
   metadata + recency heuristic.
3. Daemon session.peek defaulted to claude-code adapter when session
   wasn't tracked, never trying opencode. Now tries all adapters.

Fixes #97

Co-Authored-By: Charlie Hulcher <charlie@kindo.ai>
@c-h- c-h- force-pushed the fix/opencode-peek-timeout branch from d4a1f57 to 1391ff3 Compare March 6, 2026 17:43
@c-h- c-h- merged commit 6d1be38 into main Mar 6, 2026
1 check passed
c-h- added a commit that referenced this pull request Mar 6, 2026
New features:
- feat: add --file flag to launch command (#95)

Bug fixes:
- fix: insert -- separator before positional prompt args (#106)
- fix: peek/status timeout on opencode sessions (#100)
- fix: use temp file for large prompts instead of CLI args (#101)

Performance:
- perf: use history.jsonl for Claude Code discover(), batch lsof calls (#96)

Co-Authored-By: Charlie Hulcher <charlie@kindo.ai>
@c-h- c-h- mentioned this pull request Mar 6, 2026
c-h- added a commit that referenced this pull request Mar 6, 2026
New features:
- feat: add --file flag to launch command (#95)

Bug fixes:
- fix: insert -- separator before positional prompt args (#106)
- fix: peek/status timeout on opencode sessions (#100)
- fix: use temp file for large prompts instead of CLI args (#101)

Performance:
- perf: use history.jsonl for Claude Code discover(), batch lsof calls (#96)

Co-authored-by: Doink (OpenClaw) <charlie+doink@kindo.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: agentctl peek/status times out on opencode sessions

1 participant