Skip to content

fix(runtime): GC expired proven-absent leaf PTY verdicts - #12810

Merged
nwparker merged 3 commits into
stablyai:mainfrom
innocarpe:fix/proven-absent-leaf-pty-gc
Sep 13, 2026
Merged

nwparker merged 3 commits into
stablyai:mainfrom
innocarpe:fix/proven-absent-leaf-pty-gc

Conversation

@innocarpe

@innocarpe innocarpe commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Orca was keeping expired notes about missing terminals forever. This clears old notes during normal activity while preserving fresh checks and the existing rules for remote terminals.

Details

Long-lived runtimes kept a controller-proven PTY absence timestamp forever when that PTY ID was never consulted again. Cleanup now removes expired timestamps during other PTY consultations and when delayed absence probes finish.

The existing 15-second per-ID expiry, fresh-verdict reuse, live-provider override, concurrent probe coalescing, and unverifiable/error behavior remain intact. No fresh verdict is evicted. Whole-cache sweeps run at most once per existing TTL during activity, with clock-rollback recovery, so typing does not walk the map on each keystroke. Expired untouched entries can remain until the next due sweep; there is no idle timer.

The contributor's expiry helper is retained and wired into the current extracted runtime module. Original commits are preserved. This takes the expiry-only approach for #12660; the overlapping capacity eviction in #13146 is outside this change.

Validation against main fa3d29fa11e3, with ORCA_BACKGROUND_LAUNCH=1:

  • 1,313 tests passed across six suites, including the full runtime, public stale-leaf send paths, and mailbox submission/staging; one existing runtime test skipped.
  • A 1,000-ID workload releases expired entries without revisiting those IDs and preserves all 1,000 fresh entries. Another 3,000-consultation burst performs two full-cache sweeps.
  • Exact expiry between sweeps, delayed probe completion, backward clock adjustment, probe coalescing, and unverifiable/error results are covered.
  • Restoring the baseline fails five regressions. Removing sweep throttling fails the operation-count regression. The restored fix passes again.
  • Node typecheck and all three changed-code quality gates passed. No wire, provider API, Git command, or path behavior changed.

Local validation ran on macOS; live remote and other-OS runs are left to CI.

Fixes #12660.

Sweep TTL-expired provenAbsentLeafPtyVerdicts on consult and insert so
dead leaf ids do not retain Map entries for the process lifetime.

Preserves the 15s no-reprobe cache for still-fresh verdicts.

Fixes stablyai#12660
@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The runtime now prunes expired proven-absent PTY verdicts during liveness checks. It prunes entries before PTY consultation and before recording a new absence verdict. The pruning helper clears all entries for non-positive TTL values and removes entries whose age meets or exceeds the TTL. Tests cover expired entries, fresh entries, empty maps, and non-positive TTL values.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, rationale, linked issue, implementation scope, and validation results. However, it does not follow the repository template: required sections such as What Changed,… Update the description to include all template sections. Add an explicit Visual Proof section with N/A and a reason if no visual or interaction change exists. Include the required testing checkboxes, AI disclosure, review and boundary confi…
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement TTL-based garbage collection without re-probing and preserve the existing 15-second write-rejection behavior required by issue #12660.
Out of Scope Changes check ✅ Passed The helper, runtime call sites, and focused tests are directly related to issue #12660 and do not introduce unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly identifies the main change: garbage collection of expired proven-absent leaf PTY verdicts. It is concise and specific.
Full details: Description check

Explanation

The description explains the change, rationale, linked issue, implementation scope, and validation results. However, it does not follow the repository template: required sections such as What Changed, Why, Visual Proof or an explicit N/A explanation, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist are missing.

Resolution

Update the description to include all template sections. Add an explicit Visual Proof section with N/A and a reason if no visual or interaction change exists. Include the required testing checkboxes, AI disclosure, review and boundary confirmations, notes about compatibility and performance, and the checklist items.

  • Fix all pre-merge checks with AI

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit bb5aea8 into stablyai:main Sep 13, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P2: GC expired provenAbsentLeafPtyVerdicts entries without re-probe

4 participants