Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .claude/hooks/require_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,17 @@ def main() -> None:
_ask(reason)
return
if verdict == "degraded":
_log_decision(repo_root, "degraded", tool_name=tool_name, reason=reason)
# The gate answered, and its answer was that it could not decide.
# Carry its own classification through rather than dropping it: an
# internal error filed as though the tooling were merely absent is
# how this class of hole stays invisible.
_log_decision(
repo_root,
"degraded",
tool_name=tool_name,
reason=reason,
failure_class=str(decision.get("failure_class") or ""),
)
_allow()
return
# `recorded` is false when the gate never applied -- an unwatched tool or
Expand Down
12 changes: 11 additions & 1 deletion .claude/hooks/require_small_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,17 @@ def main() -> None:
_ask(reason)
return
if verdict == "degraded":
_log_decision(repo_root, "degraded", tool_name=tool_name, reason=reason)
# The gate answered, and its answer was that it could not decide.
# Carry its own classification through rather than dropping it: an
# internal error filed as though the tooling were merely absent is
# how this class of hole stays invisible.
_log_decision(
repo_root,
"degraded",
tool_name=tool_name,
reason=reason,
failure_class=str(decision.get("failure_class") or ""),
)
_allow()
return
# `recorded` is false when the gate never applied -- an unwatched tool or
Expand Down
12 changes: 11 additions & 1 deletion .claude/hooks/require_wave_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,17 @@ def main() -> None:
_ask(reason)
return
if verdict == "degraded":
_log_decision(repo_root, "degraded", tool_name=tool_name, reason=reason)
# The gate answered, and its answer was that it could not decide.
# Carry its own classification through rather than dropping it: an
# internal error filed as though the tooling were merely absent is
# how this class of hole stays invisible.
_log_decision(
repo_root,
"degraded",
tool_name=tool_name,
reason=reason,
failure_class=str(decision.get("failure_class") or ""),
)
_allow()
return
# `recorded` is false when the gate never applied -- an unwatched tool or
Expand Down
10 changes: 10 additions & 0 deletions .codev/task/gate-decides-for-out-of-repo-paths/git-state.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

177 changes: 177 additions & 0 deletions .codev/task/gate-decides-for-out-of-repo-paths/round-state.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ Semantic Versioning.
rather than a change of meaning that would break `just test --test_output=all`.

### Fixed
- **The gate no longer crashes on a path outside the repository.**
`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 file, agent memory directory, or `/tmp` path triggered it.
Such a path now resolves to a recorded `allow / outside-repo`: the plan
gate exists to stop repository source being edited without a plan, and a
scratchpad write is not that. This was known and deliberately deferred at
8 occurrences against the 508 caused by an unresolvable `codev` on `PATH`;
once that cause was fixed it became **56 of 80 gate calls in a day**, so
the guardrail was still failing open on most calls with only the cause
changed.
- **A degraded gate now says whether it was infrastructure or a defect.**
`failure_class` previously covered only the hook's own invocation
failures. An error raised *inside* `codev gate check` returned cleanly
with a `degraded` verdict and no classification, so it was filed
identically to genuinely absent tooling -- the same conflation that let
the original unchecked calls go unnoticed. Internal errors are now
recorded as `internal_error`, absent tooling as `infrastructure`, and the
hooks carry the gate's own classification through instead of dropping it.

- **The three guardrail hooks no longer fail open because `codev` is missing
from `PATH`.** They resolved a bare command name from whatever environment
the host handed them, which is frequently not the shell CoDev was installed
Expand Down
12 changes: 11 additions & 1 deletion src/codev_workflow/bundle/.claude/hooks/require_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,17 @@ def main() -> None:
_ask(reason)
return
if verdict == "degraded":
_log_decision(repo_root, "degraded", tool_name=tool_name, reason=reason)
# The gate answered, and its answer was that it could not decide.
# Carry its own classification through rather than dropping it: an
# internal error filed as though the tooling were merely absent is
# how this class of hole stays invisible.
_log_decision(
repo_root,
"degraded",
tool_name=tool_name,
reason=reason,
failure_class=str(decision.get("failure_class") or ""),
)
_allow()
return
# `recorded` is false when the gate never applied -- an unwatched tool or
Expand Down
12 changes: 11 additions & 1 deletion src/codev_workflow/bundle/.claude/hooks/require_small_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,17 @@ def main() -> None:
_ask(reason)
return
if verdict == "degraded":
_log_decision(repo_root, "degraded", tool_name=tool_name, reason=reason)
# The gate answered, and its answer was that it could not decide.
# Carry its own classification through rather than dropping it: an
# internal error filed as though the tooling were merely absent is
# how this class of hole stays invisible.
_log_decision(
repo_root,
"degraded",
tool_name=tool_name,
reason=reason,
failure_class=str(decision.get("failure_class") or ""),
)
_allow()
return
# `recorded` is false when the gate never applied -- an unwatched tool or
Expand Down
12 changes: 11 additions & 1 deletion src/codev_workflow/bundle/.claude/hooks/require_wave_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,17 @@ def main() -> None:
_ask(reason)
return
if verdict == "degraded":
_log_decision(repo_root, "degraded", tool_name=tool_name, reason=reason)
# The gate answered, and its answer was that it could not decide.
# Carry its own classification through rather than dropping it: an
# internal error filed as though the tooling were merely absent is
# how this class of hole stays invisible.
_log_decision(
repo_root,
"degraded",
tool_name=tool_name,
reason=reason,
failure_class=str(decision.get("failure_class") or ""),
)
_allow()
return
# `recorded` is false when the gate never applied -- an unwatched tool or
Expand Down
Loading
Loading