feat(g4): tie the N1 transcript to its session with a one-time marker - #440
Merged
Merged
Conversation
…#434) After the binding is fully matched, the runner sends each native PTY one harmless prompt carrying a case-specific marker, through a control socket held by pilot-pty.py, and waits for exactly one transcript that has both the bound sessionId and that marker. Anything else (no file, several files, marker and sessionId in different files, a failed or partial write) is unknown. - pilot-pty.py: "run --control-socket" writes datagrams to the retained PTY master; "send" delivers one input and reports ok/error. The socket is bound before the pilot starts, so an unbindable path starts nothing. - runner: the socket lives in a private mktemp -d directory under /tmp (AF_UNIX paths are too short for the artifact tree) and is removed when the case stops; a marker that cannot be generated stops the case. - isolation helper: match transcript candidates on sessionId and marker. Implementation started by agmsg_programmer_codex and completed by agmsg_programmer_claude after the handover. Refs #434 #395 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gd6MbRAYGpkDzHAk1XZroZ
- runner: input-count is written before the single send attempt, and input-result records ok/error, so a failed or partial write is still one recorded input and is never retried (design 3.2, N1M-07). - runner bats: N1M-01 (the prompt reaches the PTY once and the transcript wait uses that marker) and N1M-07 (a failed send is unknown, counted once, not retried, and no transcript wait starts). - isolation: N1M-03/04/05/06/08 finder controls (marker in another session, sessionId and marker split across files, two candidates, a match outside the root, a session file without the marker). - pilot-pty: write_master only accepts a complete write (partial, EIO, closed descriptor are errors). Refs #434 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gd6MbRAYGpkDzHAk1XZroZ
kappaseijin4claude
deleted the
fix/issue-434-native-transcript-marker
branch
September 13, 2026 04:28
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.
概要
Issue #434(N1のtranscript観測が無送信では成立しない問題)の実装。設計はPR #435でmerge済み。
Refs #434(マージでは自動クローズしない。verifierによるsmoke/受入確認後、PMが手動でクローズする)
実装内容
binding完全照合後、runnerが各native PTYへ
pilot-pty.py経由のcontrol socketを通じて識別用prompt(case固有marker付き)を一回だけ送信し、同一transcriptファイル内のsessionId一致とmarkerの両方が揃うのを待つ。codexから引き継いだ経緯
programmer_codexの週次枠枯渇に伴い、agmsg_programmer_claudeが引き継いで完了した。引き継ぎ時点でsocketパスは既に
/tmp/agmsg-n1-$$-${RANDOM}.sockへ変更されており(元のバグ:AF_UNIX path too長すぎは解消)、runner bats 43/43 PASSだったが、fail-closedの観点から追加で3点修正した。pilot-pty.pyがpilot起動後にsocketをbindしていた(bind失敗時、起動済みpilotを止める者がいなくなる)→ bindをspawnの前に移動、失敗時はexit 70で何も起動しない/tmp直下の推測可能パスをbind直前にunlinkしていた(別プロセスのファイルを消しうる)→mktemp -d /tmp/agmsg-n1.XXXXXX(0700)の専用ディレクトリへ変更、case停止時に削除検証
/tmp/agmsg-n1.*が残っていないことを確認(0件)変異試験・負の対照
AF_UNIX path too long(今回の不具合の再現)test_an_unbindable_control_socket_starts_nothingこの実装で扱わない範囲
README への影響
無。G4 gateの内部harnessの変更で、ユーザーが設定・利用する手順は変わらない。
🤖 Generated with Claude Code
https://claude.ai/code/session_01QCtgi8wVJDRaMwXHZmkHqT