Repository navigation
fix(server): preview, Device and tunnel streams stay open under unsafe no-auth - #225
Merged
Merged
Conversation
With T3CODE_UNSAFE_NO_AUTH=1 the server gives requests without a credential a session that has no stored row. SessionStore reads a missing row as a revoked session, so awaitInvalidation completes at once for it. The preview stream, the Device Hub proxy and the preview tunnel race their stream against that wait, so each one ends at once. The existing unsafe no-auth case now also waits on that session while a real session is revoked, and expects the wait to stay pending. It fails until the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e no-auth SessionStore now owns the unsafe no-auth session id, and awaitInvalidation never completes for it. EnvironmentAuth uses that id. The ws.ts guard that skipped the race for the RPC socket is removed, so that hunk is upstream's text again, and every caller of awaitInvalidation, new upstream callers too, keeps the unsafe session open. Authenticated sessions keep upstream's revocation, expiry and DPoP renewal checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
1 task
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.
This pull request makes the Browser viewer, the Device stream and the preview tunnel work again on a server started with
T3CODE_UNSAFE_NO_AUTH=1.改了什么行为
Behaviour change: no. On a server started with
T3CODE_UNSAFE_NO_AUTH=1, the right-panel Browser viewer, the Device stream and the preview tunnel stay open again, as before upstream pingdotgg#37871. Servers with normal sign-in do not change.Why
Unsafe no-auth mode gives requests without a credential a session with no stored row. Upstream pingdotgg#37871 and pingdotgg#37947 end these streams when
SessionStore.awaitInvalidationcompletes, and that wait reads a missing row as a revoked session, so it completed at once.SessionStorenow owns the unsafe session's id and never ends its wait. This covers every caller, new upstream ones too, so the RPC socket's own guard inws.tsis removed.Checks
How to undo
Revert both commits. No stored data changes.
Checks in detail
T3CODE_UNSAFE_NO_AUTH=1, opening the right-panel Browser: before, three 204 handshakes and no frames; after, one 101 handshake and frames. A WebSocket to the preview tunnel: before, closed right after its upgrade; after, still open after 3 s.vp run check:changedpasses (format, lint, knip, typecheck, the tests beside the change).