Repository navigation
[RT-SW-399] fix: contender stderr redacts a handoff ticket the tail cut or the pipe end splits - #404
Merged
Conversation
…pe end splits (#399) The contender cut its stderr to the final 8 KiB before redacting, and matched whole tickets only, so a ticket straddling the cut kept its suffix in Stderr and in failure messages. The raw tail now keeps one ticket length of slack before the rendered 8 KiB, tickets are matched in bytes before decoding, and a ticket the pipe ended inside is redacted as the prefix it is.
This was referenced Oct 16, 2026
[TST-E7] test: Tools test helpers, fixtures and mirrored tests live in the slice that uses them
#406
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The background-service contender's stderr tail no longer carries any part of the PTY-handoff ticket. That includes a ticket split by the 8 KiB cut, and a ticket the pipe ended inside.
Closes #399.
Cause
ServiceContendercut the raw stderr to its final 8 KiB first (AppendTailLocked). Only then did it redact the ticket from the cut tail (RenderStderrLocked→RedactTicket), and only whole occurrences. When a ticket straddled the cut, the part left inside the tail no longer matched, so it stayed unredacted inStderrand in the contender's failure messages (OpenCodeServerException).The change
[redacted], and only then are the bytes decoded and trimmed.Upstream
At the pin (
external/opencode042d083), upstream's contender does not have this bug, because it redacts nothing:packages/client/src/service-contender.ts:28-34(onStderr) keeps the last 8 KiB raw;:48(stderr()) returns it trimmed;:124/:126put it verbatim intostartupError(:136-138,new Error(message + "\n" + stderr)).The ticket travels as
OPENCODE_PTY_HANDOFF = JSON.stringify(handoff)(packages/client/src/pty-handoff.ts:77). The server deletes it from its own environment at startup (packages/cli/src/server-process.ts:48-49). Upstream's exposure therefore rests on a child that never echoes the ticket.The SDK's masking is its own stricter floor (ADR-0028's principle: secrets never reach diagnostics), and this PR closes a gap in that floor; it is not a parity change. Not reported upstream (maintainer, 2026-10-17).
Behaviour
Diagnostics only. A contender failure message or
Stderrread no longer shows a fragment of the ticket. Everything else is unchanged.The CHANGELOG has an entry under 🐛 Fixes.
Proof
ServiceContenderTests.cs, uses an in-memory stderr, so the drain finishes inside the constructor and every verdict is decided before the first assertion. On the unchanged code, four of its first six rows failed on net10.0 and net472: the cut falling at 1, 13 and 64 of the ticket's 65 bytes, and the pipe-ended case. The whole-ticket and no-ticket rows were green.verify-cloneswith 0 new.windows-gate.ps1 -Part all -NoNativeAoton54b47ea2, this branch on masterd13d9833): slopwatch, build, both format passes, clone-detector, verify-clones, 10,013 tests including net472 with 0 failed, election.Need help on this PR? Tag
@codesmith-botwith what you need.