Skip to content

feat(hooks): add auditor timeout overrides - #13

Merged
DorianZheng merged 2 commits into
mainfrom
codex/long-running-auditor-override
Aug 29, 2026
Merged

feat(hooks): add auditor timeout overrides#13
DorianZheng merged 2 commits into
mainfrom
codex/long-running-auditor-override

Conversation

@DorianZheng

@DorianZheng DorianZheng commented Aug 28, 2026

Copy link
Copy Markdown
Member

Issue

Long-running commit-push-auditor and verdict-auditor tasks had no native,
prompt-scoped escape hatch. A user could keep waiting or cancel the parent task, but
could not explicitly override only the auditor gates after the audit exceeded 30
seconds.

The lifecycle also crosses host-generated wake/completion notifications, replacement
generations, prompt epochs, and untrusted runtime cache files. Treating those as one
inline hook branch made the behavior difficult to reuse and left identity, replay, and
special-file boundaries too easy to loosen.

User impact

After 30 seconds, Claude Code now presents one native card with two choices:

  • Keep waiting (Recommended): close the one-shot escalation while the auditor keeps
    running.
  • Force pass — auditor is taking too long: record OVERRIDDEN BY USER for both
    auditor gates for the current prompt only. It never creates a PASS dossier.

Doing nothing leaves the auditor running. A stale card cannot authorize an override
after its exact audit generation completes or is replaced. Installation, guidance,
review, chained-hook, push-ref, permission, and remote-protection gates remain active.

Root cause

Auditor identity, serialized lifecycle transitions, cache persistence, and host prompt
rendering lived in one script-level control flow. Claude's exact custom-agent names and
Codex's transcript task paths were initially passed through the same fuzzy matcher.
Cache records were validated by content without consistently binding the exact expected
filename, and prompt fields were rendered without a reusable single-line boundary.

Fix

  • Add a namespaced lifecycle facade that owns the bounded session mutex and dispatches
    start, escalation, selection, completion, prompt, and terminal transitions.
  • Add a pure common interactive-prompt renderer with validated JSON input, ordered
    choices, single-line fields, and explicit command labels.
  • Match exact Claude custom-agent names while keeping Codex transcript-path adaptation
    separate and bound to the hook session and agent IDs.
  • Bind active, escalation, pending-stop, and completion records to their exact canonical
    paths; quarantine recoverable directories and reject forged, replayed, stale, FIFO,
    symlink, and replacement-generation state.
  • Preserve one completion-delivery credit per terminal notification without letting
    those non-authorizing receipts suppress real user prompts.
  • Ship normalized Claude and Codex hook manifests whose only difference is
    asyncRewake versus async.
  • Add the repo-local shell-engineering skill and project instruction so later Bash
    work keeps the same namespacing, facade, state-safety, and verification conventions.

Call graph

Before
SubagentStart (Hook event · plugins/boxlite-agent-tooling/.agents/hooks/auditor-control.sh:476)
  ├─ with_control_lock (Function · plugins/boxlite-agent-tooling/.agents/hooks/auditor-control.sh:136) — inline state sequencing
  └─ systemMessage (Inline renderer · plugins/boxlite-agent-tooling/.agents/hooks/auditor-control.sh:482) — portable text only

After
SubagentStart (Hook event · plugins/boxlite-agent-tooling/.agents/hooks/auditor-control.sh:821)
  ├─ auditor_control_auditor_from_payload (Function · plugins/boxlite-agent-tooling/.agents/hooks/auditor-control.sh:91) — bind exact host identity
  ├─ auditor_control_state_dispatch (Facade · plugins/boxlite-agent-tooling/.agents/lib/auditor-control-state.sh:67) — select named transition
  │  └─ auditor_control_state_with_lock (State owner · plugins/boxlite-agent-tooling/.agents/lib/auditor-control-state.sh:22) — serialize mutation
  └─ hook_interactive_prompt_render_claude (Renderer · plugins/boxlite-agent-tooling/.agents/lib/hook-interactive-prompt.sh:4) — render validated choices

Key: the executable composes identity, state, and rendering; each reusable module
owns one reason to change.

Validation

  • All 15 plugin test suites: 933 assertions, 0 failures.
  • Focused auditor override lifecycle: 37/37.
  • Adjacent cancellation lifecycle: 41/41.
  • Cross-host manifest and asset parity: 69/69.
  • New regression coverage includes special cache files/directories, forged filenames,
    replay credits, prompt control-line injection, and lookalike Claude agent names.
  • Changed Bash files pass bash -n and ShellCheck warning-level checks; the three
    refactored production modules pass full shellcheck -x analysis.
  • Skill validation, JSON manifest parsing, guidance sync, and git diff --check pass.

Summary by CodeRabbit

  • New Features

    • Added auditor escalation after 30 seconds, with options to keep waiting or force a pass.
    • Added headless support for force-pass auditor requests.
    • Added prompt-scoped overrides that expire automatically and are logged distinctly.
    • Added consistent auditor lifecycle behavior across supported hosts.
  • Documentation

    • Documented escalation, override behavior, and host parity expectations.
  • Chores

    • Released plugin version 0.1.6 with updated host integration configuration.
  • Tests

    • Expanded coverage for escalation, overrides, concurrency, safety, and cross-host behavior.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1be2d404-8d72-4193-837a-b5df4bee9a3d

📥 Commits

Reviewing files that changed from the base of the PR and between 4714bd9 and 3ea04b0.

📒 Files selected for processing (29)
  • .claude-plugin/marketplace.json
  • .github/plugin/marketplace.json
  • AGENTS.md
  • README.md
  • plugins/boxlite-agent-tooling/.agents/hooks/auditor-control.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/auditor-override.test.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/cancel-verdict-audit.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/cancel-verdict-audit.test.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/preflight-commit-push.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/preflight-commit-push.test.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/preflight-verdict-check.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/run-commit-push-audit.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/run-commit-push-audit.test.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/run-verdict-audit.sh
  • plugins/boxlite-agent-tooling/.agents/hooks/run-verdict-audit.test.sh
  • plugins/boxlite-agent-tooling/.agents/lib/auditor-control-state.sh
  • plugins/boxlite-agent-tooling/.agents/lib/auditor-override-state.sh
  • plugins/boxlite-agent-tooling/.agents/lib/hook-interactive-prompt.sh
  • plugins/boxlite-agent-tooling/.agents/lib/verdict-audit-state.sh
  • plugins/boxlite-agent-tooling/.agents/skills/shell-engineering/SKILL.md
  • plugins/boxlite-agent-tooling/.claude-plugin/plugin.json
  • plugins/boxlite-agent-tooling/.codex-plugin/plugin.json
  • plugins/boxlite-agent-tooling/.githooks/commit-msg
  • plugins/boxlite-agent-tooling/.githooks/githooks.test.sh
  • plugins/boxlite-agent-tooling/guidance/workflow.md
  • plugins/boxlite-agent-tooling/hooks/codex-hooks.json
  • plugins/boxlite-agent-tooling/hooks/hooks.json
  • plugins/boxlite-agent-tooling/host-parity.test.sh
  • plugins/boxlite-agent-tooling/plugin.json

📝 Walkthrough

Walkthrough

The plugin adds auditor lifecycle control for long-running audits, prompt-scoped force-pass overrides, shared Bash state libraries, separate Claude and Codex hook manifests, extensive contract tests, updated guidance, and version 0.1.6.

Changes

Auditor lifecycle and override flow

Layer / File(s) Summary
State and prompt foundations
.agents/lib/*, .agents/skills/shell-engineering/SKILL.md
Adds locked lifecycle state, validated override grants, process ownership checks, prompt rendering, and shell-engineering guidance.
Auditor control and escalation
.agents/hooks/auditor-control.sh, .agents/hooks/cancel-verdict-audit.sh, related tests
Adds auditor identification, generation-bound receipts, 30-second escalation, wake and completion handling, interactive choices, headless directives, and fail-closed validation.
Audit gates and override handoffs
.agents/hooks/*, .githooks/*, related tests
Integrates scoped overrides and auditor control into commit, push, verdict, and commit-message gates. Cleanup failures retract audit output and return failure.
Host manifests and project guidance
hooks/*.json, host-parity.test.sh, README.md, AGENTS.md, guidance/workflow.md, plugin.json
Separates Claude and Codex manifests, verifies normalized parity, documents escalation behavior, and updates plugin versions to 0.1.6.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Auditor
  participant AuditorControl
  participant Hook
  participant User
  Auditor->>Hook: Start audit
  Hook->>AuditorControl: Start generation
  AuditorControl->>AuditorControl: Escalate after timeout
  AuditorControl->>User: Present keep-waiting or force-pass choice
  User->>Hook: Submit selection or force-pass directive
  Hook->>AuditorControl: Consume choice and close state
  Auditor->>Hook: Return terminal verdict
  Hook->>AuditorControl: Stop generation and record completion
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/long-running-auditor-override

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DorianZheng DorianZheng changed the title Add long-running auditor override feat(hooks): add auditor timeout overrides Aug 29, 2026
@DorianZheng
DorianZheng marked this pull request as ready for review August 29, 2026 17:31
@DorianZheng
DorianZheng merged commit 14d0b8d into main Aug 29, 2026
1 check passed
@DorianZheng
DorianZheng deleted the codex/long-running-auditor-override branch August 29, 2026 17:32
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