Repository navigation
fix(gateway): keep CLI session model identities consistent - #139884
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: needs maintainer review before merge. Reviewed September 6, 2026, 3:21 AM ET / 07:21 UTC. ClawSweeper reviewWhat this changesThe Gateway consistently displays CLI-backed session models using the backend’s declared provider while preserving the selected route for runtime and catalog policy. Merge readiness✅ Ready for maintainer review This remains a useful, focused repair: current main still guesses CLI display providers and projects inconsistent identities. No actionable introduced defect was found, and the related staging draft does not supersede this PR. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway projects stored session selections and agent defaults into session lists, details, search results, and patch responses. CLI backend descriptors supply display identities, while the selected route continues to determine runtime and context metadata. flowchart TD
A[Session selections and agent defaults] --> B[Selected model route]
B --> C[Display identity projection]
D[CLI backend descriptors] --> C
C --> E[Lists details search and patch responses]
B --> F[Runtime and catalog policy]
F --> E
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -17, Tests +102. Total +85 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Use one descriptor-based display projection across session reads while retaining selected-route ownership of runtime and context metadata. Do we have a high-confidence way to reproduce the issue? Yes, source provides a high-confidence path: select a mapped or standalone CLI backend while the agent has an unrelated default, then compare list, detail, and patch identities. This reviewer did not execute that path. Is this the best way to solve the issue? Yes. Reusing declared backend metadata removes unsupported provider inference, and separating display identity from selected-route policy preserves the relevant existing contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 38d31ee66dd3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Ready for guarded landing at
CI run 34018634689, attempt 1, is complete: 105 jobs succeeded. The sole failed child is checks-node-compact-large-6 / 101447095020. The summary gate / 101447913113 fails only because of that child. The child fails Independently supplied baseline controls on unmodified main The relevant mount behavior comes from #135702, private workspace skill protection, commit This PR does not change sandbox/hash/mount code, dependencies, or test configuration. Its Gateway test uses an isolated temporary state directory and does not run in the failing agents-support shard. The sandbox hash path consumes unchanged sandbox config, constants, environment policy, and mount state; no changed Gateway projection enters it. I judge the failed child and its derived gate failure unrelated to this repair. A matching recent main CI run is not claimed; the guarded approval uses the retained causal baseline proof. Follow-up outside this PR: give the sandbox hash test an isolated workspace or an explicit mount expectation. Production is net −17 lines; regression coverage adds 102 lines. No source-draft, protocol, auth, config, or schema mutation is included. |
|
landpr-approve-unrelated-red |
|
Landed as Proof: actual built Gateway before/after requests, 246 affected tests, and fresh API-only acceptance with 117 request pairs and 20 session events. Local and public ClawSweeper reviews are platinum/B with no findings. Inference and unlogged work remain outside the observed proof.
CI exception: completed run 34018634689, attempt 1 has 105 successful jobs. Its sole failed child, checks-node-compact-large-6 / 101447095020, fails the sandbox browser hash fixture at The matching failure was reproduced on unchanged main with only a preexisting temporary skills directory, and the relevant source bytes and ancestry were checked. The fixture assumes no mounts despite the existing protected-mount behavior from #135702. This PR changes none of those inputs. Complete causal assessment and standing approval bound to the exact completed run were validated by the guarded merger. No recent matching main CI run or direct observation of the CI runner's directory contents is claimed. Production net −17 lines; tests +102. The broader source draft remains unchanged. The sandbox fixture isolation follow-up stays outside this extraction. |
…139884) Related: openclaw#136257 ## What Problem This Solves Sessions selected through a CLI backend can show different model providers in the session list, details, and patch response. Details can borrow the unrelated agent default, and searching by the actual provider can miss the session. Standalone backends can also lose their own identity. ## Why This Change Was Made The Gateway uses the existing backend's declared model provider for display identity. Lists, defaults, details, search, and patch responses share that projection. Catalog and runtime policy keep the original selected route, including existing CLI-specific context metadata. Removed provider guessing from agent defaults/configured model names, the lightweight-row bypass, and the obsolete agent-specific display cache key. This is an existing read-surface repair; it adds no protocol fields, authentication mutation, configuration option, or storage change. ## User Impact - Model provider and model identity agree across session reads. - Provider/model search includes sessions selected through their CLI backend. - Qualified identities and standalone backend names remain intact. - Stored selections, runtime policy, and selected-route catalog metadata keep their owners. ## Evidence The actual built Gateway was tested with the bundled Claude CLI descriptor and two isolated fixture backends. All requests used synthetic state without inference or operator credentials. | Existing API scenario | Baseline | Candidate | | --- | --- | --- | | List and describe one mapped CLI selection | CLI name in list; unrelated default provider in details | Declared provider in both | | Standalone CLI details | Unrelated default provider | Standalone backend identity | | Qualified CLI selection | Different list/detail identities | Same qualified identity | | CLI agent default | Runtime alias shown as provider | Declared model provider | | Provider/model search | Mapped CLI selection omitted | Selection included | | Label-only session patch | Unrelated provider in response | Declared provider; selection unchanged | Baseline `b9a935ddeddc5e6545135912a69bee6f7051e90a`; candidate `f29a4e100a3040db6904b8cc0b27f07d2fac328c`. Three new regression cases fail on the original production code; the direct-provider control passes. All 246 affected identity/session tests pass after the repair. Existing context-window assertions remain unchanged. ACP ownership and resolver-cache checks also pass. Focused syntax lint, pinned formatting, assertion-safety and max-lines checks pass. Type checks run in CI. A fresh source-blind, API-only validator exercised 117 complete request/response pairs and 20 real session events. Identity, search, label-patch, standalone/qualified controls, and changed-default/restoration checks pass. It found no observable model-identity failure. Retained selection fields remain unchanged. Inference was intentionally excluded; APIs/logs cannot prove absence of unlogged work. Build isolation and historical baseline provenance are supplied by the repair owner, not claimed as independently discoverable through the API. An earlier validator inspected the synthetic database schema; its evidence is retained only as supplemental proof, not as the source-blind gate. Production: **+41/-58, net -17**. Tests: **+102**. Total: **+85**. No generated, lockfile, or docs changes. The added regression matrix checks full/lightweight rows, patch responses, defaults, search, and retained runtime policy at existing boundaries; it adds no test-only production seam. No existing coverage was removed. AI-assisted. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #136257.
What Problem This Solves
CLI-backed sessions could show inconsistent model providers in lists, details, and patch responses. Searching by the actual provider could miss the session.
Why This Change Was Made
One Gateway projection uses the backend's declared model provider for display identity. Lists, defaults, details, search, and patch responses share it. Runtime policy retains the original selected route.
User Impact
Session identity agrees across read surfaces, and provider/model search finds the session. Qualified and standalone backend identities remain intact. Stored selections do not change.
Evidence
Built Gateway requests reproduced mismatched identities and missing search results before the fix. Three regressions failed before the repair; all 246 focused tests passed afterward. API acceptance checked identity, search, label-only edits, changed defaults, and preserved selections across 117 request/response pairs. Inference was not tested.
Consumers: session lists, details, defaults, search, and patch responses share declared display identity.
AI-assisted.