fix(container): multi-turn FIFO persistence - #16
Merged
Conversation
Claude Code CLI in --input-format stream-json mode exits after each turn by design. Replace the single long-lived process with per-turn invocations: first turn uses `claude -p`, subsequent turns use `claude -c -p` (--continue) reading from a FIFO loop. Also simplifies send_message to write raw content instead of stream-json wrapper, and ensures newline-terminated FIFO writes.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--input-format stream-jsonexits after each conversation turn by design (exit 0,terminal_reason: "completed"). The single long-lived process approach never worked for multi-turn.claude -p "$PROMPT", subsequent turns read from FIFO and useclaude -c -p "$CONTENT"(--continue) to resume with full context from Claude's local session store.send_message()to write raw content instead of stream-json wrapper; ensure newline-terminated FIFO writes forreadcompatibility; addwrite_to_containerto FakeDockerClient and 3 new tests forsend_message.Changes
infra/docker/claude-runner/entrypoint.shclaude -c -p, signal handling for clean shutdownapps/api/src/helprs/modules/container/service.pysend_message(), newline-terminatedwrite_to_container()apps/api/tests/modules/container/test_service.pywrite_to_containeron FakeDockerClient, 3 newTestSendMessagetestsCLAUDE.mdTest plan