fix(agent-core): make delegation schemas provider-safe - #17
Conversation
📝 WalkthroughWalkthroughChangesDelegation authority now uses immutable target, profile, Skill, parent, and depth snapshots. Model-facing schemas are projected from those capabilities. Skill discovery supports authorized target catalogs. Session creation, resume, and recovery validate capabilities before exposing Skills or creating child state. Delegation and Skill contract updates
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/agent-core/src/agents/configured-agent.test.ts`:
- Around line 273-286: Align the test helper’s delegation target condition with
the runtime factory: require the resolved `delegate` capability/tool to be
allowed before building delegationTargets. Update the canDelegate logic around
options.definition.childPolicy and defaultAgentDefinitions so missing or
unresolvable delegate configuration produces no targets and preserves
fail-closed behavior.
In `@packages/agent-core/src/tools/builtins/skill-list.test.ts`:
- Around line 225-230: Update the test named “input schema accepts delegated
targets and rejects unknown keys or roles” to assert that
SkillListInputSchema.safeParse rejects an input containing an unsupported field,
preserving the existing valid-target and invalid-role assertions and explicitly
covering the .strict() contract.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 12270338-1bc0-42c0-99ab-c6b64a442d5f
📒 Files selected for processing (29)
AGENTS.mddocs/goals/provider-safe-delegation-skill-contract-plan-goal.mddocs/goals/provider-safe-delegation-skill-contract-progress.mdpackages/agent-core/src/agents/configured-agent.test.tspackages/agent-core/src/agents/configured-agent.tspackages/agent-core/src/agents/constants.tspackages/agent-core/src/agents/errors.tspackages/agent-core/src/agents/factory-types.tspackages/agent-core/src/agents/factory.test.tspackages/agent-core/src/agents/factory.tspackages/agent-core/src/agents/index.tspackages/agent-core/src/agents/model-tool-projection.test.tspackages/agent-core/src/agents/model-tool-projection.tspackages/agent-core/src/agents/query/loop.tspackages/agent-core/src/agents/query/types.tspackages/agent-core/src/agents/session-agent-manager.test.tspackages/agent-core/src/delegation/contract.test.tspackages/agent-core/src/delegation/schema.tspackages/agent-core/src/execution/session-execution-manager.test.tspackages/agent-core/src/execution/session-execution-manager.tspackages/agent-core/src/execution/session-tool-batch-scheduler.test.tspackages/agent-core/src/tools/builtins/delegate.test.tspackages/agent-core/src/tools/builtins/delegate.tspackages/agent-core/src/tools/builtins/model-visible-contract.test.tspackages/agent-core/src/tools/builtins/skill-list.test.tspackages/agent-core/src/tools/builtins/skill-list.tspackages/agent-core/src/tools/builtins/skill-read.test.tspackages/agent-core/src/tools/builtins/skill-read.tspackages/agent-core/src/tools/types.ts
💤 Files with no reviewable changes (2)
- packages/agent-core/src/agents/constants.ts
- packages/agent-core/src/agents/errors.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/agent-core/src/runtime-skill-command.test.ts`:
- Around line 85-97: Update waitForFamilyIdle to check the session family’s
current activity immediately after subscribing by calling
runtime.getSessionFamilyActivity with workspaceRoot and rootSessionId. If the
result is "idle", unsubscribe and resolve the Promise; otherwise continue
waiting for the matching idle event, following the synchronous-check pattern
used in lead-architecture-flows.integration.test.ts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: be35ccc3-fe46-409a-b8dd-e2c7588b42c8
📒 Files selected for processing (2)
packages/agent-core/src/agents/configured-agent.test.tspackages/agent-core/src/runtime-skill-command.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/agent-core/src/agents/configured-agent.test.ts
Summary
delegateandskill_listschemas at the model boundaryRoot cause
Strict internal Skill-name regexes and static delegation contracts were being exposed directly to Providers. The default Provider rejected the regex lookaround before model execution, while target/Profile/Skill authority was split across multiple runtime paths.
Validation
bun run typecheckbun run testbun run buildgit diff --checkgpt-5.6-sol(max)review: PASSSummary by CodeRabbit