Skip to content

test(lib): make buffer_stdin stall comparison load-tolerant - #2362

Merged
kyle-sexton merged 4 commits into
mainfrom
cursor/hook-utils-stall-load-independent-63e1
Aug 12, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
cursor/hook-utils-stall-load-independent-63e1

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #2105

Summary

  • Replace the fixed 400ms bs_paired_verdict slack with a relative check (unsliced slower than sliced in every interleaved pair).
  • When load makes timing inconclusive, pass with an explicit note — the slice-resolution assertion above remains the load-independent regression guard.

Test plan

  • lib/hook-utils.test.sh (180/0)

Related

@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@claude

claude Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 37s —— View job


Security Review

  • Fetch PR diff (origin/main...HEAD)
  • Read changed file(s) in full context
  • Analyze for security issues (injection, auth, secrets, dangerous Actions patterns)
  • Post findings

Scope: lib/hook-utils.test.sh (+17/-2) — replaces the fixed 400ms bs_paired_verdict slack in the buffer_stdin stall test with a relative, per-pair comparison (bs_deltas_a_first[@] / bs_deltas_b_first[@]), falling back to a load-tolerant pass when timing is inconclusive.

No security issues found.

This is a test-only shell script, not a GitHub Actions workflow, so the workflow-specific concerns (permissions, pull_request_target/workflow_run, unpinned actions, script injection via the github context) don't apply here.

Reviewed the diff for the usual concerns anyway:

  • The new loop only does integer arithmetic (bs_rel_d <= 0) over bs_deltas_a_first/bs_deltas_b_first, which are populated internally by bs_samples/bs_time_stall from EPOCHREALTIME timestamps — not from any external, user-, or CI-controlled input. No injection surface.
  • No new command execution, eval, file writes, or environment variable handling was introduced by this diff (the pre-existing eval "$2" inside bs_time_stall at line 1685 is unchanged, test-internal, and out of scope for this PR).
  • No changes to secrets, tokens, credentials, permissions, or CI configuration.

Branch: cursor/hook-utils-stall-load-independent-63e1

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02297e00b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/hook-utils.test.sh Resolved
@claude

claude Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 4m 40s —— View job


Review complete

  • Gather context (diff, CLAUDE.md, REVIEW.md)
  • Understand the request (code review)
  • Review changed file for correctness, error handling, test coverage, maintainability
  • Post findings

Repo's CLAUDE.md and .claude-pr/CLAUDE.md are both empty, so no repo-specific conventions applied beyond REVIEW.md's lane split. This repo has no claude-security-review workflow configured (checked .github/workflows/ before scoping), but the diff has no security-relevant content anyway — pure Bash test-harness logic, no external input, no secrets.

One finding posted inline on lib/hook-utils.test.sh (lines 1958–1967): the new bs_rel_ok branch calls ok(...) on both the "unsliced exceeds sliced" path and the "inconclusive under load" path, so this test block can no longer fail based on the timing property it actually measures — the only remaining fail is for a completely untimed harness (missing EPOCHREALTIME). The PR's own comment claims the slice-resolution assertion earlier in the file is now the load-independent regression guard, but that assertion only checks hook::resolve_read_slice's pure return value, not that hook::buffer_stdin applies the slice count at runtime — so a real regression in the read loop's slicing behavior would now go undetected by this test. Details and a suggested fix (instrumenting idle_slices the way the Test 18f completeness-check block already does) are in the inline comment.

Everything else in the diff checked out: bs_samples/bs_paired_estimate are unchanged, the new loop correctly walks both bs_deltas_a_first and bs_deltas_b_first (all 6 interleaved samples), and the bs_rel_d <= 0 comparison matches the b - a (unsliced-minus-sliced) delta convention used elsewhere in the file.

Note: I did not independently run the test suite in this session — the PR's "180/0" test-plan result is author-claimed and unverified by me.

Comment thread lib/hook-utils.test.sh Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

cursoragent and others added 2 commits August 12, 2026 06:03
Fixes #2105

Drop the fixed 400ms slack; require unsliced > sliced in every pair when
timed, otherwise record inconclusive and rely on the slice-split guard.

Co-authored-by: Kyle Sexton <[email protected]>
@cursor
cursor Bot force-pushed the cursor/hook-utils-stall-load-independent-63e1 branch from 02297e0 to c344072 Compare August 12, 2026 06:03
@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Automated security review did not complete — this is an infrastructure failure, not a review verdict.

Treat any Claude comment on this PR (including a placeholder like "I'll analyze this and get back to you") as incomplete, not "no findings."

The check is green on purpose, and it is not evidence. It certifies that a security pass ran, and this one did not complete — but the cause is outside this PR's control, so merging is deliberately left unblocked rather than locking every merge for the length of the outage. Nothing was reviewed at this head. Where this check is required, it is satisfied without that evidence; a human should review security-sensitive changes here before merging.

Re-run the job to retry the review; a new push also retries it only if the caller's pull_request triggers include synchronize (the canonical security caller keeps it). An automatic retry may already have run — it is skipped when a partial review could duplicate comments, or when the failure class needs an operator.

Re-running does NOT help for every class:

  • rate-limit that persists across re-runs, or auth — the credential or usage budget needs an operator; retrying will not clear it.
  • a run that exhausted its turn budget ("subtype":"error_max_turns" above) will exhaust it again. As the PR author, split the change into smaller PRs; raising --max-turns is a change to the caller workflow, not something you can set on this PR.

@github-actions

github-actions Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Automated review did not complete — this is an infrastructure failure, not a review verdict.

Treat any Claude comment on this PR (including a placeholder like "I'll analyze this and get back to you") as incomplete, not "no findings."

Re-run the job to retry the review. A new push re-triggers this lane only if the caller's pull_request triggers include synchronize (the canonical caller omits it).
An automatic retry may already have run — it is skipped when a partial review could duplicate comments, or when the failure class needs an operator (auth).

cursoragent and others added 2 commits August 12, 2026 06:26
json_complete fires only on the first empty slice of a quiet period, so
counting its probes could not distinguish sliced (slice_count=4) from
unsliced (slice_count=1). Shadow read() instead and compare invocation
counts — the load-independent guard the review thread asked for.

Co-authored-by: Kyle Sexton <[email protected]>
json_complete fires only on the first empty slice of a quiet period, so
counting its probes could not distinguish sliced (slice_count=4) from
unsliced (slice_count=1). Shadow read() instead and compare invocation
counts. Revert an out-of-scope jq_fields rc=2 assertion that did not match
the implementation on this branch.

Co-authored-by: Kyle Sexton <[email protected]>
@kyle-sexton
kyle-sexton merged commit 2c9d14f into main Aug 12, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the cursor/hook-utils-stall-load-independent-63e1 branch August 12, 2026 06:51
@cursor
cursor Bot restored the cursor/hook-utils-stall-load-independent-63e1 branch August 12, 2026 18:09
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.

hook-utils tests: buffer_stdin sliced-vs-unsliced delta assertion flakes under machine load

2 participants