Skip to content

Guard more effectively against stdout truncation - #1520

Draft
Dom Giandinoto (daamenik) wants to merge 4 commits into
mainfrom
user/dgiandinoto/fix-stdout-potential-truncation
Draft

Dom Giandinoto (daamenik) wants to merge 4 commits into
mainfrom
user/dgiandinoto/fix-stdout-potential-truncation

Conversation

@daamenik

@daamenik Dom Giandinoto (daamenik) commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

📖 Description

Before this PR, we were draining stdout and stderr based on a fixed, short timeout, not based on the continuity of output. This PR adds a mechanism to allow for longer output draining based on if bytes are still coming in through the agent output read, checking for idle pipes periodically over a longer absolute timeout, and stopping before the timeout if no more data is coming through.

🔗 References

🔍 Validation

Verified that the IsoSession test suite passed (here)

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHub
Actions build; it runs on merge to main, and Microsoft reviewers with write access can trigger it
on a PR with /azp run. See pull request builds.

If the dependency-feed-check check fails on a new dependency, the crate must be added to
the feed before the PR can pass. See pull request builds
for the steps.

Microsoft Reviewers: Open in CodeFlow

Copilot AI balanced review requested due to automatic review settings October 16, 2026 23:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI 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.

🟡 Changes recommended

Synchronous warning delivery can block indefinitely on full stderr after bounded relay cleanup.

1 open issue
What changed in this PR

This PR reduces output truncation in IsolationSession relayed execution by extending draining while output continues.

Changes:

  • Track relay progress with idle and overall drain limits.
  • Report possible truncation through warnings.
  • Add drain tests and document cancellation limitations.
File Description
src/​mxc-sdk/​src/​core/​mxc_common/​process_util.rs Document cancellation-related data loss.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​state_aware.rs Forward relayed-execution warnings to stderr and test reporting.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​pipe_relay.rs Implement progress-aware draining and tests.
src/​mxc-sdk/​src/​backends/​isolation_session/​common/​manager.rs Integrate bounded draining into relay cleanup.
docs/​development/​architecture/​backends/​isolation-session/​state-aware-rust.md Explain drain limits and warning behavior.

Review effort: Balanced

Comment thread src/mxc-sdk/src/backends/isolation_session/common/state_aware.rs Outdated
Copilot AI balanced review requested due to automatic review settings October 20, 2026 17:50

Copilot AI 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.

🟡 Changes recommended

Synchronous CLI and diagnostic warning delivery can still block indefinitely despite the bounded drain logic.

3 open issues
1 resolved since last review

Review effort: Balanced

Comment thread src/mxc-sdk/src/backends/isolation_session/common/manager.rs Outdated
Comment thread src/mxc-sdk/src/backends/isolation_session/common/one_shot.rs Outdated
Comment thread src/mxc-sdk/src/backends/isolation_session/common/pipe_relay.rs Outdated
Copilot AI balanced review requested due to automatic review settings October 20, 2026 20:33

Copilot AI 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.

🔵 Needs a closer look

Windows-specific cancellation and teardown behavior needs runtime validation and final human review.

2 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 20, 2026 21:22

Copilot AI 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.

🔵 Needs a closer look

Windows-specific relay timing and cancellation still require runtime validation before approval.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@daamenik
Dom Giandinoto (daamenik) marked this pull request as ready for review October 20, 2026 22:12
@daamenik
Dom Giandinoto (daamenik) requested a review from a team as a code owner October 20, 2026 22:12
@daamenik
Dom Giandinoto (daamenik) marked this pull request as draft October 20, 2026 22:35
@daamenik
Dom Giandinoto (daamenik) force-pushed the user/dgiandinoto/fix-stdout-potential-truncation branch from f8eb145 to d7b90bb Compare October 20, 2026 22:36
Copilot AI balanced review requested due to automatic review settings October 20, 2026 22:36

Copilot AI 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.

🟡 Changes recommended

The fix needs a scheduled backend regression verifying complete output during prolonged post-exit draining.

1 open issue

Review effort: Balanced

Comment on lines +1097 to +1101
let output_drain = drain_output_relays_within(
&output_relays,
Duration::from_millis(Self::IDLE_MS),
Duration::from_millis(Self::ABSOLUTE_CAP_MS),
)

This branch has not been deployed

No deployments
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.

2 participants