Skip to content

agentctl peek returns 'Session not found' for sessions that status and list -a both show as running #173

Open

Description

@doink-kindo

Summary

agentctl peek <id> returns Session not found: <id> even when agentctl status <id> and agentctl list -a both show the session as running.

This forces operators to read ~/.agentctl/opencode-sessions/*.json, the wrapper script, and ~/.local/share/opencode/log/*.log directly to see what an agent is actually doing — which defeats the purpose of peek.

Reproduction (just observed live)

Session ID: 0a0c7e35 (opencode adapter, Kimi K2.6, mono worktree).

$ agentctl status 0a0c7e35
ID         0a0c7e35
Status     running
Adapter    opencode
Model      ohm/moonshotai/Kimi-K2.6
CWD        ~/code/mono-auto-ENG-9552
PID        39393
Started    1m ago

$ agentctl list -a | grep 0a0c7e35
0a0c7e35  running  opencode     ohm/moonshotai/Kimi-K2.6     ~/code/mono-auto-ENG-9552     39393  1m ago   EXECUTE THIS PROCEDURE...

$ agentctl peek 0a0c7e35 -n 5
Session not found: 0a0c7e35

Also reproduced on two earlier sessions today (9e261431, 13305318) — same pattern: status returned valid metadata, peek returned "Session not found".

Impact

  • Operators can't observe live agent progress through agentctl.
  • During incident response (e.g., agent stuck or hung), peek is the first-line tool — its failure forces filesystem spelunking.
  • New / very recent sessions seem most affected; possibly an indexing / DB write race between session registration (status/list) and the peek lookup path.

Hypothesis

peek may be resolving the session via a different code path (opencode session DB / sessions storage) than status and list (which read the agentctl session JSON files). If peek looks the session up in ~/.local/share/opencode/storage/ or sessions.db it could miss before opencode flushes session state — and on short-lived sessions that exit before the flush, peek would never find them.

Asks

  1. Make peek resolve sessions through the same source-of-truth that status / list use, OR fall back to that source when its primary source misses.
  2. When peek can't find live output, surface the wrapper / opencode log path so operators have a clear next step instead of "Session not found".

Workspace

ms's Mac Studio, agentctl from /Users/ms/.openclaw/scripts (or wherever gh-kindo agent which puts it). Repro happens during normal mono coding-agent launches.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions