Skip to content

Expose resolved subagent model metadata - #80037

Merged
steipete merged 1 commit into
openclaw:mainfrom
guanbear:expose-subagent-resolved-model
May 30, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
guanbear:expose-subagent-resolved-model

Conversation

@guanbear

@guanbear guanbear commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Return the resolved native child model ref/provider from accepted sessions_spawn results.
  • Include the same model metadata on subagent_spawned plugin hook events.
  • Document the tool result and hook metadata, with targeted coverage for the accepted spawn path.

Verification

  • git diff --check
  • pnpm exec oxfmt --check --threads=1 src/agents/subagent-spawn.ts src/plugins/hook-types.ts src/agents/subagent-spawn.model-session.test.ts src/agents/sessions-spawn-hooks.test.ts
  • pnpm format:docs:check
  • pnpm test src/agents/subagent-spawn.model-session.test.ts src/agents/sessions-spawn-hooks.test.ts
  • TypeScript diagnostics: modified TS files reported 0 errors

Real behavior proof

  • Behavior addressed: Accepted native sessions_spawn results and the subagent_spawned lifecycle hook expose the resolved child model metadata instead of only modelApplied.
  • Real environment tested: Local macOS development checkout at commit f8c9bff, Node v25.9.0, OpenClaw config loaded from the local user setup. This was a source-level runtime smoke with the gateway call boundary stubbed so the command could exercise the production spawn path without launching a real child LLM turn.
  • Exact steps or command run after this patch: Ran a local pnpm exec tsx -e ... smoke that imported src/agents/subagent-spawn.ts, invoked spawnSubagentDirect with model: "openai-codex/gpt-5.4", and captured the accepted result plus the subagent_spawned hook event.
  • Evidence after fix:
Config warnings:
- plugins.entries.active-memory: plugin disabled (disabled in config) but config is present
{
  "result": {
    "status": "accepted",
    "runId": "real-proof-run",
    "resolvedModel": "openai-codex/gpt-5.4",
    "resolvedProvider": "openai-codex",
    "modelApplied": true
  },
  "hookEvent": {
    "runId": "real-proof-run",
    "resolvedModel": "openai-codex/gpt-5.4",
    "resolvedProvider": "openai-codex"
  }
}
  • Observed result after fix: The accepted tool result and the emitted subagent_spawned event both contained resolvedModel: "openai-codex/gpt-5.4" and resolvedProvider: "openai-codex".
  • What was not tested: Full live model execution and completion announce delivery; this change only exposes model metadata resolved before the child run starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@clawsweeper

clawsweeper Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 1:48 PM ET / 17:48 UTC.

Summary
The PR adds optional resolvedModel and resolvedProvider metadata to accepted native subagent spawn results and subagent_spawned hook events, with docs and targeted tests.

PR surface: Source +25, Tests +16, Docs +5. Total +46 across 6 files.

Reproducibility: not applicable. this is an additive feature/API PR rather than a bug report. Source inspection and the PR's terminal smoke output show the intended metadata path.

Review metrics: 1 noteworthy metric.

  • Public metadata fields: 2 optional fields added to result and mirrored on 1 hook event. This is small but compatibility-relevant because agents and plugin authors can start depending on these names once shipped.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The new resolvedModel and resolvedProvider names become public tool-result and plugin-hook contract fields; changing them later would require compatibility handling.
  • [P1] A member comment previously flagged Dependency Guard rebase/check state, so maintainers should rely on current-head required checks before landing.

Maintainer options:

  1. Accept the additive contract (recommended)
    If maintainers accept resolvedModel as the full applied model ref and resolvedProvider as the optional provider prefix, merge after current-head required checks pass.
  2. Rename or reshape before merge
    If the field names or semantics should differ, adjust the result, hook type, docs, and tests together before landing.
  3. Defer the API surface
    If exposing model metadata from this surface is not wanted yet, pause or close this PR and keep the metadata internal.

Next step before merge

  • No automated repair lane is needed; the remaining action is maintainer approval of the additive public API contract and current-head checks.

Security
Cleared: The diff only adds optional in-process metadata fields, docs, and tests; it does not touch secrets, dependencies, workflows, install scripts, or code execution supply-chain surfaces.

Review details

Best possible solution:

Land the additive metadata only after maintainers accept the public API contract and current-head checks are green.

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

Not applicable: this is an additive feature/API PR rather than a bug report. Source inspection and the PR's terminal smoke output show the intended metadata path.

Is this the best way to solve the issue?

Mostly yes: the patch reuses the already-resolved subagent model plan and exposes the same metadata in the result and hook event. The only open question is the product/API decision to accept these exact public field names and semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9ef699fedccc.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal output from a local runtime smoke that exercised spawnSubagentDirect and captured both the accepted result and hook event after the patch.

Label justifications:

  • P3: The PR is a small additive API/docs/test improvement with limited blast radius and no reported production regression.
  • merge-risk: 🚨 compatibility: The diff changes a documented plugin hook and tool-result contract that external plugin authors or agents may depend on after release.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes terminal output from a local runtime smoke that exercised spawnSubagentDirect and captured both the accepted result and hook event after the patch.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal output from a local runtime smoke that exercised spawnSubagentDirect and captured both the accepted result and hook event after the patch.
Evidence reviewed

PR surface:

Source +25, Tests +16, Docs +5. Total +46 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 25 0 +25
Tests 2 17 1 +16
Docs 2 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 47 1 +46

What I checked:

  • Repository policy read: Read the root AGENTS.md and the scoped docs, src/agents, and src/plugins guides; plugin API compatibility guidance applies because this PR changes a public hook/tool-result surface. (AGENTS.md:1, 9ef699fedccc)
  • Current main lacks the requested result fields: Current main's SpawnSubagentResult returns modelApplied but has no resolvedModel or resolvedProvider, so the central change is not already implemented on main. (src/agents/subagent-spawn.ts:173, 9ef699fedccc)
  • PR implementation adds and returns metadata: The PR adds optional fields, builds metadata from the resolved model ref, and spreads it into the subagent_spawned event and accepted spawn result. (src/agents/subagent-spawn.ts:180, 3151b23fdfee)
  • PR updates plugin hook contract type: The hook event type gains optional resolvedModel and resolvedProvider fields, making this an additive plugin API surface change. (src/plugins/hook-types.ts:671, 3151b23fdfee)
  • Targeted tests cover result and hook event: The updated tests assert the accepted spawn result and subagent_spawned hook event both contain resolvedModel and resolvedProvider. (src/agents/sessions-spawn-hooks.test.ts:260, 3151b23fdfee)
  • Docs describe the new public metadata: The PR documents the accepted native subagent result fields and the hook event metadata. Public docs: docs/tools/subagents.md. (docs/tools/subagents.md:147, 3151b23fdfee)

Likely related people:

  • steipete: Peter Steinberger authored recent subagent model/non-blocking spawn work, current main blame for the central files points to his recent snapshot commit, and he committed the current PR head. (role: recent area contributor and PR-head committer; confidence: high; commits: 514fcfe77e4c, 77024cf77619, 4f0e3cb6215c; files: src/agents/subagent-spawn.ts, docs/tools/subagents.md)
  • Onur: The thread-bound subagents change added the central subagent_spawned test/runtime path this PR extends. (role: subagent hook path contributor; confidence: medium; commits: 8178ea472db1; files: src/agents/subagent-spawn.ts, src/agents/sessions-spawn-hooks.test.ts)
  • vincentkoc: Vincent Koc authored the plugin hook contract type split that owns the PluginHookSubagentSpawnedEvent type being extended. (role: plugin hook contract contributor; confidence: medium; commits: 7f5a5a34dbf8; files: src/plugins/hook-types.ts, src/plugins/hooks.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 10, 2026
@guanbear
guanbear force-pushed the expose-subagent-resolved-model branch from f8c9bff to 93a4eb5 Compare May 11, 2026 08:40
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@guanbear
guanbear force-pushed the expose-subagent-resolved-model branch from 93a4eb5 to c8877e0 Compare May 12, 2026 14:27
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@guanbear

Copy link
Copy Markdown
Contributor Author

Refreshing review/status against latest main.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels May 18, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 20, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

✨ Hatched: 💎 rare Neon Test Hopper

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 💎 rare.
Trait: stacks clean commits.
Image traits: location status garden; accessory proof snapshot camera; palette charcoal, cyan, and signal green; mood proud; pose nestled inside a glowing shell; shell woven fiber shell; lighting golden review-room light; background subtle branch markers.
Share on X: post this hatch
Copy: My PR egg hatched a 💎 rare Neon Test Hopper in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@steipete steipete self-assigned this May 30, 2026
@steipete
steipete force-pushed the expose-subagent-resolved-model branch from 0d99089 to fe71886 Compare May 30, 2026 17:33

@steipete steipete left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed after rebase onto current main.

Local proof:

  • git diff --check origin/main...HEAD
  • pnpm format:docs:check
  • pnpm test src/agents/subagent-spawn.model-session.test.ts src/agents/sessions-spawn-hooks.test.ts

@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 30, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels May 30, 2026
@steipete
steipete force-pushed the expose-subagent-resolved-model branch from fe71886 to 3151b23 Compare May 30, 2026 17:43
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 30, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 30, 2026
@steipete
steipete merged commit 044f5a8 into openclaw:main May 30, 2026
113 of 115 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 31, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

3 participants