Repository navigation
Hook fleet (1) event uid - #1331
Merged
Merged
Conversation
Hook runs belonging to the same harness event had no shared key, so grouping them for herd/wall-clock metrics relied on fragile 2s-window inference. Add event_uid = sha256(stdin)[:12] to _row() so every runner that receives the same stdin self-groups with zero coordination.
…runner metrics row gains an event_uid field that groups all hook runs belonging to one harness event, with no change to hook stdout, stderr, or exit codes. Review lane: behavior Safety invariant: Hook stdout and exit codes stay the same. This slice does not change the other four claims. Files: engine/hooks/_runner/run.py Change types: bugfix Acceptance criteria: The branch contains only this claim, and the review step publishes one pull request. Exit code: 0 Invoker-Finalize-Id: 5330cf4f-7efd-43e4-9fc5-fbc19b9c9a89
…770-8d121c9e — Review claim: Every runner metrics row gains an event_uid field that groups all hook runs belonging to one harness event, with no change to hook stdout, stderr, or exit codes. Review lane: behavior Safety invariant: Hook stdout and exit codes stay the same. This slice does not change the other four claims. Files: engine/hooks/_runner/run.py Change types: bugfix Acceptance criteria: The branch contains only this claim, and the review step publishes one pull request.
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: ac774614-69e2-4d91-a7eb-ecfdf3ac7a34) |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Owner
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 1 hour 59 seconds in the queue, including 59 minutes 58 seconds running CI. Required conditions to merge
|
15 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Small checker scripts fire each time the coding assistant does something, like sending a reply. Each one writes a line to a log saying how it went.
One action can fire many checkers. The log lines had nothing tying them back to the same action, so nobody could tell which lines belonged together.
Each log line now carries a short tag made from the message the assistant sent. Checkers fired by the same message get the same tag.
What the checkers print, and whether they pass or block, stays the same.
Review Claim
Every log line a checker writes gains a short tag that is the same for all checkers fired by one message, and nothing the checkers print or return changes.
Review Lane
behavior
Review Unit
engine-runtime
Safety Invariant
Hook stdout, stderr, and exit codes stay the same. The only change is one extra key,
event_uid, on each row written toruns.jsonl.The key is computed inside
_row(engine/hooks/_runner/run.py:238 @ HEAD). The call to_rowsits inside atrywhoseexcept Exceptiononly sets a stderr line (engine/hooks/_runner/run.py:310-317 @ HEAD); the hook's own stdout and exit code are set before that block.Assumptions: this body was drafted in a headless run, so this invariant is taken from the workflow's task description and is not confirmed by a person.
Slice Rationale
This is one claim split out of the larger hook fleet dispatcher work. It only adds the field. Anything that reads the field ships in its own later slice, producer first.
Non-goals
event_uidis added.report.py,dispatch.py, anddoctor.pyare untouched.test_run.pydoes not assert the new key. The proof is the base and head output under Measured.Measured
Command:
bash /tmp/event_uid_repro.sh <ref>— copiesrun.pyandoutcome.pyfrom the ref into a temp hooks folder, runs hooka.pyand hookb.pyon one payload, thena.pyon a second payload, and prints each hook's exit, stdout, stderr, and theevent_uidof each row inruns.jsonl.origin/mainat0adc86f740720858On head, rows one and two were fed the same payload and show the same tag; row three was fed a different payload and shows a different tag. The three
hook=lines are identical in the base and head blocks above.Test Plan
Test Plan
python3 engine/skills/make-pr/scripts/preflight.py --base origin/main --commit-only --dry-runpython3 -m unittest discover -s engine/hooks/_runner/tests -p "test_run.py"(Python 3.9.6)python3 scripts/ci/check_hook_test_coverage.py engine/hooks/_runnerruff check --select E9,F engine/hooks/_runner/run.pypython3.12 -m unittest discover -s engine/hooks/_runner/tests(every runner test file) — one test fails, the same one on base and headThe same command in a worktree at
origin/mainprinted the same singleFAIL:line andFAILED (failures=1). That test file is not in this diff.Revert Plan
Revert Plan
git revert 083c513b🤖 Generated with Claude Code
Note
Low Risk
Additive field on metrics logging only; no consumers or hook execution path changes.
Overview
Hook run metrics written to
runs.jsonlnow includeevent_uid, a 12-character hex prefix of SHA-256 over the stdin bytes passed into_row(full hook payload, or notify-mode meta). Checkers triggered by the same input share the same tag so log lines from one assistant action can be grouped.Hook stdout, stderr, and exit codes are unchanged; only the JSONL row shape gains one key.
Reviewed by Cursor Bugbot for commit 4072085. Bugbot is set up for automated code reviews on this repo. Configure here.