Repository navigation
refactor(agents): consolidate session auth selection behind prepared-facts facade - #126084
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 7:44 PM ET / 23:44 UTC. ClawSweeper reviewWhat this changesThis PR replaces direct session-profile rotation calls with a shared selection result that carries profile source and route requirements into inference, reply, background-question, and cron flows. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open for maintainer scope review: current main already fixes the central route-rotation regression, while this maintainer-labeled PR conflicts with that fix and proposes a broader auth-selection refactor whose distinct value needs proof. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherSession auth selection chooses a stored credential for an agent session and supplies route facts to the model runtime. Inference and other run-admission paths then use those facts to select the provider endpoint and preserve the session’s authentication route. flowchart LR
A[Session and model choice] --> B[Session auth selection]
B --> C[Provider route resolution]
C --> D[Route-compatible profile rotation]
D --> E[Prepared runtime]
E --> F[Model request]
G[Cooldown state] --> D
Decision needed
Why: The central user problem is fixed on main, but this PR adds a wider, conflicting refactor across four call paths; choosing whether that extra architectural scope is worth carrying requires maintainer intent. Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +275. Total +283 across 20 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the merged scoped repair as the default; rebase this branch only if maintainers can demonstrate a remaining caller-level defect and verify the broader façade with route-stay and Anthropic-fallback Gateway proof. Do we have a high-confidence way to reproduce the issue? No on current main: the merged route filter and focused compaction/cooldown tests cover the reported switch, although tests were not executed in this read-only review. Is this the best way to solve the issue? No as a replacement by default: current main has a narrower owner-level repair; the broader façade is justified only if it proves a remaining caller-level gap. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 19c916be139a; fix evidence: commit 19c916be139a, main fix timestamp 2026-08-18T16:38:56-07:00. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
#126062 left caller-supplied announce gateway-context resolvers behind after binding dispatch to the Gateway instance. Remove the dead plumbing that broke prod-types in gateway-scope lanes.
…facts facade Completes #123894's redesign by deduplicating the four session-auth call-site preludes and deleting inference-runtime's duplicate route re-derivation. Co-authored-by: fuller-stack-dev <[email protected]>
64b4358 to
abb112c
Compare
|
Merged via squash.
|
…facts facade (openclaw#126084) * fix(subagents): drop dead announce gateway-context resolver plumbing openclaw#126062 left caller-supplied announce gateway-context resolvers behind after binding dispatch to the Gateway instance. Remove the dead plumbing that broke prod-types in gateway-scope lanes. * refactor(agents): consolidate session auth selection behind prepared-facts facade Completes openclaw#123894's redesign by deduplicating the four session-auth call-site preludes and deleting inference-runtime's duplicate route re-derivation. Co-authored-by: fuller-stack-dev <[email protected]> --------- Co-authored-by: fuller-stack-dev <[email protected]>
What Problem This Solves
Two things, stacked as independent commits:
fix(subagents): latent main breakage. fix(gateway): bind subagent completion dispatch to instance #126062 bound subagent completion dispatch to the Gateway instance (context now comes from the instance's owngetContext), but left the old caller-suppliedresolveGatewayContextplumbing threaded through the announce path. The forward intoGatewayLifecycleAgentDispatchOptionsfailscheck-prod-types(TS2353) in any CI lane that typechecks the gateway scope — fix(gateway): bind subagent completion dispatch to instance #126062's own changed-scope lanes never did, so main is latently red for every future gateway-touching PR (this one was the first to trip it).refactor(agents): auth-selection consolidation. fix: API-key sessions switch to OAuth after compaction #123894 fixed route-blind session rotation insidesession-override.ts, but every caller still hand-rolls the same selection prelude, and the inference runtime still re-derives the selected profile's credential mode and route requirement that the resolver just computed.Why This Change Was Made
The fix commit deletes the dead announce-path resolver plumbing (param decls, forwards, the now-unused
getSharedGatewayContextResolver, and the stale forwarding assertions in the binding test). The spawn/tools resolver path is untouched — the in-process dispatch there still consumes it.The refactor completes #123894's redesign at the call-site layer: a new
resolveSessionAuthSelectionfaçade returns prepared facts (profileId,source,routeRequirement) and owns provider expansion, provenance derivation, and explicit configured-default-profile precedence. All four callers (inference-runtime, get-reply-run-admission, btw, cron run-prepare) migrate to it and delete their preludes; inference-runtime drops its duplicate mode/route re-derivation and consumes the prepared route requirement directly. Rotation internals from #123894 are untouched.User Impact
None intended — behavior-neutral consolidation plus a type-level repair of main. Sessions keep the route-aware rotation shipped in #123894; gateway-scope CI lanes typecheck again.
Evidence
configuredProfileIdprecedence, and a negative test thatmodel@profilesuffixes cannot imply pin precedence.check:changedPASS (fails on unpatched main with the TS2353 above — reproduced and attributed to 2cd87d3);check:import-cycles0;pnpm buildPASS, no[INEFFECTIVE_DYNAMIC_IMPORT]; oxfmt clean; Codex autoreview clean on the final stack.codex-rs/model-provider-info/src/lib.rs,codex-rs/protocol/src/auth.rs).Follow-up candidate (out of scope): unify rotation onto the planner's
ProviderModelAuthSourcePlanprimitives so cooldown/order classification exists once.AI-assisted: yes. Designed, reviewed, and verified by maintainer session.
Co-authored with @fuller-stack-dev (#123894 groundwork).