fix(task): preserve explicit todo permissions for subagents#19142
fix(task): preserve explicit todo permissions for subagents#19142Haohao-end wants to merge 1 commit intoanomalyco:devfrom
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found a related PR that might be addressing a similar issue: Potential Related PR:
These PRs might be addressing related aspects of the same permission system issue. You may want to review #19125 in particular to ensure there's no overlap in the fixes. |
|
Closing this since #19125 appears to cover the same issue and has active review already. I don’t want to duplicate work. |
Issue for this PR
Closes #19101
Type of change
What does this PR do?
This fixes a bug where subagents could not use
todowrite/todoreadeven when those permissions were explicitly allowed.The problem happened in two places in
packages/opencode/src/tool/task.ts:todowriteandtodoreadSessionPrompt.prompt(...)was also called withtodowrite: falseandtodoread: falseBecause later permission writes win, explicit subagent todo allows were getting overridden.
This change keeps the default behavior safe, but stops forcing todo denies when the subagent has an explicit allow for that permission:
todowriteis explicitly allowed, it is no longer denied in the child session or re-disabled inSessionPrompt.prompttodoreadis explicitly allowed, it is handled the same waytaskpermission behavior is left unchangedI also added regression tests covering:
todowriteallow onlytodowrite+todoreadallowHow did you verify your code works?
I verified the fix by tracing the permission flow through both layers involved in this bug:
task.tsSessionPrompt.prompt(...)I also added regression tests for the affected permission combinations.
I was not able to fully run the targeted tests in my current local environment because some repo dependencies/tools were missing (
zod,drizzle-orm/ bun sqlite migrator, andtsgofor typecheck), so I am not claiming a fully green local test run.Screenshots / recordings
Not a UI change.
Checklist