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
8 changes: 7 additions & 1 deletion .chock/bin/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@ def _verdict(result: GateResult, declared: str, level: str = ROLLOUT_ENFORCE) ->
_CUSTOMISE_POINTER = (
"A person customises this policy's rules in .agents/policies/{policy}/manifest.yaml; an agent cannot loosen them."
)
_SCRIPT_KIND = "script"


def _for_agent(text: str) -> str:
Expand Down Expand Up @@ -1331,10 +1332,15 @@ def _reason(result: GateResult, spec: dict, event: str = "commit", policy_id: st
return "\n".join([*matches, _summary(result, policy_id), policy])


def _may_waive(spec: dict, event: str) -> bool:
"""Whether the policy can honour a waiver: an `allowlist_pragma`, or a script that reads its own."""
return spec.get("kind") == _SCRIPT_KIND or bool(_waiver_pattern(spec.get("params") or {}, event))


def _report_refusal(result: GateResult, spec: dict, judged: str, signal: str | None, policy_id: str | None) -> None:
reason = _reason(result, spec, judged, policy_id)
print(_encodable(ci_inert(reason) if judged == "ci" else reason, sys.stderr), file=sys.stderr)
if judged == AGENT_COMMIT_EVENT and signal and _waiver_pattern(spec.get("params") or {}, judged):
if judged == AGENT_COMMIT_EVENT and signal and _may_waive(spec, judged):
print(_AGENT_COMMIT_NOTE.format(signal=signal), file=sys.stderr)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Tiers: `commit` is a git hook or CI gate that exits non-zero. `in-agent` is the
chock is on PyPI, but the release there (0.15.2, 30 Sep 2026) is older than the engine this page describes. Install the frozen engine from its commit (Python 3.11 or newer):

```bash
pip install "chock @ git+https://github.com/open-coder-ai/chock@a6ec2f3603da832ed43fabace95504e5e13b013b"
pip install "chock @ git+https://github.com/open-coder-ai/chock@2f3be6d04349a7ec433657e16a294efc62b51d4f"
```

### Two ways to adopt it
Expand Down
Loading