Skip to content

feat(runtime): allow exact test commands in Claude writers - #222

Merged
datacas merged 2 commits into
mainfrom
issue-178-claude-allowed-commands
Oct 13, 2026
Merged

datacas merged 2 commits into
mainfrom
issue-178-claude-allowed-commands

Conversation

@datacas

@datacas datacas commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add code_cycle.allowed_commands.test as one exact command for native Claude implementation and resolution stages.
  • Reject unknown command keys, non-string or empty commands, wildcards, and shell operators during config loading before dispatch.
  • Pass the exact Bash(<command>) permission through --allowedTools and tell writing stages to use that command verbatim. Existing publication tools remain available on publishing stages.

Implements #178. Claude workers launched through Orca remain outside this setting's scope.

Diagnosis

This is a feature request, so defect reproduction does not apply. The current adapter gives Claude's publishing stages Bash(gh:*) and Bash(git:*), but no repository-configured test command. The implementation adds the permission at the native Claude adapter boundary only for writing stages, and gives implementation and resolution prompts the same exact command. The invariant is that a writing Claude stage can run the configured test command without gaining generic Bash access; read-only roles do not receive it.

Related work was searched both by issue terms and the implicated Claude permission/configuration paths. Open #142 covers general host permissions and is consistent with this exact-command boundary; open #141 says host permission prompts belong to #142. Closed #49 and merged PR #54 establish the existing behavioral publication policy, which this change preserves. No related item already implements this feature.

Work units

Unit Behaviour Files Tests Verification Rollback
WU-1 Validate and pass one exact test command to native Claude implementation and resolution writers, with prompt guidance and reference documentation. scripts/run_cycle.py, scripts/executors.py, tests/test_run_cycle.py, tests/test_cycle.py, tests/test_executors.py, docs/configuration.md Config validation, prompt, writer-stage propagation, allowedTools construction, and fake Claude process tests. python3 scripts/validate-package.py; python3 -m unittest discover -s tests -v; real CLI malformed-config check; fake Claude process success and nonzero-exit check. independent

Local verification

  • python3 scripts/validate-package.py — passed.
  • python3 -m unittest discover -s tests -v — 1,234 tests passed.
  • The real run_cycle.py CLI rejected a malformed pytest && ... command with exit 2 before dispatch.
  • A fake Claude executable received the exact allowedTools argument, completed successfully, and preserved a simulated exit 2 as a failed dispatch.
  • git diff --check — passed.

Local verification ran on Linux with the repository's configured Python dependencies. It exercises a fake Claude binary rather than a live Claude account. GitHub Actions on the pushed head is the CI result; this local run does not cover the Windows runner.

Closes #178

@datacas

datacas commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner Author

Implement stage summary

Status: IMPLEMENTED for issue provider GitHub, work item 178. The feature adds validated exact test-command permissions for native Claude implementation and resolution writers.

Current head: 78b133b85322c539f3686055965ed23d18fcfe03 (test(runtime): skip POSIX fake Claude CLI on Windows). This fixes the POSIX-only fake executable fixture that caused the first Windows CI run to fail.

Local verification: python3 scripts/validate-package.py passed; python3 -m unittest discover -s tests -v passed (1,234 tests); python3 -m unittest discover -s tests -q completed successfully after the portability fix; git diff --check passed. The actual run_cycle.py CLI rejected a malformed shell-operator command with exit 2 before dispatch. A fake Claude executable received the configured exact --allowedTools argument and its success and nonzero exit were preserved.

Checks for current head 78b133b85322c539f3686055965ed23d18fcfe03:

  • Skills, manifests, and Bash installer — pass (run 38373259225)
  • Skills, manifests, and Bash installer — pass (run 38373264133)
  • PowerShell installer — pass (run 38373259225)
  • PowerShell installer — pass (run 38373264133)

@datacas

datacas commented Oct 13, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261013-001] · senior_reviewer · openai/gpt-6.1-sol→? · medium · schema:2

Verdict: APPROVED. No blocking or nonblocking findings.

Reviewed the complete accumulated change for work item #178 at 78b133b85322c539f3686055965ed23d18fcfe03: configuration validation, native Claude permission construction, implementation/resolution propagation, stage prompts, documentation, and tests. The six changed files match the work item's scope. Publishing and nonpublishing Claude writers receive the configured exact command; reading stages and other executors receive no new permission.

Complete evidence: The supplied accumulated.diff was read in sections and confirmed as 414 lines, SHA-256 dd9579508c8ab44486b95f411093a66852bfb7f7e9dcf3e467e31f8896727ef5. GitHub confirms merge base 11ded315a90489484c3ea71704295770dbe102a7. The GitHub full diff contains the same content and hunk ranges; its only differences are function-context text in hunk headings. Trusted history from datacas contains no earlier review findings; reviews and inline comments are empty.

Security: The repository uses the default deterministic triggers, none of which matched these paths, filenames, or labels. Reviewer judgement activated the delegated security audit because this changes config-to-command permission handling. No confirmed vulnerability was found. Validation rejects unknown keys, malformed values, the specified permission wildcards, and shell operators. The native adapter passes the exact command as a separate argv permission rule only for writers. Current Claude permission documentation supports this rule format.

Executed verification:

  • rtk proxy python3 -B scripts/validate-package.py — exit 0; all 15 skills and shared sections/manifests validated.
  • rtk proxy python3 -B -m unittest discover -s tests -p test_executors.py -q — exit 0; 176 tests.
  • rtk proxy python3 -B -m unittest discover -s tests -p test_run_cycle.py -q — exit 0; 180 tests.
  • rtk proxy python3 -B -m unittest discover -s tests -p test_cycle.py -q — exit 0; 63 tests.
  • rtk proxy python3 -B -m unittest discover -s tests -q — exit 0; 1,234 tests.
  • rtk proxy git diff --check 11ded315a90489484c3ea71704295770dbe102a7 HEAD — exit 0.
  • Boundary verification ran through the actual Claude adapter and a fake executable, covering success and nonzero exit, exact permission argv, and failure propagation. Configuration and prompt tests cover rejection cases and writer-only propagation.

Environment recovery: The initial executor-suite command in the shell sandbox failed at setup with no usable temporary directory and ran zero tests. A probe confirmed errno 30, read-only filesystem; retrying with the workspace as TMPDIR also failed. The available context-mode execution capability then ran the original executor check successfully, followed by the affected and full suites. These initial failures are not test passes. Separately, git fetch origin main failed with fatal: bad object refs/bisect; that local ref is an empty file. GitHub compare and full-diff reads via gh verified the base and complete review evidence without changing the ref.

CI: gh pr checks 222 and statusCheckRollup show both required jobs passing on this head: Skills, manifests, and Bash installer and PowerShell installer, each on both push and pull-request runs (38373259225 and 38373264133). No expected job is missing, pending, failed, cancelled, or skipped. This PR is not a draft.

Unverified and residual risks: Live Claude permission enforcement against an authenticated Claude session was not exercised; the process test verifies the toolkit's argv and exit handling using a fake binary. The Windows fake-shebang process test is explicitly skipped as POSIX-only; other permission-construction tests and the Windows CI job passed. An approved test command executes repository test code with the executor's existing privileges. No new exploitable path was demonstrated. Product files were not modified, and the working tree remains clean.

@datacas
datacas merged commit d76b2ef into main Oct 13, 2026
4 checks passed
@datacas
datacas deleted the issue-178-claude-allowed-commands branch October 13, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant