Skip to content

test(windows): record native PTY stress lifecycle milestones - #25042

Merged
nwparker merged 7 commits into
mainfrom
fix/windows-native-pty-stress-diagnostics
Oct 3, 2026
Merged

nwparker merged 7 commits into
mainfrom
fix/windows-native-pty-stress-diagnostics

Conversation

@nwparker

@nwparker nwparker commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​562 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​562
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​220 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​212

ELI5

When a Windows terminal stress test stalls, its old log cannot show where progress stopped. The test now records bounded, sanitized lifecycle observations while keeping its existing assertions and timing.

What Changed

Record output-pipe, worker, native exit and final callback milestones, pending state at existing deadlines, and hashes of the native addon and supporting files. Redact addresses and credentials even when terminal controls split them, preserving the controls’ positions. Keep the warmup survivor and newest 31 terminals; later terminals still receive observers, with omissions counted explicitly.

Why

The failing Windows job had one silent terminal and at least one undrained callback. An earlier passing job used the same source and cache inputs, without a loaded-addon hash. Observing the existing objects supplies missing evidence while preserving the gate. Bounded recent records retain the terminals most likely involved in a late failure.

Linked Issue

Diagnosis of PR #25031’s Windows package failure. This does not claim that the original native cause is fixed or close a product issue.

Visual Proof

N/A — test diagnostics add no UI or interaction change.

Testing

  • I manually tested these changes locally
  • Automated tests added and updated for reproduced failures.

On the exact previous public helper, eight strengthened controls failed and six passed. They reproduce control-interrupted credential/address leaks, omitted late terminals after eleven rounds, and late state after the 256-milestone cap. Independent review then reproduced six more leaks on the intermediate helper: usernames and hostnames masked only part of an email. The final helper runs the existing same-length redactor a second time, removing the remaining private domain while preserving controls and OSC framing. Those six before failures and two credential-overlap controls are retained. Corrected source 5037c18a898571539ade5336ad3519cd49dfb20f passes 171 controls in four files, including all 22 observer controls, the full anti-slop audit, syntax/AST checks, focused format/lint and six quality gates.

The previous public source f1ed3e97 passed actual Windows CI: 25 PTYs, eight rounds, 526 passing tests and 26 skips, plus build, package and smoke checks. Its native stress/driver files remain exact here; the observer has changed, so fresh normal CI must qualify this complete correction. The passing run’s native-addon hash differs from the historical failure; it does not explain that failure.

Review

All four original diagnostic files and public ancestry are retained; all 32,245 paths outside that scope match main 786a040b. The existing redactor runs twice on a view with presentation controls removed, then controls are restored at their original positions; OSC framing separates title payloads from adjacent text. Logs retain 32 terminal records and 256 milestones with explicit omissions, plus bounded final snapshots. The native callback preserves its receiver, arguments, result and thrown errors; error observers preserve unhandled-error behavior.

Native assertions, deadlines, input, concurrency and cleanup remain exact. Companion hashes identify file bytes rather than in-memory DLL equivalence. The original native cause remains unverifiable.

Agent skill upstream boundary

  • Not applicable; no upstream skill source is copied.

Notes

No production API, RPC, native patch, dependency or workflow change. Blank output or a missing callback is not evidence of process death. Local helper controls run on macOS; the existing real ConPTY gate exercises Windows.

Checklist

  • Small, focused diagnostic scope.
  • Explained the before/after, mechanism and choice.
  • Visual proof N/A with reason.
  • Self-reviewed privacy, bounded logging and callback behavior.
  • Cross-platform and remote impact considered.
  • Fresh normal Windows CI must qualify the complete corrected source.

Preserve the gate assertions, deadlines, concurrency and cleanup while recording bounded sanitized diagnostics.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e14831b-d16d-4b56-96de-183d251eba62
📥 Commits

Reviewing files that changed from the base of the PR and between f1ed3e9 and 5037c18.

📒 Files selected for processing (2)
  • config/scripts/windows-pty-table-stress-observer.mjs
  • config/scripts/windows-pty-table-stress-observer.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Windows PTY stress observer tracks PTY and worker events and produces bounded state snapshots. The stress script reports input hashes and sanitized paths, transcript output, and error stacks. It records observer checkpoints during spawn, timeout, kill, and completion paths. The Windows PTY test prints stdout only when the process exits with code 0 and does not time out. OpenCode Go key resolution prepares a copied default environment through the managed data-account service. Explicitly supplied environments remain unchanged.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 5037c

This change adds diagnostics to the Windows PTY stress test and prepares the default OpenCode Go key-resolution environment. The review found no remaining merge-blocking risk. A real Windows CI run is still needed to qualify the stress behavior.

Architecture Summary

Architecture risk: 🟡 Medium · up to 5037c

The change affects 2 systems.

Changed systems: config, src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — config (service) was modified; 3 changed files map to changed impact.
  • observed — src (service) was modified; 3 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in config/scripts/windows-pty-table-stress.cjs: The script now loads the stress observer and input-hash helper, creates an observer using report, sanitizes the reported addon path, and includes hashes of stress inputs in the native report.
  • observed — Modified behavior in config/scripts/windows-pty-table-stress.cjs: The spawned PTY record is now registered with the observer using its round and slot.
  • observed — Modified behavior in config/scripts/windows-pty-table-stress.cjs: On readiness timeout, the script now records observer state and sanitizes each captured output in the timeout transcripts.
  • observed — Modified behavior in config/scripts/windows-pty-table-stress.cjs: After killing a PTY, the script now records a kill-returned-state observer checkpoint for that record.

Reliability and maintainability

  • inferred — Risk-relevant change factors for config: blast_radius_1; direct_dependents_1
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: recording lifecycle milestones for the Windows native PTY stress test.
Description check ✅ Passed The description covers the required sections and explains the change, motivation, testing, and scope. It states that fresh Windows CI is still needed.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 72b42d1d-6e4d-4a27-a31e-184ba7f2a441
📥 Commits

Reviewing files that changed from the base of the PR and between c2dba12 and a6a10f0.

📒 Files selected for processing (4)
  • config/scripts/windows-pty-table-stress-observer.mjs
  • config/scripts/windows-pty-table-stress-observer.test.mjs
  • config/scripts/windows-pty-table-stress.cjs
  • src/main/windows/windows-pty-job.win32.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

nwparker and others added 2 commits October 3, 2026 09:18
Reuse the existing probe invocation pattern while preserving native callback receiver, arguments, return value and thrown errors.
* Add host-owned OpenCode and Devin account profiles

* Manage OpenCode and Devin profiles in account Settings

* Expose registered account roots to host transcript readers

* Clarify managed profile provider flags

* Retain isolated Electron home in browser sidecars

* Restore inherited account environment and preserve cleanup retries

* Check relay environment values before merging

* fix(opencode): keep saved Go credentials in main-owned storage

Co-authored-by: kespineira <[email protected]>
Co-authored-by: kevimux <[email protected]>

* test(opencode): retain legacy key ownership across worker writes

* Consolidate managed account type imports

* test(accounts): provide OpenCode credential API in lifetime fixture

* fix(accounts): use existing localized provider names

Align the new Japanese account copy with the existing catalog repair policy.

* Keep managed account baselines private to the execution host

* Align account enrollment help with accepted providers and flags

* Show the active System account in managed profile lists

* Document the validated Linux managed account scope

* fix(opencode): resolve Go keys by execution backend

* Use host-private account restoration for OpenCode Go usage

* Fix managed account removal, credential audits, and runtime bundling

* Quarantine removed accounts and audit captured credential snapshots

* fix(accounts): canonicalize account removal to rm

Use account rm as the canonical removal command and keep account remove as an alias. Preserve the existing accounts.removeData RPC and the full original 63-path account component.

Original-Account-Source: cf71ae4
Frozen-Account-Base: 08ee7ba
Frozen-Integrated-Main: 53f9ea7
Private validation source only; no ref or publication.

* fix(accounts): recover interrupted profile removal on startup

Scan private removal backups before quarantined cleanup, reuse the existing state schema to validate the exact UUID, and preserve registered or unmarked profiles. Mark account rm as destructive using the existing typo recovery policy. Retain the full original account component and public author ancestry.

Account-PR: 24636
Original-Account-Source: cf71ae4
Reviewed-Public-Parent: 6abaf73
Frozen-Integrated-Main: 53f9ea7
Private source only; no ref or publication.

* fix(accounts): protect registered UUID case variants during removal recovery

Compare validated account UUID identities without changing stored IDs or filesystem paths. Protect registered originals and quarantines, including explicit retry variants, and accept equivalent UUID spelling in a valid removal backup. Retain the complete account component and published contributor ancestry.

Private source only; no index, ref, or public mutation.

* Allow cold node-pty setup on Windows ARM CI

Keep a ten-minute bound only for node-pty rebuilt on Windows ARM CI hosts; all other node-gyp calls retain five minutes. Cold setup in two completed ARM jobs left compilation less than a minute.

---------

Co-authored-by: kespineira <[email protected]>
Co-authored-by: kevimux <[email protected]>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The static analysis job fails on anti-slop/no-reflect-apply at config/scripts/windows-pty-table-stress-observer.mjs:152, which cascades into the verify aggregator — required checks are red on a6a10f0. There is also a small redaction gap in the new sanitizer that the shielding introduces. Both are inline.

Reviewed changes

  • New stress observer (config/scripts/windows-pty-table-stress-observer.mjs) — records bounded, sanitized PTY lifecycle milestones (spawn return, first data, socket/worker state, native exit callback) and pending per-terminal snapshots at each existing deadline.
  • Observer unit tests (...observer.test.mjs) — pin callback transparency, error-monitor handling, event/record bounds, same-length redaction, and loaded-input hashing. All 7 pass locally.
  • Stress script wiring (windows-pty-table-stress.cjs) — creates the observer, watches each terminal, reports pending state at both deadlines and on completion, and sanitizes transcript/error output.
  • Windows test (windows-pty-job.win32.test.ts) — logs the stress stdout on success.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No new issues in this delta. The static analysis blocker is fixed; the previously-flagged sanitizer redaction gap is unchanged and its thread remains open.

Reviewed changes

  • Native exit callback made anti-slop compliant (config/scripts/windows-pty-table-stress-observer.mjs) — original.call(this, ...args) replaces Reflect.apply(original, this, args) in the _$onProcessExit wrapper, preserving the receiver, arguments, return value, and thrown errors while clearing anti-slop/no-reflect-apply; the existing callback-transparency test still pins that behavior.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

…inals

Reuse transcript redaction after presentation-control removal while preserving OSC boundaries and exact controls. Keep the warmup survivor and newest bounded terminal records without changing native assertions or timing.
Reuse a second same-length transcript-redactor pass before restoring control sequences. Preserve native stress assertions and timing; consolidate the regression test OS imports.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Sanitizer redaction gap closed (config/scripts/windows-pty-table-stress-observer.mjs) — sanitizeStressText now elides CSI controls from the scan text, records each control's visible-text offset, redacts the control-stripped text, then restores every control at its offset, while intentionally retaining OSC open/close framing as a boundary so a title payload cannot merge with adjacent rendered text.
  • Identity-masked emails caught by a second pass — a second same-length redactTranscript pass removes an email whose local part was claimed by a local username/hostname finding in the first pass, closing the plain/CSI/OSC email leaks.
  • Bounded snapshots retain the useful window — watch() now splices out the oldest recent terminal (index 1) when the warmup survivor occupies index 0, so the survivor plus the newest 31 terminals survive instead of later terminals being dropped entirely while still counted as omitted.
  • Regression coverage (config/scripts/windows-pty-table-stress-observer.test.mjs) — added an interrupted-secret matrix (email domain/name, vendor key, bearer token), interrupted-OSC-title independence, 11-round retention, post-256-milestone retention, and username/hostname email-priority cases; 22 tests pass locally.

I independently fuzzed the new sanitizer with a CSI inserted at every position of email, vendor, bearer, and opaque-token secrets (and two CSIs at all position pairs): 0 leaks, with the same-length invariant preserved. The previously-open redaction thread is retired.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 995715b into main Oct 3, 2026
32 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.

1 participant