Identify agents by name in token budget context (#36815)

## What changed

- Replace the thread ID in `<context_window>` metadata with the session's canonical agent path.
- Default sessions without an agent path to `/root`.
- Verify that root sessions emit `/root` and subagent sessions emit their own path, such as `/root/worker`.

GitOrigin-RevId: bcf057842ed31f93d554b7de063b6c03403a2594
This commit is contained in:
Boyang Niu authored and copyberry committed 2026-08-04 00:51:53 +00:00
1 parent 60c722e075
commit 7431f10d0d
6 files changed
+39 -31

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ fn recognizes_context_window_as_contextual_developer_content() {
let content = vec![ContentItem::InputText {
text: format!(
r#"{CONTEXT_WINDOW_OPEN_TAG}
Thread id: 00000000-0000-0000-0000-000000000000
Agent name: /root
{CONTEXT_WINDOW_CLOSE_TAG}"#
),
}];