Repository navigation
fix(relay): bound cyclic process-table traversal - #20946
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe change makes Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The process traversal remains correct for ordinary trees and now safely terminates for cyclic or duplicate process snapshots. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, solution, scope, and validation, but it does not follow the required template. It omits the required Linked Issue entry, Visual Proof or an N/A explanation, AI Disclosure, Review, Agent skill upstream boundary, Notes, and checklist details. Resolution Rewrite the description using the repository template. Add a Linked Issue entry with the required issue reference, state N/A with a reason for Visual Proof, complete the Testing and checklist sections, and address AI Disclosure, Review, Agent skill upstream boundary, and Notes.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Relay descendant walk bounded —
collectDescendantsinsrc/relay/pty-shell-utils.ts:182now seeds aseenset with the root pid and skips any pid already visited, so duplicate rows and parent/child cycles terminate instead of growingdescendantswithout bound. Ordinary acyclic tables are unaffected. - Regression coverage —
pty-shell-utils-process-cycles.test.tscovers a self-parented root, a two-process cycle, duplicate rows, and an ordinary tree, with achildrenByPpid.getspy that caps reads so an unguarded traversal fails rather than OOMs the worker.
I verified locally: pnpm tc:node passes; the new file plus pty-shell-utils.test.ts pass (42 tests); oxlint and check:code-quality:changed are clean. Removing the guard makes 3 of the 4 new cases fail ('node' instead of 'codex') without hanging, so the test is a real regression pin rather than theatre.
ℹ️ Nitpicks
collectDescendantshere iscollectDescendantsFromIndexfromsrc/shared/process-table-index.ts:68plus this guard, and the relay already imports from that module. #20715 is adding the same guard to the shared walker, so once it lands the relay can drop this private copy and call the shared function. Not a blocker for this fix — deleting the duplicate before #20715 merges would reopen the relay OOM — just flagging it so the two-copies state does not become permanent.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…tablyai#20946) Co-authored-by: m4air <[email protected]>

A process-table snapshot with repeated or cyclic parent links makes SSH relay foreground inspection revisit descendants indefinitely, growing its array until the relay runs out of memory.
Visit each PID once and exclude the root from its own descendants. Ordinary process trees keep the same foreground resolution. This fixes the relay's separate walker; #20715 guards the shared local/daemon walker.
Validation: 42 relay foreground tests passed, including self-cycles, two-process cycles, duplicate rows, and ordinary trees. The regression bounds traversal reads so removing the guard fails without hanging or exhausting the test worker. Targeted oxlint and oxfmt passed.