fix(#173): pass agent info to TaskTool.init() for permission enforcement - #174
Conversation
randomm
left a comment
There was a problem hiding this comment.
✅ CODE REVIEW: APPROVED
⚠️ Cannot submit formal GitHub approval (same-author restriction). This is the code-review-specialist's verdict: APPROVE.
CI/CD: ✅ All checks passing (test: 1m16s)
Core Fix Review
The one-line fix in prompt.ts is correct and minimal:
constagentInfo=awaitAgent.get(task.agent)consttaskTool=awaitTaskTool.init({agent: agentInfo})Verification:
Agentis already imported at line 10 — no new imports neededAgent.get()returnsAgent.Info | undefined;InitContext.agentis typed asAgent.Info | undefined(optional) — types align perfectly- If
Agent.get()returnsundefined(impossible in practice sinceTaskTool.executevalidates the agent at line 162), the code degrades gracefully to the existing no-filtering behavior - The registry's
ToolRegistry.forPrompt()already passes{ agent }at line 158 for all other tools — this fix bringsTaskTool.init()in the subtask path into consistency with the standard tool init pattern - Single call site for
TaskTool.init()in the codebase — no other locations need updating
Secondary Changes
Test hardening (env var restore): Correct defensive pattern — delete when original was undefined instead of assigning undefined string. Prevents env pollution between test runs.
Preload mock fix:mockPlugin changed to async () => ({}) and gitlabAuthPlugin export added — forward-compatibility improvements, low risk.
Fork manifest:Agent.get(task.agent) added as criticalCode marker in async-tasks feature — correctly tracks fork divergence.
Risk: LOW
- 2 lines of production code changed
- Mechanically straightforward plumbing fix
- No new dependencies, no control flow changes
- Graceful degradation on edge cases
Uh oh!
There was an error while loading. Please reload this page.
Summary
Fixes#173 — granular task permissions (
permission.taskwith per-agent allow/deny) were never enforced becauseTaskTool.init()was called without the agent parameter.Changes
await Agent.get(task.agent)toTaskTool.init({ agent: agentInfo })so permission filtering activatesAgent.get(task.agent)as criticalCode marker in async-tasks featureVerification