Repository navigation
test(wizard): restore stdin TTY state - #113345
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 6:44 AM ET / 10:44 UTC. ClawSweeper reviewWhat this changesRestores the incoming stdin TTY property descriptor after each post-install migration wizard test so non-isolated workers cannot leak a test-created terminal state into later suites. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessKeep open for maintainer review. Current main still has the test-global stdin TTY leak, and this focused suite-owned cleanup is the best fix; wait for the remaining exact-head checks before merge. Priority: P3 Review scores
Verification
How this fits togetherThe post-install migration wizard checks stdin TTY state to choose an interactive prompt or non-interactive guidance. Its tests temporarily force that process-global state, so teardown must return it to the state received by the shared test worker. flowchart LR
A[Wizard tests] --> B[Temporarily set stdin TTY]
B --> C[Migration helper]
C --> D[Prompt or guidance path]
B --> E[Suite teardown]
E --> F[Later tests retain original state]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +16. Total +16 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the suite-local restore-or-delete cleanup after exact-head CI is green, keeping the production wizard behavior unchanged. Do we have a high-confidence way to reproduce the issue? Yes. Current main has a clear shared-worker leak path, and the PR body records the focused test failing before teardown and passing after it; this read-only review did not rerun the command. Is this the best way to solve the issue? Yes. Restoring the full descriptor in the mutating suite is the narrowest maintainable fix; runner-level or consumer cleanup would hide future leaks instead of repairing the owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8b501c1c1343. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
a66bd45 to
b9ea8de
Compare
b9ea8de to
95a13d3
Compare
|
Merged via squash.
|
What Problem This Solves
The post-install migration wizard tests redefine the process-global
process.stdin.isTTYdescriptor but did not restore it. Because the wizard Vitest shard runs with isolation disabled, later suites in the same worker could inherit a test-created TTY state.Why This Change Was Made
The suite now captures the exact incoming descriptor once and restores it after every test. If
isTTYwas inherited rather than an own property, teardown deletes only the property created by the test. A suite-level invariant asserts that teardown returns stdin to the descriptor state the suite received.This is the owner-boundary fix: the suite that mutates process-global state also restores it. A consumer-side override would only hide the leak. The implementation matches the established descriptor restore-or-delete pattern in
src/commands/doctor-update.test.ts.ClawSweeper's latest rank-up move said no separate repair lane was needed because this focused maintainer PR already owns the repair; no code action was required beyond completing and proving this PR.
User Impact
Developers get deterministic wizard shard behavior, including on non-isolated workers. Production behavior is unchanged.
The cleanup is cross-platform: it uses JavaScript property-descriptor operations only, with no Unix paths, signals, or filesystem deletion semantics. The focused before/after proof ran on macOS, and the changed-file gate ran on Linux. Exact-head CI supplies the repository's hosted platform coverage; no Windows-specific branch is involved.
Evidence
node scripts/run-vitest.mjs src/wizard/setup.post-install-migration.test.ts):Test Files 1 failed (1)Tests 11 passed (11){ value: true, configurable: true }forstdin.isTTYinstead of the originalundefined.[vitest] FAILED (exit 1)Test Files 1 passed (1)Tests 11 passed (11)[test] passed 1 Vitest shard in 22.82son the rebased headnode scripts/check-changed.mjs):tbx_01kzk12d662d2j0q7snn8ep91w0 warnings and 0 errors), and repository guards passedrunStatus: succeeded,exitCode: 0git diff --check: passed.95a13d34a6e3545f2443d37a69cf960bd2c52faa: clean after one round; no accepted/actionable findings.node scripts/watch-pr-ci.mjs 113345 95a13d34a6e3545f2443d37a69cf960bd2c52faa):GREENon https://github.com/openclaw/openclaw/actions/runs/31308796636. The workflow was rerun once after GitHub left its first successfulopenclaw/ci-gatecheck-run nonterminal; the rerun completed withpending=0andSUCCESS.AI-assisted: yes.