Repository navigation
fix(chatd): fold held-back matching lines into the process exit or loss message - #427
Conversation
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merged main (683b9b1 from #425) into the branch to clear the behind-main gate. The ARCHITECTURE.md conflict was resolved by keeping both changes: the CRLF sentences from #425 and the folded-batch prose from this PR. #420 tests rerun green under the lock. @codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merged at head Gates on this exact head:
What this changes: when a process exits or its watch is lost while matched output lines are still held back (a failed send, a cool-down or a busy chat), the exit or loss message now carries those lines instead of dropping them. Closes #420. Not exercised: a live coderd with a real process that exits during a cool-down. The unit test covers the delivery path from a fired payload that holds both lines and an exit. |
Closes #420
What changed
When matching output lines of a watched process are held back in the watch's
fired_payload, by a failed send, the output cool-down or a busy chat, and the process then exits or the watch is lost, the delivery dropped the held-back lines:processFiredTextreturned only the exit or loss text.processFiredTextincoderd/x/chatd/fork_process_events.gonow folds the held-back batch into the exit or loss message through a newprocessFoldedLinesText, which reads thematchedcount and lines the payload already holds. The folded batch is not a message of its own: it never appends the last-message text of the lines (processLinesLastText), and the final poll delivers it, since the lines were collected before the event that ends the watch. The watch still ends with that one message, so no line message is sent twice.Tests
TestProcessFiredTextgrew folded cases:ExitOverLines,ExitOverManyLines,ExitOverLinesOnLastDelivery(a folded batch on the watch's last delivery carries no last-message text),ExitOverLinesOnFinalPoll(the final poll delivers the fold), andLostOverLines.TestWakeupEventsProcessLinesOnExitwalks the wake-up end to end: a first line delivers, a second one is held back by the cool-down and its send fails (runsdelivered, failed), the process exits, and the retry delivers one message with the exit tail and the folded line (runsdelivered, failed, delivered). The watch ends completed with two deliveries, and a resent exit delivers nothing.fork_process_events.goto1359b2e903makes both tests fail (TestWakeupEventsProcessLinesOnExitat line 444,TestProcessFiredTextfor the three folded cases), so the tests cover the fix. Restoring the fix makes them pass.go test ./coderd/x/chatd/ -run 'TestProcessFiredText|TestWakeupEventsProcessLinesOnExit|TestWakeupEventsProcessOutput|TestWakeupEventsProcessExit|TestWakeupEventsProcessOutcomes' -v(pass),go test ./coderd/database/forkdb/...(pass),go veton both packages (clean).Docs
coderd/x/chatd/ARCHITECTURE.md: the events wake-up bullet and the fire bullet describe the fold, the skipped last-message text, and the final-poll treatment, including the late-final-poll cutoff.docs/fork/pstack-adapter.md: the fold sentence and the final-check wording.coderd/database/forkdb/chat_process_events.go: theChatProcessFiredcomment now says the payload keeps lines beside an exit or loss.Pre-commit hook
The pre-commit hook of this fork (#407) is disabled for this worktree branch, so it did not run. The targeted checks above stand in for it, and fork-ci runs the full checks on the head.
No em dashes or en dashes in changed prose. Fork logic stays in
fork_*.gofiles.