Repository navigation
fix: scope Codex graph hooks to event cwd - #1061
1 commit merged into
Conversation
|
Ready for maintainer review of e4b1d7e. GitHub rejected my RequestReviewsByLogin attempt because this fork contributor lacks permission. Please review the payload cwd boundary and run the repository-required checks through the normal fork-PR path. Validation limits and the package-before-hook-regeneration requirement are recorded in the description. |
|
Thank you for this PR. I merged it with the latest Before I can merge it, please fix these:
After you push the fix, I will test it again. |
There was a problem hiding this comment.
🟡 Changes recommended
Previously generated cwd-based Codex hooks survive regeneration and uninstall, so stale handlers can still update the launcher's repository.
2 open issues
What changed in this PR
This PR scopes Codex graph hooks to the repository identified by the event payload’s cwd, rather than the launcher’s working directory.
Changes:
- Adds
hook-updateandhook-statuscommands with payload-based repository validation. - Updates generated Codex hooks to forward JSON input and preserve command failures.
- Adds regression coverage for repository selection, invalid payloads, status output, and failure handling.
| File | Description |
|---|---|
tests/test_skills.py |
Updates expectations for generated Codex commands. |
tests/test_hook_update.py |
Adds payload-scoping and command-failure regressions. |
code_review_graph/skills.py |
Generates hooks that forward payloads to the new commands. |
code_review_graph/hook_update.py |
Resolves payload repositories and runs updates or status. |
code_review_graph/cli.py |
Registers and dispatches the two hook commands. |
Review effort: Balanced
| " && code-review-graph update --skip-flows" | ||
| " || true" | ||
| ), | ||
| "command": "cat | { if command -v code-review-graph >/dev/null 2>&1; then code-review-graph hook-update; else cat >/dev/null; fi; }", |
| " && code-review-graph status" | ||
| " || echo 'Not a git repo, skipping'" | ||
| ), | ||
| "command": "cat | { if command -v code-review-graph >/dev/null 2>&1; then code-review-graph hook-status; else cat >/dev/null; fi; }", |
0160eb0
…w of tirth8205#1061) Each install appended another copy of the hooks, because the new commands were not recognised as ours. Uninstall left the v2.3.9 hooks behind. hook-status printed a traceback and exited 1 in a repo with no graph, and hook-update ignored a failed update. Also clears the ruff failures and adds a changelog entry with the upgrade order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Codex graph hooks currently discard the event JSON and choose a repository from inherited process cwd. When the launcher cwd differs from the event checkout, they can update the wrong graph.
Add
hook-updateandhook-statuscommands that resolve the repository from a literal absolute payloadcwd. Missing, malformed, relative, nonexistent, and non-repository paths do not trigger updates. Generated hooks forward JSON and propagate failures when the executable exists. Status delegates to the existing console command, preserving its output and failures.Validation:
The package must be upgraded to support these new commands before regenerating hooks. No installed hook configuration was changed. Payload provenance relies on the agent hook channel; filesystem/Git validation is not a separate repository trust allowlist.