fix: scope architect-guarded early-return to fix backward-compat regression#959
Merged
Conversation
Agent-Logs-Url: https://github.com/zaxbysauce/opencode-swarm/sessions/320df4d2-464f-45b1-a887-2a21cca8c2b9 Co-authored-by: zaxbysauce <10211642+zaxbysauce@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with architect changing evidence files
Harden shell-write guardrails to block architect evidence-file bypasses
May 21, 2026
added 3 commits
May 21, 2026 21:45
…ession The original PR #959 fix removed the blanket early-return from checkShellWriteScope to close the architect evidence-file bypass, but this broke backward compatibility for non-architect agents (coder, etc.) who relied on 'no scope = allow all' behavior. This commit adds an architect-guarded early-return: - Architect agents always run full authority checks (closes bypass) - Non-architect agents without scope preserve original behavior (backward compat) - stripKnownSwarmPrefix handles multi-swarm prefixed names (mega_architect, lowtier_architect) Test changes: - Updated 13 'outside declared scope' expectations to match the new authority-before-scope error messages - Added 4 compensating tests: positive architect, with-scope, mega_architect, lowtier_architect Resolves: 15 test failures (2 backward-compat regressions + 13 error message updates)
…file-changes # Conflicts: # dist/cli/index.js # dist/index.js # docs/releases/pending/shell-write-interception-regression.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shell write enforcement had a gap: when no declared scope was present,
bash/shellwrite paths skipped agent authority checks and could still mutate blocked targets (e.g..swarm/evidence/*.json). This change aligns shell-write enforcement with write/edit/patch authority behavior so blocked zones remain blocked regardless of scope state.Root cause addressed: scope-only gate in shell write path
checkShellWriteScope(...)previously returned early whendeclaredScopewas empty, which bypassed per-agent file authority evaluation for shell commands.Guardrail hardening in
src/hooks/guardrails.tscheckFileAuthorityWithRules(...)for each resolved shell write target before scope checks.Regression coverage in
tests/unit/hooks/guardrails-shell-write.test.ts.swarm/evidence/5.4.jsonpython3 -c ...