Skip to content

Decide, rather than crash, for a path outside the repository - #59

Merged
urban233 merged 5 commits into
mainfrom
codev/gate-decides-for-out-of-repo-paths
Sep 11, 2026
Merged

urban233 merged 5 commits into
mainfrom
codev/gate-decides-for-out-of-repo-paths

Conversation

@urban233

@urban233 urban233 commented Sep 11, 2026 •

Copy link
Copy Markdown
Owner

Closes #58

Summary

codev gate check resolves the tool payload's file path against the repository root, and Path.relative_to raises when the path lies outside it -- so the hook records degraded and allows the call unchecked. Any scratchpad, memory-directory, or /tmp path triggers it.

Deliberately left out of scope by #57 at 8 occurrences against 508. With that slice's PATH cause fixed, this is now 56 of 80 gate calls in a day. A path outside the repository is not something these gates govern -- it should resolve to a recorded allow, not a crash. Internal errors should also carry a failure_class, which today only invocation failures do.

Test plan

  • correctness: passed
  • security, privacy, data, and compatibility: waived (by urban233) -- Authorised by Martin Urban 2026-09-11. The change adds no dependency, no network or credential surface, and no shell invocation; it narrows what the gate resolves rather than widening it, and the one new field is a literal label.
  • concurrency: waived (by urban233) -- Authorised by Martin Urban 2026-09-11. Pure path resolution and a dataclass field; no shared state, no I/O ordering, nothing concurrent in the diff.
  • error handling: passed
  • test quality: passed
  • architecture and scope: waived (by urban233) -- Authorised by Martin Urban 2026-09-11. 263 lines across gate.py and three hook shims, inside the size budget, confined to the accepted scope; no new module, interface, or dependency direction.
  • maintainability: waived (by urban233) -- Authorised by Martin Urban 2026-09-11. The change removes a raise-and-catch path rather than adding structure; bundle parity is machine-verified and the existing style passes unchanged.
  • rollout: waived (by urban233) -- Authorised by Martin Urban 2026-09-11. Rollback is reverting one commit; the gate fails open on every error path either way, so a bad rollout degrades to today's behaviour rather than blocking work.

Scope

Changed files: .claude/hooks/require_plan.py, .claude/hooks/require_small_change.py, .claude/hooks/require_wave_shape.py, .codev/task/gate-decides-for-out-of-repo-paths/git-state.json, .codev/task/gate-decides-for-out-of-repo-paths/round-state.json, CHANGELOG.md, src/codev_workflow/bundle/.claude/hooks/require_plan.py, src/codev_workflow/bundle/.claude/hooks/require_small_change.py, src/codev_workflow/bundle/.claude/hooks/require_wave_shape.py, src/codev_workflow/gate.py, tests/test_gate.py

Review

Latest task review: READY_FOR_HUMAN_APPROVAL.


Task: gate-decides-for-out-of-repo-paths (#58)
Full review history: codev task log --id gate-decides-for-out-of-repo-paths

I directed this change and I own it -- that makes me its author, not its reviewer. ADR-0037 still requires a separate approving review from someone who is neither this task's owner nor a bot.

urban233 and others added 4 commits September 11, 2026 20:13
codev gate check resolved the tool payload's file path against the
repository root, and Path.relative_to raises when the path lies outside it,
so every hook recorded degraded and allowed the call unchecked. Any
scratchpad, agent-memory, or /tmp path triggered it -- 56 of 80 gate calls
in a day once the unresolvable-codev cause was fixed.

A degraded verdict now also says which kind it was: internal_error for a
raise inside the gate, infrastructure for absent tooling. Filing both under
one label is what let the original unchecked calls go unnoticed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@urban233
urban233 marked this pull request as ready for review September 11, 2026 21:11
@urban233
urban233 merged commit ba1ee7a into main Sep 11, 2026
16 checks passed
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.

Gate crashes on any path outside the repository, allowing 71% of calls unchecked

1 participant