fix(agent-runtime): restore deferred ToolSearch activations - #922
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Fix canonical marker precedence and refresh restored tools after compaction.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Restores deferred ToolSearch activations across prompts and runtime reloads.
Changes:
- Persists canonical activation markers with legacy compatibility.
- Adds runtime and delegation-history regression coverage.
- Updates English and Chinese specifications.
| File | Summary |
|---|---|
packages/agent-runtime/src/runtime.ts |
Restores and persists activation markers. |
packages/agent-runtime/src/runtime.test.ts |
Tests runtime restoration behavior. |
packages/agent-runtime/src/delegation-history.ts |
Migrates legacy markers during resume. |
packages/agent-runtime/src/delegation-history.test.ts |
Tests delegation-history compatibility. |
docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md |
Updates Chinese E2E expectations. |
docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md |
Updates Chinese tool contracts. |
docs/zh-CN/spec/03-runtime/02-agent-runtime.md |
Updates Chinese runtime behavior. |
docs/spec/06-delivery/04-e2e-test-plan.md |
Updates English E2E expectations. |
docs/spec/03-runtime/03-tools-and-permissions.md |
Updates English tool contracts. |
docs/spec/03-runtime/02-agent-runtime.md |
Updates English runtime behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const details = | ||
| legacyAddedToolNames.length > 0 | ||
| ? { | ||
| ...(isRecord(rawDetails) ? rawDetails : {}), | ||
| addedToolNames: [...new Set(legacyAddedToolNames)], | ||
| } | ||
| : rawDetails; |
There was a problem hiding this comment.
Fixed in cd3af1c. Delegate history now only promotes legacy top-level addedToolNames when details.addedToolNames has no valid names; canonical persisted markers remain authoritative. Added a regression assertion with divergent canonical and legacy arrays.
|
Review follow-up: cd3af1c preserves canonical details.addedToolNames when legacy top-level markers disagree; legacy values are only promoted when canonical names are absent. Targeted agent-runtime tests (284/284), typecheck, lint, and pnpm test:e2e:subagent-models all pass on the updated commit. |
|
All required CI checks pass. I attempted the repository merge workflow, but GitHub returned |
|
Merged into |

Summary
Fixes #913.
The cache-prefix observation in the issue is left separate because this change addresses the reproduced field mismatch directly; no unverified cache diagnosis was added.
Validation