Repository navigation
refactor(auth): keep published store lookup passive - #200185
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR separates passive shared-auth ownership lookup from asynchronous database preparation and native inspection. Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored refactor preserves the existing ownership contract, with no confirmed patch defect; current-head CI failures remain unattributed. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAuth lifecycle callers prepare or reload ownership from machine state, publish it into one process-wide map, and synchronous readers consume that fact to select the shared credential database. flowchart TD
A[Auth lifecycle callers] --> B[Async preparation]
B --> C[Shared state worker]
C --> D[Published ownership map]
E[Native inspection and preparation] --> D
D --> F[Passive path readers]
Technical reviewBest possible solution: Retain the single passive ownership owner and separated preparation modules, then resolve the current-head CI disposition before landing. Do we have a high-confidence way to reproduce the issue? The base and fetched-main imports directly establish the coupled dependency boundary; no target code was executed during this read-only review. Is this the best way to solve the issue? The module split is a focused solution that preserves the existing state owner, storage contract, synchronous SDK adapters, and lifecycle behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f4fa17a710be. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests +79, Other 0. Total +82 across 67 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 16, 2026, 1:04 PM ET / 18:04 UTC. |
|
Baseline-Refresh: e7307a2e7da090908bccbb3c1be5eac1a0e1e479
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…hausted (#154631) Clear a saved usage-limit block when the Codex usage response matches the account and user and reports available purchased credits. Preserve separate quota deadlines, model restrictions, and spending caps. Co-authored-by: daniel-lxs <[email protected]> (cherry picked from commit f12c0cf) Follow-ups: b17f897 fix: stop switching models when a session entry changes during a turn (#208480) [not selected for this narrow backport]; f84b705 fix: preserve lower-token guidance for unaffordable requests (#201392) [not selected for this narrow backport]; 7b0b2e3 refactor(auth): keep published store lookup passive (#200185) [not selected for this narrow backport]; 7771d3e fix: let a fallback model finish after Code Mode reads [not selected for this narrow backport]; 86ca412 fix: show the saved quota reset when chat skips its only model (#207210) [not selected for this narrow backport] Co-authored-by: RomneyDa <[email protected]>
…#206285) * test(secrets): cover metadata discovery for plugin config values * perf(secrets): skip plugin metadata for entries without config values (cherry picked from commit 5f0743a) Companion audit: #200185 separates passive credential lookup; no dependency on entry-config scan or origin inventory lifecycle. Co-authored-by: RomneyDa <[email protected]>
…workspaces (#207277) A chat can require an OpenAI access program that the account offers. When that chat's session is bound to a managed worktree, turns that run in the worktree (for example, a subagent reporting back to its parent) were refused before any model request with "This … program is not advertised for the current account, model, and runtime". The same account in the same chat passed for ordinary messages. Users saw subagent results fail to come back. Turns that run in a workspace other than the agent's main one (managed worktrees, child sessions, cron jobs with a workspace, compaction with a requested workspace) now see the same account facts as the main workspace. The access check is unchanged: a program is still allowed only when the account's current credential advertises it, and no request reaches a model without it. The facts an account is offered (`providerOutcomes`) belong to the agent and its credential, not to a directory. They live in the prepared catalog inventory, and every inventory row is already guarded per provider: a source fingerprint (provider config including the resolved key, the providing plugins' versions and install hashes, auth profiles and order, env) plus the credential identity. But the inventory was stored per catalog owner, and owners are keyed by workspace because a workspace can add plugins. So an owner for a second workspace started empty, and in static mode (turns never rediscover) it had no account facts. Only `chat.send` avoided this, because it deliberately prepares its catalog from the main workspace. Now a non-configured owner is offered the configured owner's inventory for the same agent, and the existing retention guards decide which rows hold for its own config and credentials. The seed is used only when the plugin set matches exactly (a workspace plugin could otherwise provide the same provider id with different code). The owner key, plugins and models stay per workspace. The seed applies at retention time, so a rejected seed does not hide the provider's generated models. Named edges, not coded: - If the configured owner has recorded discovery failures, a seeded worktree run owner retries that discovery until its lease ends. - Before the configured owner's first discovery, or right after a provider config or sign-in change and before rediscovery completes, a worktree turn can still be refused. A main-workspace turn recovers on rediscovery. This is not a regression. - New `prepared-model-runtime.workspace-inventory.test.ts`. Each case prepares the worktree turn with the dispatch's plugin generation, as report turns are prepared. The entitlement is keyed by account and credential identity: - `gives a worktree run with the same direct key only the account facts of its own credential` and `… with the same stored account …` see the main workspace's outcomes. Both fail on the merge base (`[]`). - `… with a different direct key …`, `… with a second stored account …` and `… with a signed-out credential …` inherit nothing. - `drops the account facts on the next worktree turn after the credential rotates`: after a sign-in change, a turn pinned to the old generation is refused ("superseded"), and the next turn sees no old-account facts. - The negative cases pass on the merge base by construction, since it never shares facts. With the retention credential guard disabled, the second-account, signed-out and rotation cases fail. The direct-key case is caught separately by the provider-config fingerprint, which includes the resolved key. - Real in-process Gateway fixture (synthetic HTTP only; not committed because it clones the repository): `chat.send` and then a requester-settle completion into a parent bound to a real managed worktree. Merge base: the ordinary turn passes and the completion is refused (`OPENAI_ACCESS_PROGRAM_UNAVAILABLE`, not advertised). This branch: both pass. The worktree-bound `chat.send` turn passes on both. - Prepared model runtime, prepared model catalog and access-program suites plus every direct importer of the changed files: 64 files, all pass, re-run after merging current main. - `findConfiguredOwnerCandidates` moved unchanged to `prepared-model-runtime.configured-owner.ts` so the owner module stays within its line cap. - Production (read-only): every refusal of this kind came from a session bound to a managed worktree. Each worktree was created minutes to hours before the first refusal, and none of those sessions ever had a successful report. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 3b899c3) Follow-ups: 7b0b2e3 refactor(auth): keep published store lookup passive (#200185) [not selected for this narrow backport] Release adaptation: Use the shared configured-owner resolver and inventory seed while preserving stable publication imports and account/provider fences. (cherry picked from commit 740a1a4a0ce093185bdcf1b1f024d3d3dbabc16f) Companion audit: 7b0b2e3 is broader passive auth-store refactoring, not required; focused inventory and retention gates pass on stable publication owners. Co-authored-by: RomneyDa <[email protected]>
* refactor(auth): keep published store lookup passive * test(auth): observe the active shared store owner * fix(auth): route current consumers to the shared store owners
What Problem This Solves
Reading already-published shared auth ownership currently imports database preparation and inspection code, even when the caller only needs the existing in-memory fact.
User Impact
No intended user-visible behavior change. Auth selection, storage, schema, configuration and permissions stay the same. This change establishes a passive auth lookup boundary; it does not claim an RSS reduction or complete the wider passive catalog-read refactor.
Why This Change Was Made
Keep the existing global ownership map and synchronous readers in their current owner. Move asynchronous preparation/reload into a small active module, and native inspection into the existing native module. Internal callers import the owner they actually use; retired internal exports are removed.
The same map, exact database-path keys, published object identity, and cold-publication limit remain. Admission capture still occurs before the first await; pending reads retain the existing currentness check and committed-owner recheck. Explicit commits and reloads are not newly capped. Filesystem fixtures move unchanged into their existing test-support module to satisfy the test-file line cap.
On the original change, production grew by three net lines and tests/support by 79. Benchmark code had zero net growth.
Evidence
66f0126c93ee72c9b8fb4814cf89e84481bdb081integrates frozen main8ac87d6697d196fb2a6c8d4bccfcc277caef7e04. Four existing consumers now import the passive, asynchronous or native owner they use. Main’s TUI entry points are preserved.6f5d3b399b31855501cc3f38f1221f7165554c59, the initial head3fdbed9e9ef746fc004f95be1cd7f544809bb799, and the preceding signed head1086709b6faceb428a1870d2807c174151998fda. Formatting, commit-hook ratchets andgit diff --checkpassed there.src/secrets/use diff context because the native extra-source policy refuses that directory; their full bodies were reviewed independently and are unchanged.3fdbed9on Node 24.22.1. Verified passes include both new auth boundary tests (within 34 boundary cases), 11 direct ownership cases, asynchronous bootstrap, real model-auth publication, 29 agent-creation cases, 92 agent-mutation cases, and 110 reload cases. Production and build inputs were unchanged in the test-only correction1086709. Its ordinary PR CI is recorded below.3fdbed9. The resulting runtime artifact (SHA-256264a2c4eb9e39c569f675ff4b6d6c4bfa1dbbf72524f8826c3b88b7948a32fec) binds that exact source. The passive owner's complete emitted relative static closure contains 39 chunks and excludes active auth/database loaders; its external fs-safe paths were checked at pinned 0.27.1. This is static compiled-boundary evidence, not an executed compiled-lifetime or RSS claim. The separate Docker seed job ranscripts/build-all.mtson3fdbed9, including cache-miss unified declaration emission and the complete build. Its laternpm pack --ignore-scriptsstep timed out after 900 seconds, so the packaging/Docker job failed; the timeout cause remains unknown. Declaration proof carries to1086709because production and build inputs are unchanged. There is no new dedicated commit-during-read or pre-await-capture race witness.Node CI on the initial head: https://github.com/openclaw/openclaw/actions/runs/43917795521. Its preflight confirms the exact
3fdbed9checkout and Node 24.22.1. It found a stale namespace in the real model-auth concurrency test: the captured function and spy still referenced the passive module after the function moved. Commit1086709retargets only those test references and keeps the passive path lookup, barrier, rotation assertions and cleanup unchanged. A separate source review of that correction is scoped-clean with no findings.The ordinary PR CI for
1086709selected merge9f97cab1923938a22473e456dab9a0c924010baa, with ordered parents4a74c61ae7c438587bc272840d180d16f7c5a283and1086709b6faceb428a1870d2807c174151998fda. The state-logging type graph passed. The corrected SQLite model-auth worker suite ran and passed all 16 cases on this PR integration. Its test log includes all six cached/publication concurrency combinations, concurrent unrelated-order changes, and both snapshot and native-owner rotation receipt cases. The ordinary CI aggregate remains red on three other jobs. Exact-head ClawSweeper review reports no findings or before-merge items.Three jobs failed on that earlier integration.
SessionMutationAuthorizationChangedError. The log does not identify the originating RPC or failed authority fact. The unchanged case passed in 26.856 seconds on the historical base and 28.932 seconds on the tested integration. Both isolated runs used the same Linux runner class, toolchain and process-local umask of 0022. Neither isolated run reproduced the full-shard failure. The identical test and error also occurred in two independent hosted builds, 005057b6 and 479a4b5a, with the original passive-owner code. The failing RPC is still unidentified.agents.deletedeadline in the fresh-revision create/update/delete case. The other 66 cases passed. Scheduled main independently failed at the same RPC in the same Bun shard. Its test, fixture and delete handler match the historical PR base byte for byte. Neither log identifies the stalled phase.All three historical failure signatures also occurred outside this PR. The new integrated head has completed local qualification and independent source review. Its hosted gates remain pending. No retry, timeout increase or assertion weakening was applied. Initial-head supporting behavior/build results remain distinct from current-head validation; neither full CI run is claimed green. The historical native backend executed no producer and its allocation custody remains UNKNOWN. The 334 local passes above used a separately qualified frozen install on the new head.