Include unloaded children in multi-agent v2 environment context (#43491)

## Why

After a cold resume and compaction, the subagent roster omitted children whose threads had not been loaded.

## What changed

Build the multi-agent v2 roster from registered direct children and render their full agent paths. Prioritize loaded children, sort alphabetically within each group, and cap the rendered roster at eight agents and 1,024 bytes. Preserve the existing behavior for other multi-agent versions.

## Testing

Extend the cold-resume integration test to check that post-compaction context includes unloaded children, excludes grandchildren, and lists a loaded child before an alphabetically earlier unloaded sibling.

GitOrigin-RevId: 745c1622133b9c01e61f4702e4b2ef6255417f39
This commit is contained in:
jif authored and copyberry committed 2026-09-07 15:10:37 +00:00
1 parent d70044072c
commit d665e3bbc8
3 files changed
+129 -13

No files matched your search

+4 -1
View File
@@ -82,7 +82,10 @@ impl Session {
let environment_subagents = if turn_context.config.include_environment_context {
self.services
.agent_control
.format_environment_context_subagents(self.thread_id)
.format_environment_context_subagents(
self.thread_id,
turn_context.multi_agent_version,
)
.await
} else {
String::new()