From 256b8f828d3d97374ef0ee67d7ebce1bdb65f7db Mon Sep 17 00:00:00 2001 From: Dudu-0223 Date: Fri, 9 Oct 2026 14:05:07 +0800 Subject: [PATCH] test(subagent): cover inherited schedule tools and address review --- ...-24-preset-scoped-schedule-tools.i18n.yaml | 4 +- ...2026-09-24-preset-scoped-schedule-tools.md | 2 +- ...6-09-24-preset-scoped-schedule-tools.zh.md | 2 +- ...reset-owned-subagent-composition.i18n.yaml | 12 +- ...10-09-preset-owned-subagent-composition.md | 8 +- ...09-preset-owned-subagent-composition.zh.md | 8 +- .../fixtures/refused-schedule-service.ts | 15 + .../cordis.snapshot.yml | 57 ++++ .../session/subagent-fork-schedule/cordis.yml | 16 ++ .../subagent-fork-schedule/session.1.v4.jsonl | 29 ++ .../subagent-fork-schedule/session.v4.jsonl | 32 +++ .../subagent-fork-schedule/snapshot.yml | 9 + .../tool-schemas.expected.json | 267 ++++++++++++++++++ .../subagent-no-message-tool/snapshot.yml | 2 +- .../session/subagent-tool-filter/snapshot.yml | 1 + 15 files changed, 445 insertions(+), 19 deletions(-) create mode 100644 packages/schedule/tool-schedule/tests/fixtures/refused-schedule-service.ts create mode 100644 snapshots/session/subagent-fork-schedule/cordis.snapshot.yml create mode 100644 snapshots/session/subagent-fork-schedule/cordis.yml create mode 100644 snapshots/session/subagent-fork-schedule/session.1.v4.jsonl create mode 100644 snapshots/session/subagent-fork-schedule/session.v4.jsonl create mode 100644 snapshots/session/subagent-fork-schedule/snapshot.yml rename snapshots/session/{subagent-tool-filter => subagent-fork-schedule}/tool-schemas.expected.json (74%) diff --git a/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.i18n.yaml b/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.i18n.yaml index acf9b9db9d..5d0986c3da 100644 --- a/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.i18n.yaml +++ b/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.i18n.yaml @@ -18,5 +18,5 @@ en: d7c7e6b8e6268559 zh: 801e5be70e00cc90 /agent-note-preset-scoped-schedule-tools/testing: - en: 1c5f34cf30a24fd7 - zh: 6f7a372de52d0ecd + en: 712b2bfcd0fc7573 + zh: 541ba01955eb0ab5 diff --git a/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.md b/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.md index 64a66c19ab..f638321912 100644 --- a/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.md +++ b/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.md @@ -31,4 +31,4 @@ English | [中文](2026-09-24-preset-scoped-schedule-tools.zh.md) ## Testing -`packages/schedule/tool-schedule/tests/tool-schedule.spec.ts` pins the four definitions and their error mapping, including `refuses every tool for a delegated child caller`. `apps/cli/tests/web-agent-presets.e2e.ts` asserts the `minimal` preset's tool list, and `snapshots/web/minimal-preset/tool-schemas.expected.json` records its bash-only tool table. `packages/schedule/schedule/tests/subagent-ownership.spec.ts` pins the delegation-depth refusal, and `scripts/optional-bundles.spec.ts` asserts that both delegation rows in the three presets deny all four tool names. +`packages/schedule/tool-schedule/tests/tool-schedule.spec.ts` pins the four definitions and their error mapping, including `refuses every tool for a delegated child caller`. `apps/cli/tests/web-agent-presets.e2e.ts` asserts the `minimal` preset's tool list, and `snapshots/web/minimal-preset/tool-schemas.expected.json` records its bash-only tool table. `packages/schedule/schedule/tests/subagent-ownership.spec.ts` pins the delegation-depth refusal, and `scripts/optional-bundles.spec.ts` asserts that both delegation rows in the three presets omit `toolFilter`. The Web preset e2e also checks equal parent/child tool schemas and refusal from all four reminder executors for fresh and seeded children. `snapshots/session/subagent-fork-schedule` records inherited reminder schemas and all four refusals through a real fork; its headless fixture supplies only Host service presence, with the complete Host wiring covered by the Web e2e. diff --git a/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.zh.md b/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.zh.md index 54a9e9a193..ef3f62f8c7 100644 --- a/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.zh.md +++ b/.agents/notes/implemented/architecture/2026-09-24-preset-scoped-schedule-tools.zh.md @@ -31,4 +31,4 @@ Status: implemented ## Testing -`packages/schedule/tool-schedule/tests/tool-schedule.spec.ts` 固定这四个定义及其错误映射,包括 `refuses every tool for a delegated child caller`。`apps/cli/tests/web-agent-presets.e2e.ts` 断言 `minimal` preset 的工具列表,`snapshots/web/minimal-preset/tool-schemas.expected.json` 记录其只含 `bash` 的工具表。`packages/schedule/schedule/tests/subagent-ownership.spec.ts` 固定委派深度拒绝,`scripts/optional-bundles.spec.ts` 断言三个 preset 的两行委派行都拒绝全部四个工具名。 +`packages/schedule/tool-schedule/tests/tool-schedule.spec.ts` 固定这四个定义及其错误映射,包括 `refuses every tool for a delegated child caller`。`apps/cli/tests/web-agent-presets.e2e.ts` 断言 `minimal` preset 的工具列表,`snapshots/web/minimal-preset/tool-schemas.expected.json` 记录其只含 `bash` 的工具表。`packages/schedule/schedule/tests/subagent-ownership.spec.ts` 固定委派深度拒绝,`scripts/optional-bundles.spec.ts` 断言三个 preset 的两行委派行都不含 `toolFilter`。Web preset e2e 还检查父子工具 schema 相等,且四个提醒执行器对新建和带种子的子级均拒绝执行。 `snapshots/session/subagent-fork-schedule` 通过真实 fork 记录继承的提醒 schema 和四次拒绝;其 headless fixture 只占位 Host 服务,完整 Host 接线由 Web e2e 覆盖。 diff --git a/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.i18n.yaml b/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.i18n.yaml index db07600fb7..4b3621d217 100644 --- a/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.i18n.yaml +++ b/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.i18n.yaml @@ -9,11 +9,11 @@ en: 97cd4f941fe8eaa5 zh: b3dabbd7020a8991 /agent-note-preset-owned-subagent-composition/decision: - en: b5d4094a6717d4d9 - zh: 8e712256a13fdc4c + en: 7dfefd4689562847 + zh: 0bbfd0a8ce41c9ac /agent-note-preset-owned-subagent-composition/alternatives-considered: - en: e8c558f14ee494d0 - zh: dcf35164f24fb215 + en: c87c4638a36cc45d + zh: ee2c8e044108f0eb /agent-note-preset-owned-subagent-composition/consequences: - en: bf5dc2338fb1a85c - zh: d9eb25c6b41013af + en: a7404d17d0a62ad9 + zh: 783a490d3aafc5ca diff --git a/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.md b/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.md index 25d28b33af..88f2b5ab9d 100644 --- a/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.md +++ b/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.md @@ -16,16 +16,16 @@ New subagent requests select an Agent Preset where the provider supports it. Per Released child descriptors keep their persona and filter fields, parsing, and cold-resume application. The [original composition note](../feature/2026-07-12-subagent-persona-tool-filter-and-depth.md) remains active for these historical semantics and the independent depth policy. The [spawn preset decision](../feature/2026-09-20-spawn-agent-preset-selection.md) continues to own selection and restoration identity. -The shipped child schedule deny lists are absent. Reminder schemas remain visible when inherited from the preset; each executor rejects delegated callers. This avoids that source of parent/fork schema differences. It establishes no measured provider cache-hit improvement and does not promise equality when other request inputs differ. +The shipped child schedule deny lists are absent. Reminder schemas remain visible when inherited from the preset; each executor rejects delegated callers. This avoids that source of parent/fork schema differences. Children receive four reminder schemas whose executors always refuse them. Neither their prompt cost nor a provider cache-hit improvement has been measured; other request inputs can still differ. ## Alternatives considered -**Move the filter into each preset.** This preserves two ways to select tool availability and has no shipped consumer after removing the redundant schedule deny lists. Plugin composition supplies the needed choice. +**Move the filter into each preset.** This preserves the schedule deny lists and independent fork tool trimming, but retains two configuration mechanisms for tool availability. New children use plugin composition; fork deliberately inherits the parent's tools. -**Keep per-request overrides alongside presets.** This retains independent fork overrides, but also retains precedence and provider capability flags for an unused configuration path. The removal deliberately gives up that flexibility for new children. +**Keep per-request overrides alongside presets.** This retains independent fork overrides, their precedence rules, and provider capability flags. A single composition mechanism is preferred over that flexibility for new children. **Delete historical descriptor fields with the request fields.** This would change or reject restored sessions. New-request simplification does not authorize rewriting released Session data. ## Consequences -Preset selection owns new child persona and tools. Fork cannot independently replace persona or trim inherited tools, and JavaScript configuration with the removed keys fails explicitly. Historical restoration retains its previous semantics. Focused tests cover removed-key diagnostics, historical persona/filter restoration, inherited reminder schemas and executor refusal; recorded sessions cover preset-owned tool availability and messaging guidance. +Preset selection owns new child persona and tools. Fork cannot independently replace persona or trim inherited tools, and JavaScript configuration with the removed keys fails explicitly. Historical restoration retains its previous semantics. Focused tests cover removed-key diagnostics, historical persona/filter restoration, inherited reminder schemas and executor refusal; recorded sessions cover preset-owned tool availability, fork reminder refusals, and messaging guidance. diff --git a/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.zh.md b/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.zh.md index cc54b772de..c81919e7d8 100644 --- a/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.zh.md +++ b/.agents/notes/implemented/simplification/2026-10-09-preset-owned-subagent-composition.zh.md @@ -16,16 +16,16 @@ Agent Preset 已经组合 persona 和工具插件。独立的子级 persona 和 已发布的子级 descriptor 保留 persona 和 filter 字段、解析及冷恢复应用。[原组装记录](../feature/2026-07-12-subagent-persona-tool-filter-and-depth.zh.md)继续保留,以说明这些历史语义及独立的深度策略。[spawn preset 决策](../feature/2026-09-20-spawn-agent-preset-selection.zh.md)继续拥有选择与恢复身份的依据。 -已交付配置中不含子级 schedule deny 列表。从 preset 继承的提醒 schema 仍然可见;每个执行器拒绝委派调用方。这消除了一处父级与 fork 子级 schema 差异的来源,但不代表测得了提供方缓存命中率改善,也不保证其他请求输入不同时仍然相等。 +已交付配置中不含子级 schedule deny 列表。从 preset 继承的提醒 schema 仍然可见;每个执行器拒绝委派调用方。这消除了一处父级与 fork 子级 schema 差异的来源。子级会收到四个始终拒绝其调用的提醒 schema;尚未测量它们的提示成本或提供方缓存命中率改善,其他请求输入仍可能不同。 ## 曾考虑的替代方案 -**把过滤器移入各 preset。** 这保留了两种选择工具可用性的方式,且移除重复的 schedule deny 列表后没有已交付消费者。插件组装已能提供所需选择。 +**把过滤器移入各 preset。** 这保留了 schedule deny 列表和独立裁剪 fork 工具的能力,但仍有两种配置工具可用性的机制。新子级使用插件组装;fork 明确继承父级工具。 -**在 preset 之外保留逐请求覆盖。** 这保留独立的 fork 覆盖,也保留了未使用配置路径的优先级和提供方能力标志。此次删除明确放弃新子级的这项灵活性。 +**在 preset 之外保留逐请求覆盖。** 这保留独立的 fork 覆盖、覆盖优先级规则和提供方能力标志。对新子级选择单一组装机制,放弃这项灵活性。 **随请求字段一起删除历史 descriptor 字段。** 这会改变或拒绝恢复的会话。简化新请求不意味着可以重写已发布的 Session 数据。 ## 后果 -preset 选择拥有新子级的 persona 和工具。fork 不能独立替换 persona 或裁剪继承工具,含已删除键的 JavaScript 配置会明确报错。历史恢复保留原有语义。针对性测试覆盖删除键的诊断、历史 persona/filter 恢复、继承的提醒 schema 及执行器拒绝;会话录制覆盖由 preset 控制的工具可用性和消息指引。 +preset 选择拥有新子级的 persona 和工具。fork 不能独立替换 persona 或裁剪继承工具,含已删除键的 JavaScript 配置会明确报错。历史恢复保留原有语义。针对性测试覆盖删除键的诊断、历史 persona/filter 恢复、继承的提醒 schema 及执行器拒绝;会话录制覆盖由 preset 控制的工具可用性、fork 提醒拒绝及消息指引。 diff --git a/packages/schedule/tool-schedule/tests/fixtures/refused-schedule-service.ts b/packages/schedule/tool-schedule/tests/fixtures/refused-schedule-service.ts new file mode 100644 index 0000000000..11d303ed02 --- /dev/null +++ b/packages/schedule/tool-schedule/tests/fixtures/refused-schedule-service.ts @@ -0,0 +1,15 @@ +/** Headless snapshot service placeholder: delegated calls must stop at the tool guard. */ +import type { Context } from '@deepseek-ai/cordis' +import type ScheduleService from '@deepseek-ai/dsh-schedule' + +/** Plugin identity for the refusal-only snapshot fixture. */ +export const name = 'refused-schedule-service' + +/** + * Supply the service presence needed to register the real reminder tools. + * No Host operation is implemented: reaching one yields a different recorded result. + * @param ctx - Isolated snapshot context. + */ +export function apply(ctx: Context): void { + ctx.provide('schedule', {} as ScheduleService) +} diff --git a/snapshots/session/subagent-fork-schedule/cordis.snapshot.yml b/snapshots/session/subagent-fork-schedule/cordis.snapshot.yml new file mode 100644 index 0000000000..bea68fa53d --- /dev/null +++ b/snapshots/session/subagent-fork-schedule/cordis.snapshot.yml @@ -0,0 +1,57 @@ +# Replay patch shared by the ordinary headless snapshot composition. The model +# script comes from the scenario's committed session JSONL. + +- id: llm-deepseek + name: '@deepseek-ai/dsh-llm-deepseek-api-key' + disabled: true + +- id: plugin-package-inventory-deepseek + disabled: true + +- id: session-title-llm + disabled: true + +- id: session-persistence-jsonl + name: '@deepseek-ai/dsh-session-persistence-jsonl' + config: + root: !!js dshHomePath('sessions') + compression: none + +- id: sandbox + name: '@deepseek-ai/dsh-sandbox-local' + config: + runnerCommand: + - bash + - -c + - while [ "$1" != "--" ]; do shift; done; shift; exec "$@" + - passthrough-runner + runnerFailureSignatures: + - 'passthrough-runner: profile rejected' + +- insert: + - id: llm-replay + name: '@deepseek-ai/dsh-llm-replay' + config: + providers: + - id: deepseek-official + name: DeepSeek + models: + - id: deepseek-v4-flash + - id: deepseek-v4-pro + +# Reminder execution is refused before the Host Schedule service is used. +- insert: + - id: refused-schedule-service + name: '../../../packages/schedule/tool-schedule/tests/fixtures/refused-schedule-service.ts' + - id: agent-preset-registry + name: '@deepseek-ai/dsh-agent-preset-registry' + config: + default: parent + - id: preset-parent + name: '@deepseek-ai/dsh-agent-preset' + config: + id: parent + plugins: + - name: '@deepseek-ai/dsh-tool-schedule' + - id: parent-agent-preset + name: '../../../packages/test-support/session-snapshot/tests/fixtures/parent-agent-preset.ts' diff --git a/snapshots/session/subagent-fork-schedule/cordis.yml b/snapshots/session/subagent-fork-schedule/cordis.yml new file mode 100644 index 0000000000..b721203090 --- /dev/null +++ b/snapshots/session/subagent-fork-schedule/cordis.yml @@ -0,0 +1,16 @@ +# Reminder execution is refused before the Host Schedule service is used. +- insert: + - id: refused-schedule-service + name: '../../../packages/schedule/tool-schedule/tests/fixtures/refused-schedule-service.ts' + - id: agent-preset-registry + name: '@deepseek-ai/dsh-agent-preset-registry' + config: + default: parent + - id: preset-parent + name: '@deepseek-ai/dsh-agent-preset' + config: + id: parent + plugins: + - name: '@deepseek-ai/dsh-tool-schedule' + - id: parent-agent-preset + name: '../../../packages/test-support/session-snapshot/tests/fixtures/parent-agent-preset.ts' diff --git a/snapshots/session/subagent-fork-schedule/session.1.v4.jsonl b/snapshots/session/subagent-fork-schedule/session.1.v4.jsonl new file mode 100644 index 0000000000..3f2fd00014 --- /dev/null +++ b/snapshots/session/subagent-fork-schedule/session.1.v4.jsonl @@ -0,0 +1,29 @@ +{"type":"session","version":4,"id":"{{session:2}}","createdAt":1791518804000,"cwd":"{{cwd}}","parentSession":"{{session:1}}","isSeeded":false,"origin":"subagent","delegationDepth":1,"agentPreset":"parent"} +{"type":"subagent/descriptor","data":{"version":3,"mode":"continuable","provider":"fork","label":"Check child reminder refusal","agentProvider":"deepseek-official","agentModel":"deepseek-v4-flash"}} +{"type":"sandbox/mode","data":{"mode":"danger-full-access","source":"delegation"}} +{"type":"approval/policy","data":{"policy":"never","source":"delegation"}} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE."},{"type":"text","text":"Your parent agent id is \"{{session:1}}\". Before you finish, send your result to that agent with send_message({ agent_id: \"{{session:1}}\", message: \"\" }). The parent shares your workspace but does not automatically receive your transcript, tool output, or reasoning. Send earlier messages as well when a finding changes what the parent should do next; sending a message does not end your turn."}],"source":{"kind":"user"},"role":"user","id":"{{message:9}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{message:10}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE."},{"type":"text","text":"Your parent agent id is \"{{session:1}}\". Before you finish, send your result to that agent with send_message({ agent_id: \"{{session:1}}\", message: \"\" }). The parent shares your workspace but does not automatically receive your transcript, tool output, or reasoning. Send earlier messages as well when a finding changes what the parent should do next; sending a message does not end your turn."}],"source":{"kind":"user"},"role":"user","id":"{{message:9}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nYou are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"subagent:delegation","text":"You are a delegated subagent: your permission scope was fixed when you were started and cannot be widened from inside this session — operations that require approval are rejected automatically. When the task needs access beyond that scope, do not retry the denied operation; state the limitation in your reply so the delegating agent can handle it."}]},"role":"user","id":"{{message:11}}"},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}} +{"type":"session/title","data":{"title":"Call schedule_create, schedule_list, sch","messageSeqs":[9],"source":{"kind":"fallback"}}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_schedule_create","name":"schedule_create","arguments":"{\"title\":\"Child reminder\",\"prompt\":\"Check this\",\"after_seconds\":60}"},{"type":"tool-call","id":"call_schedule_list","name":"schedule_list","arguments":"{}"},{"type":"tool-call","id":"call_schedule_update","name":"schedule_update","arguments":"{\"id\":\"missing-reminder\",\"title\":\"Updated\"}"},{"type":"tool-call","id":"call_schedule_delete","name":"schedule_delete","arguments":"{\"id\":\"missing-reminder\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:12}}"},"stream":[{"type":"chunk","time":1791525769050,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1791525769050,"index":0,"dt":[],"id":"call_schedule_create","name":"schedule_create","args":["{\"title\":\"Child reminder\",\"prompt\":\"Check this\",\"after_seconds\":60}"]},{"type":"chunk","time":1791525769050,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_schedule_create","name":"schedule_create","arguments":"{\"title\":\"Child reminder\",\"prompt\":\"Check this\",\"after_seconds\":60}"}}},{"type":"chunk","time":1791525769050,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1791525769050,"index":1,"dt":[],"id":"call_schedule_list","name":"schedule_list","args":["{}"]},{"type":"chunk","time":1791525769050,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_schedule_list","name":"schedule_list","arguments":"{}"}}},{"type":"chunk","time":1791525769050,"chunk":{"type":"block-start","index":2,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1791525769050,"index":2,"dt":[],"id":"call_schedule_update","name":"schedule_update","args":["{\"id\":\"missing-reminder\",\"title\":\"Updated\"}"]},{"type":"chunk","time":1791525769050,"chunk":{"type":"block-end","index":2,"block":{"type":"tool-call","id":"call_schedule_update","name":"schedule_update","arguments":"{\"id\":\"missing-reminder\",\"title\":\"Updated\"}"}}},{"type":"chunk","time":1791525769050,"chunk":{"type":"block-start","index":3,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1791525769050,"index":3,"dt":[],"id":"call_schedule_delete","name":"schedule_delete","args":["{\"id\":\"missing-reminder\"}"]},{"type":"chunk","time":1791525769050,"chunk":{"type":"block-end","index":3,"block":{"type":"tool-call","id":"call_schedule_delete","name":"schedule_delete","arguments":"{\"id\":\"missing-reminder\"}"}}},{"type":"chunk","time":1791525769050,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_schedule_create","name":"schedule_create","arguments":"{\"title\":\"Child reminder\",\"prompt\":\"Check this\",\"after_seconds\":60}"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_schedule_create"},"toolCallId":"call_schedule_create","content":[{"type":"text","text":"{\"code\":\"subagent_session\",\"message\":\"A delegated subagent cannot use reminders.\"}"}],"isError":false,"id":"{{message:13}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_schedule_list","name":"schedule_list","arguments":"{}"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_schedule_list"},"toolCallId":"call_schedule_list","content":[{"type":"text","text":"{\"code\":\"subagent_session\",\"message\":\"A delegated subagent cannot use reminders.\"}"}],"isError":false,"id":"{{message:14}}"}},"sourceEventSeqs":[17],"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_schedule_update","name":"schedule_update","arguments":"{\"id\":\"missing-reminder\",\"title\":\"Updated\"}"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_schedule_update"},"toolCallId":"call_schedule_update","content":[{"type":"text","text":"{\"code\":\"subagent_session\",\"message\":\"A delegated subagent cannot use reminders.\"}"}],"isError":false,"id":"{{message:15}}"}},"sourceEventSeqs":[19],"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_schedule_delete","name":"schedule_delete","arguments":"{\"id\":\"missing-reminder\"}"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_schedule_delete"},"toolCallId":"call_schedule_delete","content":[{"type":"text","text":"{\"code\":\"subagent_session\",\"message\":\"A delegated subagent cannot use reminders.\"}"}],"isError":false,"id":"{{message:16}}"}},"sourceEventSeqs":[21],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"step/start","data":{"turn":1,"step":2}} +{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"text","text":"CHILD_DONE"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:17}}"},"stream":[{"type":"chunk","time":1791525769083,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":1791525769083,"index":0,"dt":[],"texts":["CHILD_DONE"]},{"type":"chunk","time":1791525769083,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"CHILD_DONE"}}},{"type":"chunk","time":1791525769083,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":2}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} diff --git a/snapshots/session/subagent-fork-schedule/session.v4.jsonl b/snapshots/session/subagent-fork-schedule/session.v4.jsonl new file mode 100644 index 0000000000..2f9579e712 --- /dev/null +++ b/snapshots/session/subagent-fork-schedule/session.v4.jsonl @@ -0,0 +1,32 @@ +{"type":"session","version":4,"id":"{{session:1}}","createdAt":1791518804000,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0} +{"type":"permission/preset","data":{"preset":"danger-full-access"}} +{"type":"sandbox/mode","data":{"mode":"danger-full-access"}} +{"type":"approval/policy","data":{"policy":"never"}} +{"type":"agent-preset/selected","data":{"agentPreset":"parent"}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Use subagent_fork once to delegate this task: Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE. Reply PARENT_DONE after starting it and after its completion notice."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"}]}} +{"type":"turn/start","data":{"turn":1}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"step/start","data":{"turn":1,"step":1}} +{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{message:2}}"}},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Use subagent_fork once to delegate this task: Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE. Reply PARENT_DONE after starting it and after its completion notice."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{message:3}}"},"surfaceOp":"append"} +{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}} +{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}} +{"type":"session/title","data":{"title":"Use subagent_fork once to delegate","messageSeqs":[9],"source":{"kind":"fallback"}}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"tool-call","id":"call_subagent_fork","name":"subagent_fork","arguments":"{\"description\":\"Check child reminder refusal\",\"prompt\":\"Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE.\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:4}}"},"stream":[{"type":"chunk","time":1791525769001,"chunk":{"type":"block-start","index":0,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1791525769001,"index":0,"dt":[],"id":"call_subagent_fork","name":"subagent_fork","args":["{\"description\":\"Check child reminder refusal\",\"prompt\":\"Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE.\"}"]},{"type":"chunk","time":1791525769001,"chunk":{"type":"block-end","index":0,"block":{"type":"tool-call","id":"call_subagent_fork","name":"subagent_fork","arguments":"{\"description\":\"Check child reminder refusal\",\"prompt\":\"Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE.\"}"}}},{"type":"chunk","time":1791525769001,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_subagent_fork","name":"subagent_fork","arguments":"{\"description\":\"Check child reminder refusal\",\"prompt\":\"Call schedule_create, schedule_list, schedule_update, and schedule_delete once each, then reply CHILD_DONE.\"}"}} +{"type":"subagent/catalog","data":{"version":0,"childId":"{{session:2}}","childCreatedAt":1791525769008,"mode":"continuable","label":"Check child reminder refusal"}} +{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_subagent_fork"},"toolCallId":"call_subagent_fork","content":[{"type":"text","text":"started subagent {{session:2}}"}],"isError":false,"id":"{{message:5}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":1}} +{"type":"step/start","data":{"turn":1,"step":2}} +{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"text","text":"PARENT_DONE"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:6}}"},"stream":[{"type":"chunk","time":1791525769041,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":1791525769041,"index":0,"dt":[],"texts":["PARENT_DONE"]},{"type":"chunk","time":1791525769041,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"PARENT_DONE"}}},{"type":"chunk","time":1791525769041,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":1,"step":2}} +{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Background subagent {{session:2}} finished and will do no further work unless you send it more."},{"type":"text","text":"Its closing message:"},{"type":"text","text":"CHILD_DONE"}],"source":{"kind":"subagent-settled","form":"notice","summary":"Background subagent {{session:2}} finished and will do no further work unless you send it more.","senderSessionId":"{{session:2}}"},"role":"user","id":"{{message:7}}"}]}} +{"type":"turn/start","data":{"turn":2}} +{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}} +{"type":"step/start","data":{"turn":2,"step":1}} +{"type":"user/message","data":{"content":[{"type":"text","text":"Background subagent {{session:2}} finished and will do no further work unless you send it more."},{"type":"text","text":"Its closing message:"},{"type":"text","text":"CHILD_DONE"}],"source":{"kind":"subagent-settled","form":"notice","summary":"Background subagent {{session:2}} finished and will do no further work unless you send it more.","senderSessionId":"{{session:2}}"},"role":"user","id":"{{message:7}}"},"surfaceOp":"append"} +{"type":"assistant/message","data":{"turn":2,"step":1,"message":{"role":"assistant","content":[{"type":"text","text":"PARENT_DONE"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:8}}"},"stream":[{"type":"chunk","time":1791525769106,"chunk":{"type":"block-start","index":0,"blockType":"text"}},{"type":"text-chunks","time0":1791525769106,"index":0,"dt":[],"texts":["PARENT_DONE"]},{"type":"chunk","time":1791525769106,"chunk":{"type":"block-end","index":0,"block":{"type":"text","text":"PARENT_DONE"}}},{"type":"chunk","time":1791525769106,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"} +{"type":"step/end","data":{"turn":2,"step":1}} +{"type":"turn/end","data":{"turn":2,"reason":{"kind":"completed"}}} diff --git a/snapshots/session/subagent-fork-schedule/snapshot.yml b/snapshots/session/subagent-fork-schedule/snapshot.yml new file mode 100644 index 0000000000..4b47b97dfc --- /dev/null +++ b/snapshots/session/subagent-fork-schedule/snapshot.yml @@ -0,0 +1,9 @@ +version: 1 +scenario: subagent-fork-schedule +profile: headless +composition: subagent-fork-schedule +recording: authored +header: + class: subagent-fork-schedule + pin: true + systemPromptSource: text-turn diff --git a/snapshots/session/subagent-tool-filter/tool-schemas.expected.json b/snapshots/session/subagent-fork-schedule/tool-schemas.expected.json similarity index 74% rename from snapshots/session/subagent-tool-filter/tool-schemas.expected.json rename to snapshots/session/subagent-fork-schedule/tool-schemas.expected.json index 2b4b1f069f..4bdc1f9aca 100644 --- a/snapshots/session/subagent-tool-filter/tool-schemas.expected.json +++ b/snapshots/session/subagent-fork-schedule/tool-schemas.expected.json @@ -300,6 +300,273 @@ ] } }, + { + "name": "schedule_create", + "description": "Create a reminder in the current session that delivers prompt when it becomes due. Supply exactly one timing parameter: after_seconds, at, every_seconds, daily, weekly, or cron. Local times that do not exist in the zone are skipped; repeated local times fire once, at the earlier instant. After downtime, a recurring reminder delivers only its latest missed occurrence. Delivery can repeat after a crash.", + "parameters": { + "type": "object", + "properties": { + "prompt": { + "type": "string", + "description": "Reminder content to present when the target becomes due." + }, + "title": { + "type": "string", + "description": "Task name of at most 120 characters, shown on the task card and in task lists." + }, + "after_seconds": { + "type": "number", + "description": "Delay in whole seconds." + }, + "every_seconds": { + "type": "number", + "description": "Fixed-rate interval in whole seconds, at least 60, aligned to the creation time; changing it with schedule_update re-aligns it to the save time." + }, + "daily": { + "type": "object", + "description": "Every day at a local time.", + "additionalProperties": false, + "properties": { + "time": { + "type": "string", + "description": "HH:mm:ss with optional 1-3 fractional digits, for example 23:00:00." + }, + "time_zone": { + "type": "string", + "description": "UTC or IANA Area/Location, for example Asia/Shanghai." + } + }, + "required": [ + "time", + "time_zone" + ] + }, + "weekly": { + "type": "object", + "description": "On the given weekdays at a local time.", + "additionalProperties": false, + "properties": { + "time": { + "type": "string", + "description": "HH:mm:ss with optional 1-3 fractional digits, for example 09:00:00." + }, + "time_zone": { + "type": "string", + "description": "UTC or IANA Area/Location, for example Asia/Shanghai." + }, + "weekdays": { + "type": "array", + "description": "ISO weekdays, Monday 1 through Sunday 7, without repetitions.", + "items": { + "type": "integer" + } + } + }, + "required": [ + "time", + "time_zone", + "weekdays" + ] + }, + "cron": { + "type": "object", + "description": "Five-field Vixie cron expression in a time zone.", + "additionalProperties": false, + "properties": { + "expression": { + "type": "string", + "description": "minute hour day-of-month month day-of-week, for example \"*/15 9-17 * * 1-5\". When both day fields are restricted, a date matches if either one matches." + }, + "time_zone": { + "type": "string", + "description": "UTC or IANA Area/Location, for example Asia/Shanghai." + } + }, + "required": [ + "expression", + "time_zone" + ] + }, + "at": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "date": { + "type": "string" + }, + "time": { + "type": "string" + }, + "time_zone": { + "type": "string" + } + }, + "required": [ + "date", + "time", + "time_zone" + ] + } + ], + "description": "Absolute target: an RFC 3339 date-time with offset, or a local date, time, and IANA time_zone." + } + }, + "required": [ + "prompt", + "title" + ] + } + }, + { + "name": "schedule_delete", + "description": "Delete a reminder in the current session, active or inactive. Deletion does not retract a reminder message that is already queued.", + "parameters": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Exact schedule id." + } + }, + "required": [ + "id" + ] + } + }, + { + "name": "schedule_list", + "description": "List the active reminders in the current session.", + "parameters": { + "type": "object", + "properties": {} + } + }, + { + "name": "schedule_update", + "description": "Change a reminder in place, keeping its id. Supply a new title, prompt, or at most one timing parameter; omitted fields keep their stored values. To change a relative delay, create a new reminder.", + "parameters": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Schedule id returned by schedule_list." + }, + "title": { + "type": "string", + "description": "New task name of at most 120 characters." + }, + "prompt": { + "type": "string", + "description": "New reminder content." + }, + "every_seconds": { + "type": "number", + "description": "Fixed-rate interval in whole seconds, at least 60, aligned to the creation time; changing it with schedule_update re-aligns it to the save time." + }, + "daily": { + "type": "object", + "description": "Every day at a local time.", + "additionalProperties": false, + "properties": { + "time": { + "type": "string", + "description": "HH:mm:ss with optional 1-3 fractional digits, for example 23:00:00." + }, + "time_zone": { + "type": "string", + "description": "UTC or IANA Area/Location, for example Asia/Shanghai." + } + }, + "required": [ + "time", + "time_zone" + ] + }, + "weekly": { + "type": "object", + "description": "On the given weekdays at a local time.", + "additionalProperties": false, + "properties": { + "time": { + "type": "string", + "description": "HH:mm:ss with optional 1-3 fractional digits, for example 09:00:00." + }, + "time_zone": { + "type": "string", + "description": "UTC or IANA Area/Location, for example Asia/Shanghai." + }, + "weekdays": { + "type": "array", + "description": "ISO weekdays, Monday 1 through Sunday 7, without repetitions.", + "items": { + "type": "integer" + } + } + }, + "required": [ + "time", + "time_zone", + "weekdays" + ] + }, + "cron": { + "type": "object", + "description": "Five-field Vixie cron expression in a time zone.", + "additionalProperties": false, + "properties": { + "expression": { + "type": "string", + "description": "minute hour day-of-month month day-of-week, for example \"*/15 9-17 * * 1-5\". When both day fields are restricted, a date matches if either one matches." + }, + "time_zone": { + "type": "string", + "description": "UTC or IANA Area/Location, for example Asia/Shanghai." + } + }, + "required": [ + "expression", + "time_zone" + ] + }, + "at": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "date": { + "type": "string" + }, + "time": { + "type": "string" + }, + "time_zone": { + "type": "string" + } + }, + "required": [ + "date", + "time", + "time_zone" + ] + } + ], + "description": "Absolute target: an RFC 3339 date-time with offset, or a local date, time, and IANA time_zone." + } + }, + "required": [ + "id" + ] + } + }, { "name": "send_message", "description": "Send a message to an agent. A working agent receives it at its next step; an idle agent starts a new turn with it. Returns delivery confirmation, not the agent's answer.", diff --git a/snapshots/session/subagent-no-message-tool/snapshot.yml b/snapshots/session/subagent-no-message-tool/snapshot.yml index 72b716c8d2..832379c3f2 100644 --- a/snapshots/session/subagent-no-message-tool/snapshot.yml +++ b/snapshots/session/subagent-no-message-tool/snapshot.yml @@ -7,6 +7,6 @@ header: class: subagent-no-message-tool pin: true systemPromptSource: text-turn + toolSchemasSource: text-turn childSystemPrompts: [1] childToolSchemas: [1] - toolSchemasSource: subagent-tool-filter diff --git a/snapshots/session/subagent-tool-filter/snapshot.yml b/snapshots/session/subagent-tool-filter/snapshot.yml index 188732b53a..b6a97998d9 100644 --- a/snapshots/session/subagent-tool-filter/snapshot.yml +++ b/snapshots/session/subagent-tool-filter/snapshot.yml @@ -7,5 +7,6 @@ header: class: subagent-tool-filter pin: true systemPromptSource: text-turn + toolSchemasSource: text-turn childSystemPrompts: [1] childToolSchemas: [1]