Repository navigation
fix(tui): keep model catalogs scoped to the selected agent - #139880
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:16 AM ET / 07:16 UTC. ClawSweeper reviewWhat this changesThe local terminal passes the selected agent into model catalog loading, waits for catalog publication, and removes its cached history-specific plugin registry. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: fetched main still loses the selected agent when acquiring local terminal catalogs. No blocking patch defect was found, and the broader related staging PR does not supersede this work. Priority: P2 Review scores
Verification
How this fits togetherThe local terminal uses an embedded backend to load history and select models. That backend reads prepared model catalogs and applies the selected agent’s model policy before presenting choices or updating sessions. flowchart TD
A[Terminal agent selection] --> B[Embedded backend]
C[Configuration publication] --> D[Publication readiness]
B --> D
D --> E[Selected agent catalog]
E --> F[Agent model policy]
F --> G[Model picker and session operations]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -16, Tests -7. Total -23 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep catalog construction in the shared prepared owner and consistently carry the selected agent through every embedded terminal consumer. Do we have a high-confidence way to reproduce the issue? Yes, from source: configure multiple agents without an ambient owner and open the local terminal’s model picker for an explicitly selected agent; fetched main drops that agent before catalog acquisition. This review did not execute the scenario. Is this the best way to solve the issue? Yes. Forwarding the existing agent identity and reusing publication readiness repairs the consumer boundary while preserving configured replace-mode catalogs and model filtering. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0c74e5e040d1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
The only failed child in completed CI run 34018530835, attempt 1 is checks-node-compact-large-6. Its failure is unrelated to this PR.
Follow-up: give the sandbox hash fixture an isolated workspace or explicit mount inputs. That unrelated test repair is not included here. The exact-head local landing review passed at platinum/B with no findings, and the real terminal acceptance proof remains valid. |
|
landpr-approve-unrelated-red |
|
Landed as 23a47913496c from reviewed head d6576f7caef.
The guarded merge used the approved unrelated-CI exception for run 34018530835, attempt 1. Its only failed child was checks-node-compact-large-6, job 101446816896: The same test passes on unchanged main The broader source draft remains untouched. No configuration, schema, protocol, or credential-persistence change is included. |
…139880) Related: openclaw#136257 ## What Problem This Solves Fixes an issue where users selecting an agent in `openclaw tui --local` could not load history, open the model picker, or change models when multiple agents were configured without an ambient owner. The terminal showed the selected agent but reported that the operation had no explicit owner. ## Why This Change Was Made Carry the resolved session or selected agent into the existing prepared catalog loader, and wait for the terminal's current catalog publication before catalog-consuming operations. Remove the last-history plugin registry cache: catalog construction already owns its registry scope. Keep explicit replace-mode catalogs, wildcard discovery, model restrictions, and Gateway-backed terminal behavior. ## User Impact Users can choose a model for the selected agent, switch between agents with different model restrictions, and continue or create a session with the correct model. ## Evidence | Scenario | Main at `b9a935ddedd` | This change at `d6576f7caef` | | --- | --- | --- | | Local terminal, two agents, explicit work session | History, model listing, and model changes report a missing owner | History loads; picker and model selection work | | Switch work → main → work | Selected catalog acquisition is not scoped to the chosen agent | Each picker shows its agent's allowed model; requests use the chosen model | | Continue work, then `/new` | Model selection is blocked | Continuation retains work history; new work session sends a request without prior conversation history | | Choose a different allowed work model, then switch back | Model selection is blocked | Captured requests change from the alternate model to the original model while retaining conversation history | - Real built CLI and terminal with isolated synthetic model endpoints; six captured requests across two fixtures confirm model selection and session history boundaries. Independent validators exercised the terminal without reading implementation source, including a switch to a different allowed model and back. - All 191 focused tests pass: terminal backend/client, prepared catalog owner, and Gateway catalog projection. Three regression cases fail on unchanged main. - Syntax-only focused lint, pinned formatting, changed-scope line/assertion checks, and independent code review pass. Both baseline and candidate builds complete. - Production: 16 lines removed net. Tests: 7 lines removed net. Total: 23 lines removed net. No configuration, schema, protocol, or credential-persistence changes. Publication ordering, paired auth state, and alternate catalog modes are covered by owner tests and code review; the terminal exercise does not claim live external-provider or native sign-in validation. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #136257.
What Problem This Solves
The local terminal could show a selected agent but fail to load history, open its model picker, or change models when no ambient owner existed.
Why This Change Was Made
Local operations pass the resolved session or selected agent into the prepared catalog loader and wait for the current catalog publication. The obsolete history registry cache is removed. Existing model restrictions and Gateway-backed behavior remain intact.
User Impact
Users can select models, switch between agents with different restrictions, and continue or create sessions with the correct model. No configuration or storage change.
Evidence
Real CLI and terminal checks reproduced missing-owner errors before the fix. Afterward, history, model selection, agent switching, and new-session boundaries worked. Six recorded requests confirmed selected models and history boundaries. Three regressions failed before repair; all 191 focused tests passed afterward. Endpoints were synthetic; native sign-in and live external inference were not tested.
Consumers: local terminal history, picker, and model changes use the selected agent's catalog.