Studio does not emit the Stop event to Claude Code / Codex coding agents, so transcript-capture hooks never run

Author: ZhouWebbCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbug

Ekko Studio Version

v0.7.25

Agent Runtime and Version (if applicable)

Claude Code and Codex, running as coding agents inside the Ekko Studio container (sessions.source = 'coding_agent'). Exact agent versions are not surfaced by the UI. The OpenViking memory plugin (openviking-memory@openviking v0.6.2) is installed for Claude Code; it registers 7 hook events including Stop.

Bug Description

Ekko Studio never emits the Claude Code Stop lifecycle event to coding agents running inside the Studio container. Any hook bound to Stop therefore never executes, and session transcripts can never be captured by downstream systems.

SessionStart and UserPromptSubmit DO fire — evidenced by the downstream session being created — so the symptom is "session exists but message_count stays 0", which is easy to misdiagnose as a downstream bug.

Scope: coding agents only (agent = 'claude' / 'codex'). ekko-agent and hermes sessions are unaffected. The same hook works normally when Claude Code is run outside Studio.

Steps to Reproduce

  1. Open a session in Ekko Studio with Claude Code as the coding agent.
  2. Complete several turns of conversation.
  3. Inspect the downstream side (OpenViking at 127.0.0.1:1933 in this report):
    • a session cc-<uuid> exists → SessionStart fired
    • its message_count is 0 → Stop never fired
  4. Inspect the Studio side for the same time window: sessions.message_count = 6 → the transcript exists and is intact
  5. Take the Studio transcript, emit it as Claude Code JSONL ({"role":"user","content":"..."} per line), and pipe it to the hook's stdin: {"session_id":"<native_id>","transcript_path":"","cwd":"...", "hook_event_name":"Stop","stop_hook_active":false} The hook then works and the content is captured successfully.

Expected Behavior

Studio should emit the same lifecycle events to a containerized Claude Code / Codex that the Claude Code CLI emits when run natively — in particular Stop when a turn ends normally — so that Stop-bound hooks run.

Actual Behavior

No Stop event is emitted. Observed across every coding-agent session since the capture plugin was installed (2026-09-24).

Full capture state of all cc-* sessions in the downstream store:

session message_count commit extracted
cc-1d548ddc-… 0 1 0
cc-3236e4eb-… 0 1 0
cc-362b5d9b-… 0 1 0
cc-440d9549-… 0 1 0
cc-8e0e9b8a-… 0 1 0
cc-b0fa83e3-… 11 0 0
cc-c694efd8-… 0 1 0

Cumulative memories produced: 0. All cx-* (Codex) sessions are likewise empty.

Note: cc-b0fa83e3 is the single non-empty sample. Its commit_count is 0, inconsistent with the auto-commit sequence, so it does not contradict the pattern above.

Session correspondence is exact — sessions.agent_native_session_id maps 1:1 to cc-<uuid> / cx-<uuid>:

Studio session_id agent agent_native_session_id msgs
mumed3r3yo2kgj claude 8e0e9b8a-018e-41a3-af2e-e60db5a7c33e 6
mumedig0knflkm codex 01a0ec38-0ba9-7391-b21f-b4b3ab86a87a 10
mt2ml60zjze3vy claude 8eb2954e-21af-4867-8663-2e71bc6ec2d4 382
msznza9uu237lj claude 9449dbc9-e07a-40bd-8ff0-2054d24b7fef 47
mt4022amowa7ij codex 01a0284e-91fe-7023-b804-dc7acd28d98c 97

Logs / Error Messages

bash
No error is surfaced — the event is simply never sent.

Server bundle scan (dist/server/index.js, ~8.7 MB):
  onSessionEnd    0 occurrences
  triggerHook     0 occurrences
  hookEvent       0 occurrences

Archiving does not trigger anything either:
  POST /api/studio/sessions/{id}/archive
    -> setSessionArchived()
    -> UPDATE sessions SET is_archived = ? WHERE id = ?

I could not find a user-facing "run a command on session end" setting in the
client bundle either (searched: onSessionEnd, sessionEndHook, postSession,
afterSession, session_end, stopHook).

Environment

Windows

Node Version

v24.18.0

Additional Context

Ruled out (verified, to save investigation time):

  • Not a downstream hook problem. The same hook binary, fed the same transcript via stdin, works: transcript_parse totalTurns=6, newTurns=6, push_turns ok=6 failed=0.
  • Not a missing transcript. Studio holds the complete transcript and it exports to a format the hook parses.
  • Not the plugin's incremental dedup. That dedup keys on a capturedTurnCount state file; for these sessions the state file was never created, which is a different signature from "state exists, skipped".
  • Not a session-ID mismatch. agent_native_session_id ↔ cc- is exact.
  • Not a missing hook registration. hooks/hooks.json registers Stop correctly.

Suggested fixes, in priority order:

  1. Emit the Stop event when a coding-agent turn ends normally, carrying session_id / transcript_path / cwd / stop_hook_active, matching the CLI.
  2. Provide a user-facing "run a command on session end" setting (the semantic equivalent of Claude Code's own SessionEnd). Least invasive, does not depend on Studio's internal turn lifecycle, and benefits every hook-based extension rather than only Stop.
  3. Expose transcript export/poll by native_session_id, or write the transcript to a known location on session end. Useful as a fallback and for backfill.

Workaround used meanwhile: poll the Studio session store, compare each session's message_count against the downstream session keyed by agent_native_session_id, and re-push only the ones that fall behind. The join key above makes this exact rather than heuristic.

Source: EKKOLearnAI/hermes-studio