Skip to content
This repository was archived by the owner on Aug 25, 2026. It is now read-only.

feat(v2): surface subagent model and thinking context - #28

Merged
YaseenHQ merged 3 commits into
mainfrom
codex/upstream-capability-integrations
Aug 10, 2026
Merged

YaseenHQ merged 3 commits into
mainfrom
codex/upstream-capability-integrations

Conversation

@YaseenHQ

Copy link
Copy Markdown
Owner

Summary

Integrates the upstream subagent model/thinking metadata capability in Echadron-native form.

  • propagates bound model aliases and effective thinking effort through v2 SDK, task, swarm, REST/WS, and replay event shapes
  • renders model and effort in subagent task cards, swarm progress, tool-call activity, and task details
  • normalizes derived secondary-model aliases for display while preserving Echadron's routing precedence
  • republishes child status after spawn so clients receive context/model metadata immediately
  • omits unknown model context limits instead of publishing a misleading zero

Compatibility

This keeps Echadron's profile/config and swarm contracts intact; presentation metadata is kept at the event/UI boundary rather than added to executable swarm bindings.

Validation

  • pnpm typecheck
  • pnpm --filter @yaseenhq/echadron test (2484 passed, 2 skipped)
  • pnpm --filter @moonshot-ai/agent-core-v2 test focused agent/session/swarm suites (125 passed)
  • pnpm --filter @moonshot-ai/kap-server test (822 passed)

liruifengv and others added 3 commits August 10, 2026 07:22
…onshotAI#2679)

* feat: surface the bound model on subagent UIs

The subagent.spawned event now carries the display-normalized model alias
(the derived __secondary__ entry resolves to its base alias), so clients can
show which model a subagent is bound to. The TUI subagent card, swarm panel
header, and background-agent entry show it at spawn; the WS snapshot roster
and REST /tasks (background/detached subagents) carry it too, keeping the
model visible across client reconnects.

* feat: carry the subagent thinking effort alongside the model

The spawned event, snapshot roster, and REST /tasks now also carry the
child's effective thinking effort (read from the child profile at spawn, the
same vocabulary as agent.status.updated). UIs show it only when it diverges
from the main session's current effort — an inherited level adds no
information, and 'off' is never shown.

* feat(tui): show the bound model and effort in the /tasks browser

The task browser's Detail pane renders Model and Effort rows for agent
tasks (raw alias and level — it is the inspector surface, so no diff
filtering), and its minimum height grows to fit the new rows. The values
were already persisted on SubagentTaskInfo; the TaskInfo union, its zod
schemas (protocol, kap-server, klient contract), and the v1 type
declaration now carry them so nothing strips them in transit.

* feat(tui): show concrete subagent effort levels unconditionally

Display rule simplified: any concrete effort tier (low/high/max/…) is
shown next to the model — including when it matches the main session's
level. Only the boolean states stay hidden: 'off' (no thinking) and 'on'
(generic thinking) carry no level information.

* docs: trim the changeset entry

* fix(tui): keep the model and effort on background-agent entries across resume

replayBackgroundProjection only copied agentId/parentToolCallId/
description, so a background subagent that outlived a resume lost its
model/effort on the later terminal transcript entry. The projection now
threads the persisted values (catalog-mapped model; boolean effort states
dropped), and session replay passes the loaded model catalog through.

* fix(agent-core-v2): normalize the derived secondary alias regardless of the flag

A child bound while the secondary-model experiment was on keeps
__secondary__ in its persisted binding; if the flag is later switched off
with the recipe still configured, resolveSecondaryModel() gated the
normalization and the sentinel leaked back onto resumed subagents.
subagentDisplayModel now reads the recipe straight from config (the flag
gates new bindings, not the interpretation of existing ones), which also
drops SessionSwarmService's now-unused IFlagService dependency. Also adds
the SDK package to the release: the new SubagentSpawnedEvent/AgentTaskInfo
fields are SDK-visible types.

* fix(agent-core-v2): normalize the status-frame model at the source

A derived-bound child republishes agent.status.updated right after spawn
with its raw modelAlias, which overwrote the spawned event's normalized
display model on single-subagent cards (swarm headers were first-wins and
escaped). emitStatusUpdated now maps through subagentDisplayModel, a no-op
for the never-derived main agent. Also moves the inline comments added by
this branch into top-of-file headers per the v2 comment convention.

* fix(tui): clamp the /tasks detail frame to the available body

At terminals near the minimum height the forced 10-row detail frame
overflowed the body and truncated the preview frame's border. The detail
height now caps out at whatever leaves the preview its borders plus one
content row, with a regression test at exactly MIN_HEIGHT.

* fix: normalize inherited derived aliases and keep model/effort on replayed terminal entries

- resolveSubagentBinding's caller-fallback branch also maps through
  subagentDisplayModel: a caller itself bound to the derived entry (a
  resumed subagent making a nested Agent call) no longer publishes
  __secondary__.
- The replayed background-task terminal notification builds its metadata
  with the persisted model (catalog-mapped) and concrete effort, matching
  the live completion path.
- Drops the inline comments this branch added inside v2 test bodies; the
  scenario context lives in the source file headers.

(cherry picked from commit 7b2784b)
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@YaseenHQ, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 90e6df19-ea73-4c42-b778-f2ec6109b8f0

📥 Commits

Reviewing files that changed from the base of the PR and between f65bb85 and 168eb07.

📒 Files selected for processing (40)
  • .changeset/subagent-model-display.md
  • .changeset/subagent-model-sdk-fields.md
  • apps/kimi-code/src/tui/components/dialogs/tasks-browser.ts
  • apps/kimi-code/src/tui/components/messages/agent-group.ts
  • apps/kimi-code/src/tui/components/messages/agent-swarm-progress.ts
  • apps/kimi-code/src/tui/components/messages/tool-call.ts
  • apps/kimi-code/src/tui/controllers/session-replay.ts
  • apps/kimi-code/src/tui/controllers/subagent-event-handler.ts
  • apps/kimi-code/src/tui/types.ts
  • apps/kimi-code/src/tui/utils/background-agent-status.ts
  • apps/kimi-code/src/tui/utils/message-replay.ts
  • apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts
  • apps/kimi-code/test/tui/message-replay.test.ts
  • apps/kimi-code/test/tui/tasks-browser.test.ts
  • packages/agent-core-v2/docs/state-manifest.d.ts
  • packages/agent-core-v2/src/agent/profile/profile.ts
  • packages/agent-core-v2/src/agent/profile/profileService.ts
  • packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts
  • packages/agent-core-v2/src/agent/tools/agent/agentTool.ts
  • packages/agent-core-v2/src/agent/tools/agent/subagent-task.ts
  • packages/agent-core-v2/src/session/sessionInit/sessionInitService.ts
  • packages/agent-core-v2/src/session/subagent/configSection.ts
  • packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts
  • packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts
  • packages/agent-core-v2/test/agent/profile/config-state.test.ts
  • packages/agent-core-v2/test/app/config/config.test.ts
  • packages/agent-core-v2/test/session/sessionInit/sessionInit.test.ts
  • packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts
  • packages/agent-core-v2/test/tool/tool.test.ts
  • packages/agent-core/src/agent/background/agent-task.ts
  • packages/kap-server/src/protocol/events-zod.ts
  • packages/kap-server/src/protocol/task.ts
  • packages/kap-server/src/routes/tasks.ts
  • packages/kap-server/src/transport/ws/v1/subagentRosterTracker.ts
  • packages/kap-server/test/sessionEventBroadcaster.test.ts
  • packages/kap-server/test/subagentRosterTracker.test.ts
  • packages/kap-server/test/tasks.test.ts
  • packages/klient/src/contract/agent/rpc.ts
  • packages/protocol/src/events.ts
  • packages/protocol/src/task.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@YaseenHQ
YaseenHQ merged commit 155adc4 into main Aug 10, 2026
15 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants