Skip to content

fix(permissions): write Reasonix agent rules under spawn_agents too - #3814

Merged
dyoshikawa merged 5 commits into
mainfrom
resolve-issue-2599-reasonix-spawn-agents
Nov 8, 2026
Merged

dyoshikawa merged 5 commits into
mainfrom
resolve-issue-2599-reasonix-spawn-agents

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Reasonix studio-v2.58.0 replaced the task delegation family (task, read_only_task, parallel_tasks, fleet) with a single spawn_agents tool (ad2c96347). rulesync wrote canonical agent only as task, and Reasonix matches rule tool names exactly, so on 2.58.0+ an agent ask/deny matched nothing.

Every agent rule is now written under both task and spawn_agents. Checked in the Reasonix source: permission lists are only checked for syntax (permrule.Parse, parseRules on v1.39.11, studio-v2.57.0 and studio-v2.58.0). A rule that names a tool the running build lacks is skipped, and v2.34.0+ reports it as dormant, so neither the old nor the new line rejects the extra name.

Changes

  • src/features/permissions/reasonix-permissions.ts: new CANONICAL_TO_EXTRA_REASONIX_TOOL_NAMES (agent → spawn_agents).
    • Generate emits each agent rule under both names, and both count as managed, so stale copies are replaced.
    • Import maps both names back to agent. When the two disagree, the stricter action wins (deny > ask > allow), so a hand-edited allow on one name cannot loosen a deny or ask on the other.
  • Pattern rules cannot widen anything: a spawn_agents(<glob>) rule never matches, because the call has no subject key (Reasonix: "A subject-specific rule cannot match a call that exposes no subject"). That is the same as task(<glob>) before this change.
  • Tests: updated the canonical mapping expectation, and added generate (both names, stale replacement) and import (both names, strictest wins) cases.
  • docs/reference/file-formats.md Reasonix permissions note, plus the regenerated docs-content.ts.

Verification

  • pnpm cicheck: green. All 614 test files pass, and the content checks pass once the change is committed.

Refs #2599

🤖 Generated with Claude Code

https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7

dyoshikawa and others added 5 commits November 8, 2026 20:45
Reasonix studio-v2.58.0 replaced the task delegation family with a single
spawn_agents tool, so an agent rule written only as `task` matched nothing
there. Write every canonical agent rule under both `task` (1.x, v2 up to
2.57.x) and `spawn_agents` (2.58.0+); Reasonix only checks rule syntax, so
the name the running build lacks is merely dormant. Import reads both back
as `agent`, with the stricter action winning when they disagree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
spawn_agents is now a managed name, so a stricter task/spawn_agents entry
written by hand is replaced on generate. Warn and list each replaced ask or
deny entry that the generated lists make looser. Document the replacement,
that pattern agent rules never match in Reasonix, and that the v2 Web UI
editor refuses newly added unknown-tool rules. Add round-trip and
mixed-spelling import tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
Move the warning into its own helper to keep fromRulesyncPermissions under
the complexity limit, and apply formatting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
Name the real source file and the raw override escape hatch in the
warning, and compare entries in rulesync's spelling so `name(*)` matches
the bare name. Cover a dropped pattern entry, a raw-kept deny and the
`name(*)` spelling in tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QUBBebviXSBQtiRAmDopZ7
…asonix-spawn-agents

# Conflicts:
#	src/generated/docs-content.ts
@dyoshikawa
dyoshikawa merged commit 9658cf0 into main Nov 8, 2026
10 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-2599-reasonix-spawn-agents branch November 8, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant