Uh oh!
There was an error while loading. Please reload this page.
fix(runtime): join PTY finalization after a racing persist - #3082
Conversation
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 3 reviews per rolling hour; 2 remain after this review. 📝 WalkthroughProblem solved
The test now waits for a terminal shell-run snapshot before it asserts Design assessmentThe change extends the existing PTY finalization and durable observation flow. It does not create a parallel source of truth or change a public contract. The production fix is small and located at the race point. The test synchronization and added regression coverage are necessary to verify asynchronous finalization. No deletion or simplification is evident without weakening coverage. Validation and risksReported validation includes successful builds, targeted and full test passes, and clean Biome checks. Direct evidence of the current required-check status is unavailable, so that status remains unverified. The main behavioral risk is that Review-relevant risksNo protected-area effect was identified in the current diff. The person performing the merge reviews the final diff, and a maintainer makes the final determination. Walkthrough
ChangesPTY finalization synchronization
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk:⚪ Minimal · up to This localized runtime change ensures PTY runs reach their terminal record after a racing persist; no actionable merge-blocking risk remains after normal checks. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8d3a6126-a1e6-4364-bf74-587d6dd3c61b
📒 Files selected for processing (2)
packages/runtime/src/__tests__/shell-run-manager.test.tspackages/runtime/src/shell-run-manager.ts
Uh oh!
There was an error while loading. Please reload this page.
writeStdin decided whether to join finalization when persistObservation was first called. A real PTY can exit while that persist is still in flight, so the control returned a running snapshot. Re-join if finalization has started, and wait for a terminal observation in the queued-cut test instead of assuming the first snapshot is already done. Fixesapache#3077 Generated-by: Grok
Hold the writeStdin persist until PTY finalization has started, then assert the control result itself is completed. The existing queued-cut test can still wait for a later snapshot. Generated-by: Grok
63f2702 to
c562830CompareUh oh!
There was an error while loading. Please reload this page.
Summary
joins finalization when a real PTY exits before a queued control cutfailed on CI withexpected completed, got runningeven though #3075 did not touch runtime. Re-running the same commit passed.writeStdinaskedpersistObservationwhether to join finalization at call time. A real PTY can exit while that persist is still in flight, so the control returned the running snapshot. After persist, ifdriverExit/finalizeOnceis set, join the terminal record.The test no longer assumes that first snapshot is already terminal: if it is still
running, it waits withwaitForTerminalShellRun(15s) before assertingcompleted.Fixes#3077
Verification
npm --workspace @maka/core run buildnpm --workspace @maka/runtime run buildnode --test --test-name-pattern 'joins finalization when a real PTY exits before a queued control cut' packages/runtime/dist/__tests__/shell-run-manager.test.js— 5/5 repeatsshell-run-manager.test.js— 57 pass, 3 skip (Windows PowerShell)biome checkon the two files — cleanAI use
Select exactly one:
Tool(s) and scope:
Grok authored the implementation, tests, and this PR description.
Checklist
Does this PR entail a change in behavior?