Skip to content

fix(codex-wake): keep seeded thread usable — carry cwd, keep path, skip resume - #97

Open
alexanderyswork wants to merge 1 commit into
alexfrmn:mainfrom
alexanderyswork:fix/codex-wake-seeded-thread-cwd-and-path
Open

fix(codex-wake): keep seeded thread usable — carry cwd, keep path, skip resume#97
alexanderyswork wants to merge 1 commit into
alexfrmn:mainfrom
alexanderyswork:fix/codex-wake-seeded-thread-cwd-and-path

Conversation

@alexanderyswork

Copy link
Copy Markdown

Fixes the root cause behind #96. Found while running Murmur on a small personal mesh (two Claude Code agents + Codex) — thanks for the project.

Problem

A thread seeded inside the wake call has no rollout file until its first turn, so thread/resume always fails on it with no rollout found. That failure leaves threadPath null, which silently disables the session-log completion fallback — the only path that actually completes a turn on Codex CLI 0.145. Codex answers, the answer sits in the session JSONL, and the daemon times out without relaying anything.

Observed on a live mesh: with an explicit threadId the reply relays in 10–15s via source: "session-log"; without it every message ends in codex-app-server-turn-completion-timeout.

Changes

  • buildThreadStartParams carries peer cwd/model into thread/start. Previously a seeded thread started with cwd: null — verified on a live session: session_meta.cwd == "/", so no project instructions, wrong workspace roots and permissions. After the fix the same probe returns the configured project directory.
  • The thread/start response path is kept as threadPath; it used to be discarded, and threadPath was only ever taken from thread/resume.
  • A freshly seeded thread is no longer resumed. Seed and re-seed share one code path.
  • normalizeWakeConfig preserves the resume flag — it dropped the field entirely, making the injector's peer.resume === false opt-out unreachable from real config.

Tests

Three new tests, each red before the change:

  • normalizeWakeConfig preserves the explicit resume opt-out
  • buildThreadStartParams carries peer cwd and model into thread/start
  • Codex app-server injector keeps the seeded thread path and skips resume — covers the untested gap: relayFinalToMurmur with no threadId.

node --test tests/codex-app-server-wake.test.mjs → 19/19 pass.

Full npm test: 88/89. The single failure (collectPrometheusSnapshot, ERR_DLOPEN_FAILED on an unbuilt better-sqlite3 native module) reproduces identically on unmodified main — unrelated.

Also verified end-to-end after the change with threadId removed from the config: the reply relays normally and Codex now runs in the configured working directory.

Not addressed here

Deliberately out of scope, all listed in #96: single-WebSocket transport for start/resume/turn, cursor advancing on failed wakes (silent message loss), per-conversation threads, relay idempotency, head-of-line blocking in WakeMonitor.drain.

🤖 Generated with Claude Code

…ip resume

A thread seeded inside the wake call has no rollout file until its first turn,
so thread/resume always failed on it with 'no rollout found'. That failure left
threadPath null, which silently disabled the session-log completion fallback —
the only path that actually completes a turn on Codex CLI 0.145. Result: Codex
answered, the answer sat in the session JSONL, and the daemon timed out without
relaying it.

- buildThreadStartParams now carries peer cwd/model, so a seeded thread no
  longer starts in / with no project instructions or workspace roots
- the thread/start response path is kept as threadPath (it was discarded)
- a freshly seeded thread is no longer resumed; re-seed shares one code path
- normalizeWakeConfig preserves the resume flag, which it dropped entirely,
  making the injector's resume opt-out unreachable from real config

Tests cover the gap that broke in production: relayFinalToMurmur with no
threadId configured.

Refs alexfrmn#96

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant