Repository navigation
Description
Guardrail class: G1 (system integrity), for commands the user rules out. Ruling 4 on #1636 asks for a command and tool audit with policy-based blocks.
Context
Delivered prerequisite outputs: #1651. Their output references remain relevant, but they are no longer active blockers.
Decision: docs/decisions/governed-writable-workers.md ("Tool and command audit").
- Every tool call's input is already recorded as an Activity span event (
"tool_input",packages/ui-server/src/activity/recorder.ts:268), and span detail is pruned after 7 days. - Confirmation patterns already raise an approval card in the mutating hook (
const mutatingHook,packages/ui-backend-claude/src/permission-hooks.ts:235). - Pi decides in the server (
decideToolPermission,packages/ui-backend-pi/src/worker-session.ts:297).
Scope
commands.denyfrom the policy refuses a matching Bash input in both adapters, before execution. The refusal names the policy rule and its reason.commands.confirmis added to the compiled confirmation patterns for the turn.- Each deny and each confirmation decision writes a governance event (
policy_block/policy_confirm) with the input, the rule and the attribution. It is retained with the session. - The capabilities note lists the active deny and confirm patterns.
Out of scope
- Outward-action classification (G5 sibling).
- A command allowlist mode.
Acceptance criteria
- With
deny: ^git push (-f|--force), a turn'sgit push --forceis refused in both adapters, and nothing executes. A test asserts this with a fake git on the path that would record the run. - A confirm pattern raises the existing card, and declining it refuses the command.
- Both cases produce governance events that survive the span-detail prune.
- Mutation receipt: skip the deny check in one adapter and its test fails.
Verification
Backend tests for both adapters, then bun run check:pr --base origin/main.
Contract impact
Additive minor: server-only BackendActivityEvent observations policy_block and policy_confirm feed the existing retained governance-event kinds. No new client frame, accepted policy key, CLI envelope field or execution authority. Update the package contract and API report in the implementation PR.
Blocked by #1650
Updated 2026-10-12: removed completed blocker declarations, retained delivered-output context and all remaining prerequisites; readiness and existing rulings preserved.
Updated 2026-10-12: verified current policy-reader candidate 2ff55fffe and refreshed the moved Activity and pi permission anchors; scope, acceptance criteria and #1650 dependency remain unchanged.
Activity
schlessera commentedon Oct 12, 2026
Claim:
commands-1661-20261012-78381f66; branchfeat/1661-policy-commands-78381f66. Coordinated implementation stacks on the immutable policy-reader candidate2ff55fffe80a56fb0cbc8971ecf4d8a43d4925e8from #1741. Existing #1650 dependency and blocked label remain until prerequisite merge. Scope is deny/confirm enforcement for actual Bash inputs in both adapters, existing approval authority/cards, retained governance records and active-pattern capability disclosure. Milestone: 0.42.0; any initial PR remains draft with Refs.schlessera commentedon Oct 12, 2026
2026-10-12 source correction: verified immutable policy-reader candidate 2ff55ff. Activity tool_input now starts at recorder.ts:268 and the pi server permission decision at worker-session.ts:297; folded these moved anchors into the body. Existing scope, acceptance criteria and Blocked by #1650 remain intact.
schlessera commentedon Oct 12, 2026
Unblocked: #1650 is closed, so
scripts/sync-project.tsis removing theblockedlabel.CONTRACT: feat(backends): enforce captured command policy (#1661)
fix(backends): omit empty policy note segments (#1661)
schlessera commentedon Oct 12, 2026
Merged in #1747 for milestone 0.42.0. Squash
52cbd1db182b618706cd7edca72159ba62768a63is present on main; its parent is966bed83and its tree exactly matches the verified candidate. The bounded journal, confirmed next-turn profile preferences and captured command policy are delivered; the diagnosed Search opening-focus fix is included.All 14 selected jobs passed in PR CI run38306139332, attempt1. Each actual job checked out
a45084c02c8e1986aeaeca75d3ad8c553eeb37d9, with verified main/head parents and tree. Behavioral mutations, real worker/browser receipts and preflight are recorded in the PR. All 14 selected main-push CI jobs also passed. Every actual job checkout was verified as squash52cbd1db182b618706cd7edca72159ba62768a63.Completing issues and PR are closed/merged with milestone0.42.0 read back. Coordinator claims for this delivery are released. Remaining programme work stays with its own issues; this is not a release publication or whole-programme completion claim.