Repository navigation
fix(gateway): record Tailscale Control UI sources without a paired browser key - #204388
Conversation
…owser key Tailscale Serve skips Control UI pairing, so a browser presents a device key that is never paired. Capture refused a durable source for it, the session never recorded the person's source, and a restart wake (durable exec completion) for that chat was refused with "Session principal has no current run authority." A new message from the same person was admitted. An unpaired key is not part of that grant: record it like a device-less Tailscale source, which restore checks against the current identity grant. Co-authored-by: obviyus <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
E2E evidence, head verdict.json{
"pass": true,
"prefix": "HEAD",
"sessionKey": "agent:main:one-admission-c53ba0c1",
"models": [
"gpt-5.5-2026-04-23",
null
],
"relayStatuses": [
200,
421
],
"checks": [
{
"id": "R.running-turn-finishes",
"pass": true,
"detail": {
"state": "final",
"toolEnds": 3,
"toolEndsAfterRevoke": 3
}
},
{
"id": "Q.queued-input-refused-visibly",
"pass": true,
"detail": {
"accepted": true,
"providerRequestsWithQueuedMarker": 0,
"visibleRefusalInTranscript": true
}
},
{
"id": "S.stop-cancels",
"pass": true,
"detail": {
"abort": {
"ok": true,
"aborted": true,
"runIds": [
"b5bfbe72-52d5-4880-ba39-24abb31c8d83"
]
},
"state": "aborted",
"requestsWithStopMarker": 1
}
}
],
"elapsedMs": 61266
}```
</details>
results.jsonl: 28 lines, kept with the private run receipts. |
|
Maintainer override: the only red on head
This PR changes only
|
|
Landed as efaeb85. Bug: a durable exec completion after a Gateway restart was refused for Tailscale Control UI chats, because an unpaired browser key blocked recording the person's source. Fix: record such sources like device-less Tailscale sources (production -3). Proof: a test that is red on base and green on head, E2E Q/R/S pass, local review clean; the only red was MAIN-ALSO |
…owser key (openclaw#204388) Tailscale Serve skips Control UI pairing, so a desktop browser presents a device key that is never paired. Recovery-source capture refused a durable source for that key. The session never recorded the person's source, and after a Gateway restart a durable exec completion wake was refused with "Session principal has no current run authority." A new message from the same person was admitted. The fix deletes the unpaired-key refusal (production -3). Such a source is recorded like a device-less Tailscale source, and restore checks it against the current identity grant. Paired keys are still re-checked. Proof: a test that is red on base and green on head (new message admission -> record -> session-principal wake); the one-admission E2E passes Q/R/S on the head; local review is clean. Co-authored-by: Ayaan Zaidi <[email protected]>
…owser key (#204388) Tailscale Serve skips Control UI pairing, so a desktop browser presents a device key that is never paired. Recovery-source capture refused a durable source for that key. The session never recorded the person's source, and after a Gateway restart a durable exec completion wake was refused with "Session principal has no current run authority." A new message from the same person was admitted. The fix deletes the unpaired-key refusal (production -3). Such a source is recorded like a device-less Tailscale source, and restore checks it against the current identity grant. Paired keys are still re-checked. Proof: a test that is red on base and green on head (new message admission -> record -> session-principal wake); the one-admission E2E passes Q/R/S on the head; local review is clean. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit efaeb85)
Problem
A durable
exec(background) completion that ends after a Gateway restart wakes its chat as a session-principal system turn. For a person who uses the Control UI through Tailscale Serve on a Gateway without named roles, that wake was refused withSession principal has no current run authority.. The completion never reached the chat (exec: completion delivery failed). A new message from the same person in the same chat was admitted.Root cause
session-operator-sources.ts:recordSessionOperatorSourceon eachchat.send,restoreSessionOperatorSourceon the wake). If no source was recorded and the profile has no role,readScopesrefuses.connect-policy.ts:shouldSkipControlUiPairing→"tailscale-device"). So a desktop browser presents a device key that is never paired.captureGatewayOperatorRecoverySnapshotlooks up that key in the pairing store for tokenless proxy/Tailscale sources. If it found no row, it returnedunavailableReason: "device-no-token". So every message from such a browser had no recovery snapshot, and the session never recorded a source.tailscalewith nodevice. The affected chat (used only from a desktop browser) had nooperatorSourcesat all, after 12 prompts.The brief's hypothesis (an OpenClaw ID linked-owner device,
isLinkedOwnerDevice) is disproved: OpenClaw ID is disabled on that Gateway. The person connects with Tailscale identity auth.Change
Delete the
sourceDevice && tokenlessIdentity && !devicerefusal (production −3). A tokenless Tailscale/proxy source whose key has no pairing row is recorded like a device-less Tailscale source, as #202513 already specified: "Device-less proxy/Tailscale scopes use the current grant." Restore checks the auth method, identity grant and browser origin against the current config, the same checks a new connection gets. A paired key is still recorded and still re-checked (revoke/remove → refused). A pairing-store read failure still yields no snapshot.No new flag, token, stored field or guard.
What the user sees
A durable exec that finishes after a Gateway restart now posts its completion turn to a Tailscale Control UI chat, as it did before the restart. A person with no recorded source and no role is still refused (unchanged;
admits an untiered person's session work only through their recorded, current source).Accepted edge case
A trusted-proxy Control UI key removed from pairing between connect and the first
chat.sendadmission records a device-less source. Removing a device invalidates its live sockets, and admission checksclient.invalidated, so this needs a race inside one request.Why not Tailscale-only
A tokenless trusted-proxy key has no pairing row at capture only when (a) its connection skipped pairing (
skipLocalBackendSelfPairing), so its live admission did not depend on pairing either, or (b) the device was removed after connect. Removal invalidates its sockets (invalidateClientsForDevice→readGatewayDeviceSourceAuthority), so admission refuses before capture. In both cases a device-less record admits the wake exactly when a new message would be admitted. Limiting the change to Tailscale would need a newauthMethodguard, so I did not add one.Tests
session-operator-sources.test.ts› "admits a restart wake for a Tailscale Control UI person whose browser key was never paired". It admits a new message throughprepareGatewayOperatorRunAuthority, records it withrecordSessionOperatorSource, then admits the wake withprepareSessionPrincipalRunAuthority({ sessionPrincipal: true }). Base fails at the wake withSession principal has no current run authority.; disabling Tailscale auth still refuses the wake.bash-process-durable-notify.test.ts: unchanged. It covers only target preparation (prepareAdoptedDurableProcessNotification), which never reaches admission, so changing its principal could not catch this.Evidence
ocx testcall, 12 files (touched + importers of the changed source + test-support importers): 410 tests passed. Typecheck core + core tests, oxfmt and oxlint pass.check:changed: only the dead-export scan fails, onui/src/pages/chat/components/chat-read-aloud-status.tsx(not in this diff).one-admission-e2e/run.shon head780f7d648c7e: Q (queued input refused visibly), R (running turn finishes), S (Stop cancels) all pass. Theverdict.jsonandresults.jsonlare attached below.Follow-up (not in this PR)
The exec outcome should be written to the session history before the wake, so a refused or failed wake cannot lose it. This needs more than the admission fix; it belongs to the owed-result slice (W4, #204265).