Skip to content

test(pending-input): end an omp turn through herdr's omp integration once it reported the session - #3646

Closed
devswha wants to merge 1 commit into
mainfrom
fix/pending-input-omp-switch-flake
Closed

devswha wants to merge 1 commit into
mainfrom
fix/pending-input-omp-switch-flake

Conversation

@devswha

@devswha devswha commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Change

Test-only fix for the intermittent failure of server/pending-input.contract.test.ts "connection-owned pending input > delivers queued /model as /switch to omp" since #3624 ("queued command was not recorded" after about 8.8 s). Its still-running 15 s frame wait then fails whichever test runs next, as "pending frame timeout" / "pending event timeout" in the #540 control tests. It turned unrelated PRs red: CI jobs 130322790784 (#3517), 130321428889 (#3639) and 130346162672 (#3645).

Cause (measured in the self-hosted CI runner image)

Since #3624, setup() reports an omp pane's session as herdr's omp integration (source: "herdr:omp"). The test then ends the turn with pane.report_agent from source: "manual". herdr 0.9.3 takes a manual state for that pane only for about half a second after the integration's report; later ones are dropped with no error and no status event:

manual idle sent N ms after the session report result
0, 50, 200, 300, 500 ms takes effect
700, 900, 1000, 3000 ms dropped, pane stays working
herdr:omp with a newer seq, any delay takes effect

On a loaded runner, the attach and the queue request take longer than that window, so no pane-status frame comes and the queue never sees the turn end. The CI frame dumps show no pane-status after submit-result. #3624's product change is not involved: in these cases the stand-in omp has already reported its session, so nothing waits on it.

Fix

Once ompReports() has run, setup's state() reports an omp pane's state from herdr:omp, with the integration's next seq and the same session path. This is what a real omp does, and what the Pi case already does with herdr:pi. The starting-omp cases report before ompReports() and stay manual. No assertion is weakened, and no sleep, timeout or retry is added.

Validation

  • In herdr-ci-runner:local (CPUs 64-127, the merge gate's integration command), with a scratch-only 1.5 s pause before state()'s report, -t "to omp": main failed 5 of 5 runs with CI's errors, this branch passed 5 of 5.
  • The whole file, unchanged timing, on a quiet host: 6 of 6 pass on both. The window needs CI-level load, which the pause stands in for.
  • bun run check fast: pass (unit 15877 pass, 0 fail).
  • Not run: check full, browser suites. No changelog fragment: test-only.

…once it reported the session

## Why

"delivers queued /model as /switch to omp" in
`server/pending-input.contract.test.ts` fails on a busy runner since #3624
(CI jobs 130322790784 and 130321428889): "queued command was not recorded"
after 8.8 s, and its own 15 s frame wait, still running, then fails the
next test ("pending frame timeout" / "pending event timeout" in "delivers
to the same hookless process ..." or "holds a queued message when a
hookless agent process is replaced ...").

The product is right; the fixture's report is refused. Since #3624 the
setup reports an omp pane's session as herdr's omp integration
(`source: "herdr:omp"`), so the queue does not wait for a starting omp.
The test then ends the turn with `source: "manual"`. herdr (0.9.3, the CI
runner image) takes a manual state for that pane only for about half a
second after the integration's report; later ones are dropped without an
error or a status event. Measured in the runner image, the manual idle
took effect at 0, 50, 200, 300 and 500 ms after the report and was dropped
at 700, 900, 1000 and 3000 ms, while a report from `herdr:omp` with a
newer `seq` took effect at every delay. On a loaded runner the attach and
the queue request between the two took longer than that: no `pane-status`
frame came, so the queue never saw the turn end.

## What

- `setup`'s `state` reports an omp pane's state from `herdr:omp`, with the
  integration's next `seq` and session path, once `ompReports` ran, as the
  Pi case already does from `herdr:pi`. Before that report (the starting-omp
  cases) it stays `manual`.
- Test only. No assertion dropped or weakened. No timeout, sleep or retry
  added.

## Proof

In `herdr-ci-runner:local`, CPUs 64-127, `bun run check run -- env
HERDR_TEST_MODE=integration bun test --timeout 15000
./server/pending-input.contract.test.ts`:

- With a scratch-only 1.5 s pause before `state`'s report (not committed),
  `-t "to omp"`: before 5 of 5 runs fail both omp cases with CI's errors,
  after 5 of 5 pass.
- Whole file, unchanged timing, on a quiet host (load 25-45): before 6 of 6
  runs pass, after 6 of 6 (125 tests each). The window needs the load CI
  runs under, which the pause above stands in for.
- `bun run check fast`: unit 15877 pass, 0 fail, 53 skip; every step ok.
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Improved test reporting with stable session paths and sequential update numbers.
    • Added coverage for state changes reported before and after an OMP session is recorded.

The contract test setup now uses a stable OMP session path and increasing report sequences. After an OMP session is reported, state changes use herdr:omp reports.

Changes: OMP state reports

Layer / File(s) Summary
Fixture report sequencing
server/pending-input.contract.test.ts
The setup helper reuses one OMP session path and advances report sequences. After an OMP session is reported, the state helper sends updates as herdr:omp; before then, it uses manual state reports.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other

Possibly related PRs

  • devswha/ovis#3644: Both changes address the Herdr state-report race in the same contract test.
  • devswha/ovis#3624: This PR introduced the OMP fixture flow that reports a session during the test.

Suggested reviewers: jimbb

Merge Risk: Minimal · up to f0560

The fixture now uses sequenced OMP reports for later state changes. No material merge risk is identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly identifies the test fix and the herdr:omp integration behavior involved in ending an OMP turn.
Description check Passed The description includes the required Change and Validation sections. It explains the failure, cause, resulting behavior, test coverage, checks run, and checks skipped.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ecb98ed and f0560d0.

Files selected for processing: 1

  • server/pending-input.contract.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@devswha

devswha commented Nov 11, 2026

Copy link
Copy Markdown
Owner Author

Closing: #3644 (64bc36c) fixed the same flake by starting the stand-ins that are not about omp's start with --no-extensions, so no herdr:omp session is reported for them and herdr keeps taking their manual state reports. On main no test reports a state after ompReports() any more (the two omp-start tests call it last), so ending omp turns through herdr:omp would be unused code. The measurement here stays valid as the cause: herdr 0.9.3 drops a manual pane.report_agent about 0.5 s after a herdr:omp session report.

@devswha devswha closed this Nov 11, 2026
@devswha
devswha deleted the fix/pending-input-omp-switch-flake branch November 11, 2026 06:04
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