Skip to content

feat(hooks): enforce Codex apply_patch punchcards - #757

Draft
CueCrux-Myles wants to merge 7 commits into
mainfrom
feat/codex-apply-patch-hook-parity
Draft

feat(hooks): enforce Codex apply_patch punchcards#757
CueCrux-Myles wants to merge 7 commits into
mainfrom
feat/codex-apply-patch-hook-parity

Conversation

@CueCrux-Myles

Copy link
Copy Markdown
Contributor

Summary

Adds punchcard enforcement parity for Codex apply_patch hooks:

  • parses canonical Add/Update/Delete/Move targets, including Codex whitespace normalization and valid context-free updates
  • resolves lexical targets into the canonical absolute file/tree namespace and rejects traversal, escape, symlink, and non-directory path hazards
  • checks targets in bounded ordered waves while preserving conflict order and existing fail-open daemon-error behavior
  • adds an executable Codex wrapper with per-agent token/passport isolation and process-environment precedence
  • documents the distinct mapped-passport prerequisites for the eventual live fleet gate

This is a source-only draft. It does not claim ParaCrux fleet M2 closure: mapped-passport authentication still needs a live multi-worker proof. No deployment is included.

ExecPlan: crux-v0.5.60-coordination-enforcement-2026-08-18 (parent orchestration: paracrux-program3-program4-parallel-orchestration-2026-08-18)

Agent: OpenAI Codex (agent:openai). Independent review signed off exact HEAD 29f2a906fbac1eed81d58045e4cfbb4e479681d7 with no remaining findings.

Type

  • Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test coverage

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked -p crux-claude-hooks --all-targets -- -D warnings
  • cargo test --locked -p crux-claude-hooks (220 unit tests plus integration suites)
  • cargo test --locked --workspace
  • Codex parser matrix (16/16)
  • wrapper process E2E matrix (12/12), including isolated A-own/B-deny behavior and missing/invalid credential fail-open paths
  • crux-mcp authority-identity namespace unit gate
  • repository docs/licence/release-boundary/hosted-bridge checks

Checklist

  • cargo fmt --check passes
  • package clippy passes with -D warnings
  • cargo test --workspace passes
  • Focused coverage added for parser, path safety, batching, identity isolation, and wrapper behavior
  • CHANGELOG.md updated (not required for this draft integration change)
  • Documentation updated

Rollout boundary

Before enabling fleet enforcement, the daemon must run with agent-passport support and distinct explicit agent-to-passport mappings. The live gate must prove that two named workers resolve to different mapped holders, that worker A can mutate its leased path, and that worker B is denied on that same path. Shared, unmapped, or auth-disabled identities are insufficient.

Add canonical apply_patch target parsing and Codex-compatible hook output so apply_patch edits receive the same coordination guard as Claude file tools.

ExecPlan: paracrux-program3-program4-parallel-orchestration-2026-08-18

agent:openai
Match Codex trailing-whitespace normalization before deriving punchcard resources, with parser and process-level Add/Move regression coverage.

ExecPlan: paracrux-program3-program4-parallel-orchestration-2026-08-18

agent:openai
Remove horizontal tabs from operation target paths before deriving punchcard resources, while retaining Codex-compatible leading-space behavior.

ExecPlan: paracrux-program3-program4-parallel-orchestration-2026-08-18

agent:openai
Remove embedded carriage returns from operation target paths before deriving punchcard resources, matching the file names Codex mutates.

ExecPlan: paracrux-program3-program4-parallel-orchestration-2026-08-18

agent:openai
Recognize change lines without an @@ context marker and reject empty move-only updates, matching Codex patch grammar before punchcard probing.

ExecPlan: paracrux-program3-program4-parallel-orchestration-2026-08-18

agent:openai
ExecPlan: crux-v0.5.60-coordination-enforcement-2026-08-18

Agent: openai-codex
ExecPlan: crux-v0.5.60-coordination-enforcement-2026-08-18

Agent: openai-codex
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