Skip to content

fix: agents_list reports routing alias instead of the resolved model - #123044

Merged
altaywtf merged 1 commit into
openclaw:mainfrom
xialonglee:fix/gap-agents-list-model-alias
Aug 15, 2026
Merged

altaywtf merged 1 commit into
openclaw:mainfrom
xialonglee:fix/gap-agents-list-model-alias

Conversation

@xialonglee

@xialonglee xialonglee commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Related: #122907 (same invariant fixed on the gateway agents.list surface)
Related gap finding: agents-list-model-alias (free-text issue, evidence level B — runtime before/after repro)

What Problem This Solves

Fixes an issue where the agents_list tool reported a routing-layer model alias (e.g. a ClawHub router ref such as clawrouter/openai/gpt-5.6) as an agent's model, while the same entry's agentRuntime was derived from the resolved model. Agents consuming the tool for subagent spawn and model decisions saw two contradictory identities for the same agent.

Why This Change Was Made

agents_list had the same projection split that gateway agents.list had before #122907: the model field came from the raw configured primary (resolveAgentEffectiveModelPrimary, aliases unresolved) while runtime metadata used resolveDefaultModelForAgent. The tool now publishes the canonical resolved provider/model — the same resolvedModel already feeding agentRuntime — so displayed identity and capabilities describe one model. Aliases remain routing-only; no hardcoded model ids. Agents without a configured model now see the resolved default model (previously model was omitted), consistent with the runtime metadata already emitted.

User Impact

Agents using agents_list see the model that will actually run instead of a routing token, keeping spawn/runtime decisions consistent. Operator-facing surfaces (models CLI, system-agent overview) still show the authored config value.

Evidence

CI proof: resolved model identity from an initialized config (before/after)

Real behavior proved at exact immutable heads through the production config pipeline: a real openclaw.json is written into an isolated state dir (OPENCLAW_STATE_DIR under a temp HOME) and loaded by the real config loader — no config mocks — then the real agents_list tool executes and its output is captured. The identical scenario runs at both SHAs; machine-readable [proof] markers record the observed behavior.

Before markers (raw routing alias leaks into model; unconfigured agent omits model):

[proof] scene=alias-model mode=before status=pass observed_model=clawrouter/openai/gpt-5.6 observed_runtime=codex/model expected_model=clawrouter/openai/gpt-5.6
[proof] scene=no-model mode=before status=pass model_present=false observed_model=<absent> observed_runtime=codex/implicit expected_model=<absent>
[proof] scene=plain-model mode=before status=pass observed_model=openai/gpt-5.5 observed_runtime=codex/model expected_model=openai/gpt-5.5

After markers (resolved canonical model published; resolved default now visible):

[proof] scene=alias-model mode=after status=pass observed_model=openai/gpt-5.6-sol observed_runtime=codex/model expected_model=openai/gpt-5.6-sol
[proof] scene=no-model mode=after status=pass model_present=true observed_model=openai/gpt-5.6-sol observed_runtime=codex/implicit expected_model=openai/gpt-5.6-sol
[proof] scene=plain-model mode=after status=pass observed_model=openai/gpt-5.5 observed_runtime=codex/model expected_model=openai/gpt-5.5
  • src/agents/tools/agents-list-tool.test.ts: 7 passed — new regression test covers the alias scenario; the two model: undefined expectations updated to the resolved default.
  • tsgo:core (incremental): clean. oxlint: 0 warnings / 0 errors. oxfmt, git diff --check: clean.
  • Review: openclaw-pr-review passed with best-fix verdict best.

agents_list exposed the raw configured primary (routing alias) as the
model field while agentRuntime was derived from the resolved model,
giving agents two contradictory identities. Publish the resolved
provider/model from resolveDefaultModelForAgent instead, matching the
gateway agents.list fix (openclaw#122907).
@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@xialonglee
xialonglee marked this pull request as ready for review August 13, 2026 07:17
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Aug 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 6:09 AM ET / 10:09 UTC.

ClawSweeper review

What this changes

This PR changes agents_list to return the resolved provider/model identity rather than a configured routing alias, and adds alias-resolution regression coverage.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: current main still exposes the raw configured primary in this tool, while the PR makes it match the already-resolved runtime identity. The patch is a focused owner-boundary fix with no blocking findings.

Priority: P2
Reviewed head: bf93d5aaf8269898710e4bf82fe94496eddce4a9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent fix with regression coverage and configuration-backed before/after proof.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The PR body provides an exact-head before/after transcript through a real isolated configuration and the real tool, with a linked workflow artifact.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR body provides an exact-head before/after transcript through a real isolated configuration and the real tool, with a linked workflow artifact.
Evidence reviewed 7 items Current-main defect: The current tool projects model from resolveAgentEffectiveModelPrimary but derives agentRuntime from resolveDefaultModelForAgent, allowing an alias and resolved identity to disagree.
Canonical resolution owner: resolveDefaultModelForAgent applies the effective agent primary through resolveConfiguredModelRef, whose alias branch returns the configured alias target rather than the raw alias token.
Sibling projection agrees: The gateway agent-list projection already uses the resolved provider/model for runtime metadata and its model projection, establishing the shared identity invariant without requiring Codex runtime/protocol behavior.
Findings None None.
Security None None.

How this fits together

agents_list is a built-in agent tool that lists permitted subagent targets. It reads agent configuration and model selection, then returns model and runtime metadata used by an agent to choose spawn targets.

flowchart LR
A[Agent configuration] --> B[Model resolver]
C[agents_list request] --> D[Agent-list tool]
B --> D
D --> E[Resolved model metadata]
E --> F[Runtime metadata]
E --> G[Subagent spawn decisions]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed because this contributor PR already contains the bounded owner-boundary repair and sufficient proof.
Agent review details

Security

None.

PR surface

Source -2, Tests +43. Total +41 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 6 -2
Tests 1 45 2 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 49 8 +41

Review metrics

Metric Value Why it matters
Production vs test LOC production +4/-6 (net -2); tests +45/-2 (net +43) The bug repair reduces production code while adding focused coverage for the previously untested alias projection.

Technical review

Best possible solution:

Land the focused tool projection fix so every agent-facing model/runtime pair describes the same resolved model, while leaving operator-facing configured-model views unchanged.

Do we have a high-confidence way to reproduce the issue?

Yes. A configured model alias takes the raw-primary branch on current main while runtime metadata takes the resolved-model branch; the PR body also supplies an exact-head before/after real-config transcript.

Is this the best way to solve the issue?

Yes. Using the same resolved model already supplied to runtime metadata removes the split at the tool projection boundary; changing the resolver or operator-facing configured-model displays would be broader and incorrect.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2278ca6952ea.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact-head before/after transcript through a real isolated configuration and the real tool, with a linked workflow artifact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides an exact-head before/after transcript through a real isolated configuration and the real tool, with a linked workflow artifact.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This fixes incorrect agent-facing model metadata that can mislead spawn decisions, with a bounded blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR body provides an exact-head before/after transcript through a real isolated configuration and the real tool, with a linked workflow artifact.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an exact-head before/after transcript through a real isolated configuration and the real tool, with a linked workflow artifact.

Evidence

What I checked:

  • Current-main defect: The current tool projects model from resolveAgentEffectiveModelPrimary but derives agentRuntime from resolveDefaultModelForAgent, allowing an alias and resolved identity to disagree. (src/agents/tools/agents-list-tool.ts:135, 2278ca6952ea)
  • Canonical resolution owner: resolveDefaultModelForAgent applies the effective agent primary through resolveConfiguredModelRef, whose alias branch returns the configured alias target rather than the raw alias token. (src/agents/model-selection-config.ts:9, 2278ca6952ea)
  • Sibling projection agrees: The gateway agent-list projection already uses the resolved provider/model for runtime metadata and its model projection, establishing the shared identity invariant without requiring Codex runtime/protocol behavior. (src/gateway/session-utils-store.ts:342, 2278ca6952ea)
  • Focused regression coverage: The added test configures a routing alias and asserts the tool returns openai/gpt-5.6-sol with runtime metadata sourced from that resolved model; existing no-model expectations now assert the resolved default. (src/agents/tools/agents-list-tool.test.ts:86, bf93d5aaf826)
  • After-fix behavior proof: The PR body supplies before/after output from a real isolated openclaw.json loaded through the production config pipeline and executing the real tool; its linked artifact covers the exact PR head. (bf93d5aaf826)
  • Current-path provenance: Blame attributes the pre-fix split projection lines to 0901efe; the source history available locally is shallow, so this is routing provenance rather than a predecessor-PR attribution. (src/agents/tools/agents-list-tool.ts:135, 0901efe3ddf6)

Likely related people:

  • joshavant: Blame assigns both the pre-fix tool projection and adjacent gateway projection to this recent shared implementation commit. (role: recent shared agent and gateway projection contributor; confidence: high; commits: 0901efe3ddf6; files: src/agents/tools/agents-list-tool.ts, src/gateway/session-utils-store.ts)
  • steipete: The merged gateway repair in fix: new-session default model shows unresolved alias and hides thinking levels #122907 established the same resolved-model identity invariant on a separate API surface. (role: adjacent resolved-model projection contributor; confidence: medium; commits: 3a0cb1773922; files: src/gateway/session-utils-store.ts, src/gateway/session-utils.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-13T07:22:43.136Z sha bf93d5a :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 13, 2026
@altaywtf
altaywtf merged commit 107f03d into openclaw:main Aug 15, 2026
201 of 203 checks passed
@altaywtf

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…penclaw#123044)

agents_list exposed the raw configured primary (routing alias) as the
model field while agentRuntime was derived from the resolved model,
giving agents two contradictory identities. Publish the resolved
provider/model from resolveDefaultModelForAgent instead, matching the
gateway agents.list fix (openclaw#122907).
@xialonglee
xialonglee deleted the fix/gap-agents-list-model-alias branch August 17, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants