Repository navigation
test(tui): reuse real gateway PTY fixture - #118567
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 4:46 AM ET / 08:46 UTC. ClawSweeper reviewWhat this changesThe PR reuses one real Gateway pseudo-terminal across serial TUI end-to-end scenarios, preserves isolated sessions and mock-model behavior per case, and moves fixture helper coverage into a fast test. Merge readinessThe branch is a focused test-only performance refactor with a clear session-isolation boundary and no actionable code defect found. It should remain open for the assigned maintainer to review and for the in-progress required checks on the current head to finish. Priority: P3 Review scores
Verification
How this fits togetherThe TUI end-to-end suite drives a terminal client through a real local Gateway and a mock model server. This change shares expensive Gateway and terminal setup while each scenario switches to a new session and asserts its own model requests and terminal output. flowchart LR
A[Serial TUI scenarios] --> B[Fresh Gateway session]
B --> C[Shared terminal PTY]
C --> D[Real Gateway]
D --> E[Mock model server]
E --> F[Per-scenario response and request assertions]
F --> G[Abort cleanup and next scenario]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +56, Tests -148. Total -92 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single shared fixture, retain explicit per-session offsets, model routing, and abort cleanup, then merge only after the exact head is refreshed against current main and its required checks complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR optimizes an existing test lane rather than reporting a user-facing defect. The contributor supplies a built-CLI before/after terminal run plus targeted owner-test results. Is this the best way to solve the issue? Yes. Sharing the expensive Gateway and PTY while retaining a fresh session, scoped model-request offsets, output offsets, and per-case abort cleanup is the narrowest maintainable way to reduce this serial lane. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7571679ecc7c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…ion-routing * origin/main: refactor(agents): remove stale runner state plumbing (#118495) test(gateway): skip servers for handler fixtures (#118581) test(tui): reuse real gateway PTY fixture (#118567) fix: keep command tests independent of ambient Gateway tokens (#118577) fix: show effective channel model in Telegram status (#118548) test(system-agent): reuse approval CLI fixture (#118572) test(macos): deduplicate Claude session catalog fixtures (#118571)
* test(tui): reuse real gateway PTY fixture * test(tui): share gateway mock model --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
The built-artifact check was dominated by the serial TUI PTY lane. In main run 30789242864, channels and core-support completed in about 30 seconds and gateway-watch reported 14.24 seconds, while TUI PTY held the step for about 359 seconds.
The real Gateway and mock model server were already shared, but each retained Gateway scenario still launched a new TUI process and cold-initialized a dedicated agent. This change keeps the suite serial and reuses one real Gateway PTY across the unique full-stack scenarios. Every case still gets a fresh session, an explicit per-session model, request/output offsets, and abort cleanup. Repeated output markers are scoped to the session-switch boundary so an earlier case cannot satisfy a later assertion.
The real-local smoke and steering contracts now run in one isolated local PTY. Backend-free helper regressions move to a fast owner test.
Redundant real-Gateway cases were removed only where dedicated owners retain the behavior:
src/tui/tui-pty-harness.e2e.test.tsplussrc/tui/components/custom-editor.test.ts./resetduring an active run:src/tui/tui-pty-harness.e2e.test.tsplussrc/tui/tui-command-handlers.test.ts./new: the real-local smoke retains fresh-context proof, while the fake PTY and command-handler suites own create/adopt/serialization behavior.session.toolprojection proof; embedded-backend and event-handler suites own local mechanics.No production code, test sharding, worker count, or concurrency changed. The test patch is net 115 lines smaller.
Evidence
Exact main baseline:
Run built artifact checks: about 359 seconds, owned by TUI PTY.After, using the built CLI path:
Coverage-owner proof:
/new, and/resetowners: 15/15 passed.git diff --checkand oxfmt passed.check-changedwas attempted through Crabbox/Daytona but provider hydration failed before repository checks because/var/cache/crabboxwas not writable. The owned lease was cleaned up; focused and sibling proof above completed locally.