Repository navigation
fix: keep Core diagnostics out of the active workload terminal - #353
gautamsirdeshmukh merged 3 commits into
Conversation
## Problem Late Core reports share stderr with a native terminal workload and can overwrite its screen. Disabling a caller's banner does not prevent those writes. ## Solution Keep the workload on its original terminal streams. Capture only Core stderr during terminal runs, drain it into bounded memory, and restore and replay it after hosted services stop. Leave piped output live. Update the config and architecture docs. No public API, policy, config, or record format changes. ## Tests terminal_diagnostics_follow_successful_and_failed_agent_exits and terminal_diagnostics_survive_core_termination fail on the baseline and pass with the fix. piped_core_diagnostics_remain_live preserves piped behavior. Isolated diagnostics tests and mutation checks cover the retention bound, truncation notice, Drop restoration and inherited writers. Actual CLI probes pass with and without the banner, including native bytes, input, resize, idle silence, Ctrl-C and terminal restoration. All-feature and no-default builds, Clippy and formatting pass on macOS. The Core suite has 1,259 passing tests and five existing ignored tests. The grammar test's copied false executable exits 137 on both this change and untouched base 028b2ff. Deterministic containment passes 129 cases with 12 declared Linux-only skips. The example runner has no scripted examples. Linux cross-checking requires a missing x86_64-linux-gnu-gcc; Linux runtime validation remains for CI. No model calls were made.
|
Assessment: Comment Deferring Core's stderr during a terminal run fixes the screen overwrite, and cleanup on every path is correct. The open questions are about which messages the 32 KiB limit throws away, and the process-wide fd 2 redirect for library callers. Review Categories
Checks that held:
The |
|
Assessment: Comment I re-reviewed at Checks that held at this head:
|
## Problem Late Core messages overwrite the native workload screen. Boxy continues to consume feature/allow-multilink-commands while the command alias scan on main awaits #381. ## Solution Apply merged commit 1e94f57 without changes to this feature branch. The workload keeps its terminal streams. Core retains later diagnostics and prints them after the workload exits. ## Tests - Builds with all features and no default features, Clippy, and formatting pass. - The workspace suite reports 4,766 passed, 2 failed, and 17 ignored. Both failures reproduce on unchanged 53a6c04: the same-folder hard-link refusal test and the tool grammar exit-status test. - Deterministic containment reports 129 passed and 12 Linux-only skips. - The diagnostics unit test and all three terminal integration tests pass. Each fails under its relevant deliberate mutation and passes after restoration. - The local Linux cross-check requires the absent x86_64-linux-gnu-gcc compiler. The merged patch passed Linux CI on its original base.
Description
Late MCP permission reports and other Core messages can overwrite the native agent screen. This affects runs with and without a CLI banner.
Keep startup disclosures before launch. Retain later Core messages until the workload and hosted services stop, while the agent keeps its original terminal streams. Piped Core messages remain live. Public APIs, flags, configuration, policy, and record formats are unchanged.
Type of Change
Bug fix
Testing
Three integration tests use real Core and MCP processes. They cover normal and nonzero exits, termination, native input and control bytes, startup disclosure order, and live piped output.
One isolated stderr test covers bounded retention, overflow draining and notice, restoration, cleanup on drop, and shutdown with a retained writer.
All four tests pass. Seven unit mutations and two integration mutations fail on the behaviors above. Restoring the code makes the tests pass again.
I ran the relevant suites (
cargo test -p strands-box --all-features; baseline failure documented above).I ran
cargo fmt -p strands-box --checkandcargo clippy -p strands-box --all-targets --all-features.Demo
Screen.Recording.2026-11-09.at.10.48.59.AM.mov
Documentation
No guide changes. Commands and startup disclosures are unchanged.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.