Repository navigation
chore(auth): cover OAuth retries through real Gateway connections - #162020
Conversation
|
🦞👀 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. |
|
Codex review: blocked before merge. Reviewed September 30, 2026, 1:54 PM ET / 17:54 UTC. ClawSweeper reviewWhat this changesExtends the Gateway first-sign-in integration test to check owner-specific OAuth retries, model activation, and rejection of a queued retry after device-token revocation. Merge readiness⛔ Blocked before merge - 2 items remain The merged retry change supplies the production behavior, but current main does not have this WebSocket authority regression coverage. The added test remains useful; its focused execution has not been observed. Priority: P2 Review scores
Verification
How this fits togetherGateway Model Setup receives authenticated WebSocket requests and runs provider sign-in through a setup wizard. Successful setup stores credentials and selects a model; device-token revocation can invalidate a request waiting for an earlier sign-in to finish. flowchart LR
A[Gateway clients] --> B[Authenticated WebSocket requests]
B --> C[Setup admission]
C --> D{Owner and token still valid?}
D -->|Yes| E[Provider sign-in and model probe]
E --> F[Saved credentials and model]
D -->|No| G[Rejected retry without new effects]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +167. Total +167 across 1 file. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the focused real-WebSocket regression in the existing fixture once its owner, revocation, and persisted-effect assertions pass with measured runtime. Do we have a high-confidence way to reproduce the issue? Not applicable as a new bug report: the production retry fix is merged, and this PR adds coverage for it. The proposed test has not completed a run. Is this the best way to solve the issue? Yes in design: extending the existing Gateway fixture reaches the WebSocket and setup lifecycle that narrower handler tests cannot cover. Its execution and cost still need verification. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against bf7429ce730b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
## What Problem This Solves Finishes four small helper cleanups found during the maintainer-requested eighth config sweep. ## User Impact No user-visible change. Config schemas, defaults, environment handling, migration decisions, refusal order, and persisted session keys stay the same. ## Why This Change Was Made - Remove the unused `DiscoveryToggleConfig` type left after its model discovery fields were retired. It has no repository consumers or public SDK export; the still-used Bedrock type remains. - Re-export the docs baseline functions directly through the existing lazy runtime facade, preserving names and dependency order. - Let the canonical main-session-key builder perform main-key normalization once. - Classify cron ownership once instead of allocating two filtered arrays and repeating the same lookups. Production diff: 23 added / 40 removed, **17 net lines removed**. No tests changed. ## Evidence - Independent review found no actionable P0-P2 findings. - Blacksmith Testbox `tbx_01m3sxdrf1qfe6fc408sjgf0bf`, [run 36767521248](https://github.com/openclaw/openclaw/actions/runs/36767521248), verified the four source hashes against base `3c0ae56c634e664ff12cfc2664bcdb9cf330ce5f`. - 63 tests passed across docs baseline, cron ownership, session key, session path, and filesystem import-boundary suites. - Generated config docs hashes/counts, core typechecking, and changed-file lint passed. - Both import-cycle checks reported zero cycles. - No schema, generated snapshots, dependencies, or protected SQLite accessor files changed. ### Config compatibility assessment The review's requested compatibility assessment is complete. This changes no schema, default, environment variable, migration marker, redaction rule, or stored format. The docs facade exposes the same five operations in the same dependency order. Main-key normalization remains with `buildAgentMainSessionKey`, which already calls `normalizeMainKey`; persisted keys are unchanged. Cron classification preserves both predicates, counts, refusal order, and the existing repair/recheck path. The removed type has no consumers and is absent from public SDK exports. No updater or live-upgrade execution is claimed. ### Exact-head hosted CI [Run 36769831270](https://github.com/openclaw/openclaw/actions/runs/36769831270) completed on `91162736eeb2b9660af6c7c48ab32438ed70c23a`: 143 jobs passed, 22 skipped, two test jobs failed, and the CI gate failed downstream. Security-fast, dependency review, security-sensitive review, all selected types/lint/build checks, and architecture checks passed. `checks-node-changed-compact-large-26` ([job 110073528939](https://github.com/openclaw/openclaw/actions/runs/36769831270/job/110073528939)) fails `setup-inference.first-signin.integration.test.ts:420:38`: expected `confirm`, received `note`, in the same-owner sign-in/revoked-retry case. The identical failure is present on unrelated PR #162093, head `be4f3855425d239b494f77e308881b2b0c7a3157`, [run 36769218900 / job 110071456815](https://github.com/openclaw/openclaw/actions/runs/36769218900/job/110071456815). That PR changes only `src/agents/apply-patch-paths.ts`. The assertion was introduced by #162020, which is already this PR's base; no Gateway/authentication source or test changes here. `checks-node-changed-compact-small-4-1` ([job 110073535262](https://github.com/openclaw/openclaw/actions/runs/36769831270/job/110073535262)) fails `server.catalog-startup.test.ts:86:3`, “starts with provider settings without model rows when a channel is auto-enabled,” with `Test timed out in 90000ms`. The same case/error appears in the latest CI for unrelated PR #160471's still-current head `f007e2c16e02455a3ace3d5e803af02bccac4130`: [September 28 run 36428787158 / job 108950748546](https://github.com/openclaw/openclaw/actions/runs/36428787158/job/108950748546). This is independent current-PR evidence, not a claim that the latest hourly main reproduced the timeout. The docs facade is only loaded by docs baseline generation, the removed type has no runtime effect, and the session helper still applies the same canonical normalization. The cron change only combines synchronous classification; it adds no await, retry, startup operation, or changed refusal decision. The startup fixture has no legacy cron jobs. Gateway/catalog/auth source and both failing tests are unchanged by this PR. These inherited failures remain with the main-CI coordinator; no retry, timeout increase, assertion change, or main repair is included. The maintainer-authorized exception is pinned to the exact tested head and does not describe the hosted run as green. The catalog-startup test has identical Git blob `d60a895ece760b2cfb5f066acf0787a8a2ee4f11` at this PR's base/head and the independent PR head above.
Use the host-supplied reconnect inventory instead of reopening ambient auth state. Carry the selected credential through the shared token decoder and retain current-caller checks around awaited reuse work. Preserve the separate noninteractive CLI behavior. Keep the Gateway retry and revocation regression unchanged; it exposed a supplied profile being ignored after first sign-in. Cover empty, unrelated, and supplied inventories plus exact SecretRef reuse and revoked callers. Split interactive auth tests into their owner module to preserve the line-cap guard and all assertions. Related: #162020
Fix red main exposed by 3c0ae56 (#162020), which added real Gateway retry coverage. Bisect confirms its parent passes and that commit first fails because the expected existing-account confirmation becomes a login note. Setup already supplies the saved profile, but Copilot's separate runtime store lookup sees none. Use the host-authorized existingProfiles contract introduced by 67fd7e9 for selection and resolve the selected credential's SecretRef directly. Preserve same-tenant reuse, forced login on tenant changes, and the unchanged first-signin integration assertions. Extend the provider cases for authorized re-login, reference-backed reuse, and absent/empty candidate lists. All four regressions fail on the old owner. Remove the retired TTY fixture and consolidate assertions without increasing the test file's counted lines. Validation: exact first-signin integration 3/3 passes; 277 sibling tests in 18 files; 56 provider tests (22.14s wall with one worker); core typecheck; changed-file checks; formatting and git diff --check. Independent autoreview through P1 completed before commit.
Fix red main exposed by 3c0ae56 (#162020), which added real Gateway retry coverage. Bisect confirms its parent passes and that commit first fails because the expected existing-account confirmation becomes a login note. Setup already supplies the saved profile, but Copilot's separate runtime store lookup sees none. Use the host-authorized existingProfiles contract introduced by 67fd7e9 for selection and resolve the selected credential's SecretRef directly. Preserve same-tenant reuse, forced login on tenant changes, and the unchanged first-signin integration assertions. Extend the provider cases for authorized re-login, reference-backed reuse, and absent/empty candidate lists. All four regressions fail on the old owner. Remove the retired TTY fixture and consolidate assertions without increasing the test file's counted lines. Validation: exact first-signin integration 3/3 passes; 277 sibling tests in 18 files; 56 provider tests (22.14s wall with one worker); core typecheck; changed-file checks; formatting and git diff --check. Independent autoreview through P1 completed before commit.
…enclaw#162020) * chore(auth): cover OAuth retries through real Gateway connections * chore(auth): avoid shadowing the wizard result in retry test
## What Problem This Solves Finishes four small helper cleanups found during the maintainer-requested eighth config sweep. ## User Impact No user-visible change. Config schemas, defaults, environment handling, migration decisions, refusal order, and persisted session keys stay the same. ## Why This Change Was Made - Remove the unused `DiscoveryToggleConfig` type left after its model discovery fields were retired. It has no repository consumers or public SDK export; the still-used Bedrock type remains. - Re-export the docs baseline functions directly through the existing lazy runtime facade, preserving names and dependency order. - Let the canonical main-session-key builder perform main-key normalization once. - Classify cron ownership once instead of allocating two filtered arrays and repeating the same lookups. Production diff: 23 added / 40 removed, **17 net lines removed**. No tests changed. ## Evidence - Independent review found no actionable P0-P2 findings. - Blacksmith Testbox `tbx_01m3sxdrf1qfe6fc408sjgf0bf`, [run 36767521248](https://github.com/openclaw/openclaw/actions/runs/36767521248), verified the four source hashes against base `c3dd660f699728d5ba714e447f8484590d085f5d`. - 63 tests passed across docs baseline, cron ownership, session key, session path, and filesystem import-boundary suites. - Generated config docs hashes/counts, core typechecking, and changed-file lint passed. - Both import-cycle checks reported zero cycles. - No schema, generated snapshots, dependencies, or protected SQLite accessor files changed. ### Config compatibility assessment The review's requested compatibility assessment is complete. This changes no schema, default, environment variable, migration marker, redaction rule, or stored format. The docs facade exposes the same five operations in the same dependency order. Main-key normalization remains with `buildAgentMainSessionKey`, which already calls `normalizeMainKey`; persisted keys are unchanged. Cron classification preserves both predicates, counts, refusal order, and the existing repair/recheck path. The removed type has no consumers and is absent from public SDK exports. No updater or live-upgrade execution is claimed. ### Exact-head hosted CI [Run 36769831270](https://github.com/openclaw/openclaw/actions/runs/36769831270) completed on `91162736eeb2b9660af6c7c48ab32438ed70c23a`: 143 jobs passed, 22 skipped, two test jobs failed, and the CI gate failed downstream. Security-fast, dependency review, security-sensitive review, all selected types/lint/build checks, and architecture checks passed. `checks-node-changed-compact-large-26` ([job 110073528939](https://github.com/openclaw/openclaw/actions/runs/36769831270/job/110073528939)) fails `setup-inference.first-signin.integration.test.ts:420:38`: expected `confirm`, received `note`, in the same-owner sign-in/revoked-retry case. The identical failure is present on unrelated PR openclaw#162093, head `be4f3855425d239b494f77e308881b2b0c7a3157`, [run 36769218900 / job 110071456815](https://github.com/openclaw/openclaw/actions/runs/36769218900/job/110071456815). That PR changes only `src/agents/apply-patch-paths.ts`. The assertion was introduced by openclaw#162020, which is already this PR's base; no Gateway/authentication source or test changes here. `checks-node-changed-compact-small-4-1` ([job 110073535262](https://github.com/openclaw/openclaw/actions/runs/36769831270/job/110073535262)) fails `server.catalog-startup.test.ts:86:3`, “starts with provider settings without model rows when a channel is auto-enabled,” with `Test timed out in 90000ms`. The same case/error appears in the latest CI for unrelated PR openclaw#160471's still-current head `f007e2c16e02455a3ace3d5e803af02bccac4130`: [September 28 run 36428787158 / job 108950748546](https://github.com/openclaw/openclaw/actions/runs/36428787158/job/108950748546). This is independent current-PR evidence, not a claim that the latest hourly main reproduced the timeout. The docs facade is only loaded by docs baseline generation, the removed type has no runtime effect, and the session helper still applies the same canonical normalization. The cron change only combines synchronous classification; it adds no await, retry, startup operation, or changed refusal decision. The startup fixture has no legacy cron jobs. Gateway/catalog/auth source and both failing tests are unchanged by this PR. These inherited failures remain with the main-CI coordinator; no retry, timeout increase, assertion change, or main repair is included. The maintainer-authorized exception is pinned to the exact tested head and does not describe the hosted run as green. The catalog-startup test has identical Git blob `d60a895ece760b2cfb5f066acf0787a8a2ee4f11` at this PR's base/head and the independent PR head above.
Fix red main exposed by c3dd660 (openclaw#162020), which added real Gateway retry coverage. Bisect confirms its parent passes and that commit first fails because the expected existing-account confirmation becomes a login note. Setup already supplies the saved profile, but Copilot's separate runtime store lookup sees none. Use the host-authorized existingProfiles contract introduced by 0d6ab3c for selection and resolve the selected credential's SecretRef directly. Preserve same-tenant reuse, forced login on tenant changes, and the unchanged first-signin integration assertions. Extend the provider cases for authorized re-login, reference-backed reuse, and absent/empty candidate lists. All four regressions fail on the old owner. Remove the retired TTY fixture and consolidate assertions without increasing the test file's counted lines. Validation: exact first-signin integration 3/3 passes; 277 sibling tests in 18 files; 56 provider tests (22.14s wall with one worker); core typecheck; changed-file checks; formatting and git diff --check. Independent autoreview through P1 completed before commit.
* fix(plugins): await activation health cleanup * fix(update): preserve Windows cancellation compensation Carry the reviewed residual from #162050 at db545dc while preserving canonical #161990 restoration forwarding. Keep forward admission strict and use the original restore authority only for failed-disable compensation and pre-stop cleanup. The original executor and native service checks remain intact. The owning exact-main controls fail before the repair; the composed original CLI and native recovery suites pass 30 cases under simulated win32 on Darwin. Full selected checks and independent review passed at the repair owner. This receiving cut preserves the four qualified postimages exactly; it makes no native Windows execution claim. * refactor(plugins): keep activation cleanup scope focused Canonical Windows restoration fixes already resolve the original CI blocker. Leave the distinct failed-DISABLE compensation and additional regressions solely with #162050 instead of carrying its independent product change here. Preserve all 40 qualified activation file contents and the canonical updater owners. * test(gateway): bound hot-reload failure diagnostics Record phase, queued-result and lifecycle scalars only when the existing reload fixture fails. Preserve all waits, assertions and cleanup while replacing full serialized model requests with bounded diagnostics. The original CI timeout remains unattributed; the larger-host Linux pass is negative reproduction, not a failure waiver. * fix(github-copilot): reuse host-authorized setup credentials Fix red main exposed by 3c0ae56 (#162020), which added real Gateway retry coverage. Bisect confirms its parent passes and that commit first fails because the expected existing-account confirmation becomes a login note. Setup already supplies the saved profile, but Copilot's separate runtime store lookup sees none. Use the host-authorized existingProfiles contract introduced by 67fd7e9 for selection and resolve the selected credential's SecretRef directly. Preserve same-tenant reuse, forced login on tenant changes, and the unchanged first-signin integration assertions. Extend the provider cases for authorized re-login, reference-backed reuse, and absent/empty candidate lists. All four regressions fail on the old owner. Remove the retired TTY fixture and consolidate assertions without increasing the test file's counted lines. Validation: exact first-signin integration 3/3 passes; 277 sibling tests in 18 files; 56 provider tests (22.14s wall with one worker); core typecheck; changed-file checks; formatting and git diff --check. Independent autoreview through P1 completed before commit. * test(plugins): supply authorized Copilot reuse profiles Keep the shared provider auth contract fixture aligned with the existing host-authorized profile input used by the canonical Copilot reconnect repair. Preserve its original credential, model and configuration assertions. This is the exact reviewed fixture-only handoff from the independent reconnect owner; its separate authority follow-up remains outside this change.
…law#161952) * fix(plugins): await activation health cleanup * fix(update): preserve Windows cancellation compensation Carry the reviewed residual from openclaw#162050 at db545dc while preserving canonical openclaw#161990 restoration forwarding. Keep forward admission strict and use the original restore authority only for failed-disable compensation and pre-stop cleanup. The original executor and native service checks remain intact. The owning exact-main controls fail before the repair; the composed original CLI and native recovery suites pass 30 cases under simulated win32 on Darwin. Full selected checks and independent review passed at the repair owner. This receiving cut preserves the four qualified postimages exactly; it makes no native Windows execution claim. * refactor(plugins): keep activation cleanup scope focused Canonical Windows restoration fixes already resolve the original CI blocker. Leave the distinct failed-DISABLE compensation and additional regressions solely with openclaw#162050 instead of carrying its independent product change here. Preserve all 40 qualified activation file contents and the canonical updater owners. * test(gateway): bound hot-reload failure diagnostics Record phase, queued-result and lifecycle scalars only when the existing reload fixture fails. Preserve all waits, assertions and cleanup while replacing full serialized model requests with bounded diagnostics. The original CI timeout remains unattributed; the larger-host Linux pass is negative reproduction, not a failure waiver. * fix(github-copilot): reuse host-authorized setup credentials Fix red main exposed by c3dd660 (openclaw#162020), which added real Gateway retry coverage. Bisect confirms its parent passes and that commit first fails because the expected existing-account confirmation becomes a login note. Setup already supplies the saved profile, but Copilot's separate runtime store lookup sees none. Use the host-authorized existingProfiles contract introduced by 0d6ab3c for selection and resolve the selected credential's SecretRef directly. Preserve same-tenant reuse, forced login on tenant changes, and the unchanged first-signin integration assertions. Extend the provider cases for authorized re-login, reference-backed reuse, and absent/empty candidate lists. All four regressions fail on the old owner. Remove the retired TTY fixture and consolidate assertions without increasing the test file's counted lines. Validation: exact first-signin integration 3/3 passes; 277 sibling tests in 18 files; 56 provider tests (22.14s wall with one worker); core typecheck; changed-file checks; formatting and git diff --check. Independent autoreview through P1 completed before commit. * test(plugins): supply authorized Copilot reuse profiles Keep the shared provider auth contract fixture aligned with the existing host-authorized profile input used by the canonical Copilot reconnect repair. Preserve its original credential, model and configuration assertions. This is the exact reviewed fixture-only handoff from the independent reconnect owner; its separate authority follow-up remains outside this change.
Related: #160574
What Problem This Solves
The OAuth retry fix needs integration coverage connecting real Gateway identity and device-token revocation to setup admission and persisted credentials.
User Impact
No production behavior changes. This follow-up changes one existing integration test.
Why This Change Was Made
Extend the first GitHub Copilot device-sign-in fixture to check that another owner cannot replace an active attempt, a matching owner can replace it and activate the model, and a revoked device cannot start a queued replacement after predecessor cleanup. Keep real WebSocket dispatch, setup lifecycle, model probing, and credential storage; provider HTTP responses remain synthetic.
The test reuses one Gateway startup and the existing 90-second deadline. Signal-aware gates release held work on test cancellation.
Evidence
git diff --checkpassed.node scripts/run-vitest.mjs src/gateway/setup-inference.first-signin.integration.test.ts --maxWorkers=1stopped before running tests because the preparation guard could not verify separation from managed Gateway artifacts (16.17 seconds). No guard was bypassed; before/after test timings are unavailable.