You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(queue): a queued message waits for a starting omp as a message sent at once does - #3624
The queued-input finding of the code review of shared/ and server/core/ (server/core/pending.ts:700), which the merge pass held until #3574 and #3619 were merged.
omp draws its input box before it takes an Enter, and herdr reads a pane with nothing reported as at rest a few seconds after it starts. The immediate send waits for herdr's omp integration to report the session (untilOmpReported, #1475). The queue did not: a new workspace's first message, a queued message at its turn, a queue request typed at once and Send now pasted the message and pressed Enter as soon as herdr showed the pane at rest. On a start slower than that, the message stayed in omp's input box and never ran, while its row said sent.
How each waits now:
A send a person makes (Send now, a queue request typed at once) waits as part of the send, as the immediate send does: within its deadline, counted from when it was asked for, and its sender's leave to type. What it read before the wait is read again: an omp that quit refuses it, and a queue request whose omp is at work by the report is queued for that turn's end instead of typed into it.
A send the queue makes by itself waits before it is taken up (awaitsOmp, waitForOmp): the message stays queued, with nothing claimed and the pane's lane free, and the queue is drained again when the wait ends. What is typed into the pane's terminal meanwhile goes at once, Send now and Discard find the message as it is, and a pane that ends takes the message with it. The wait goes on through a look herdr does not answer.
Also here, since a send can now be on its way for seconds: a first message whose pane ended while it was on its way went back to the queue (or stayed held) under the dead pane's id, where the next pane herdr gave that id showed it and could queue no first message of its own. It now goes once its send has ended (takenWithPane). A connection's own message stays held for it, as before.
Second commit: the merge pass's review of the first push (a56150d)
(Opus, MEDIUM) What is typed during the wait is not sent merged with the message. The queue's own wait leaves the pane's lane free, and omp has no check of its input box as Claude and Hermes have. The input lane now counts a person's own input to each pane (typing, a key, an inserted line, a masked answer; not the terminal's answers to its program, nor the mouse), and a wait that sees any holds the pane's queued messages for their senders at its next look, with the reason typed_while_waiting. The two tests that pinned the merged order now pin the hold.
(LOW) A chat message sent at once during the wait keeps its place. It is accepted as a queued row behind what waits (pending in its result), as a queue request that finds a message waiting is. The terminal's input line still goes as typed.
(LOW) A Discard during a Send now's wait is true. The Discard marks the message on its way, the send ends at its next look with nothing typed, and the message goes as discarded.
(LOW) A row says what it waits for.PendingMessage.waiting: "omp_starting" on a queued row at a pane at rest and on a row on its way; the page shows "Waiting for omp to start…" (ko, ja, zh), and has its own words for the new hold reason.
(Codex, both reproduced in the unit fixture) A look at omp's process that herdr did not answer read as "no omp is starting". For the queue it now fails: a send by hand is refused with herdr's code and nothing typed; the queue's own asks again a moment later, the message still queued, for at most half a minute, after which the send's own look decides. A snapshot herdr did not answer for the queue's look is retried the same way instead of leaving the message queued with nothing to drain it. The immediate send keeps its old reading.
Limits of the second commit: typing that reaches the pane another way than through Ovis (herdr's own window) is not seen, so a reader of omp's input box would be the larger fix; a Discard that comes in a send's last moment, after its wait, still answers with the sent receipt, as on main; a Send now and a queue request typed at once still hold the pane's lane while they wait, as the immediate send does.
Not in this PR
An omp that has reported, one without the integration and one started more than 30 s ago are typed into at once, as before. So is an omp whose process ompProcess does not recognise (run through bunx or npx, or listed without its arguments), as for the immediate send. ompProcess also takes one of omp's own helper processes for the omp, and reads the process's environment on the server's thread; both are as they were for the immediate send, and the queue now does them at a pane's first rest. These three are on this session's list for the one PR after the release.
Measured on a real omp
omp 18.14.0 under herdr 0.9.5 in an isolated session, a throwaway HOME with herdr's integration, the start slowed to 12% of a CPU: herdr showed omp, idle and no session at 3.7 s and the session at 12.5 to 15 s. Through this checkout's server, a queue request for /hotkeys sent in between:
main
this PR
sent by the queue at a turn's end
sent 0.3 s later; /hotkeys still in the input box 4 s after the report (1 of 1)
row queued until the report, then sent; the panel opened (3 of 3)
typed at once, by hand
answered 0.3 s later; /hotkeys still in the input box (1 of 1)
answered 0.3 to 0.5 s after the report; the panel opened (2 of 2)
Tests
Written first:
server/core/pending-omp-start.test.ts (48 tests). First commit: 28 of its 36 fail with main's queue code. Second commit: 10 more fail on a56150d.
server/pending-input.contract.test.ts, on real herdr with a stand-in omp that loads the integration and has not reported: the message goes only at the report and its row says what it waits for (fails on main); a key typed meanwhile goes at once and the message is held (fails on a56150d).
server/core/input-receipt.test.ts (what counts as a person's typing), server/pending-input.test.ts (the row note, holding a pane's queued messages), src/components/pendingStatus.test.ts, src/lib/compose.test.ts.
Mutants of the new code against the unit files: first commit 19 of 25 fail a test, and the six that do not change nothing that is typed (named in its message); second commit 17 of 18, and the eighteenth now has a test of its own.
24 copies of the unit file run at once on one CPU all passed, twice (first commit).
Pre-push reviews: two independent ones on the first commit (the lane held by the queue's own send, the message left under a dead pane's id, a timing-dependent test, the wait ending on a herdr failure, four unpinned guards: all fixed). The one started for the second commit ended on the account's rate limit before it reported, so the second commit has the merge pass's review only.
Validation
On 0f4ac18d5 (two commits on main f6cc7c384), on this PC (Linux, herdr 0.9.5):
bun run check fast: workflow syntax, generated types and themes, typecheck, build and unit tests pass (15,794 pass, 0 fail, 51 skip in 899 files).
bun run check run bun test --timeout 15000 on server/pending-input.contract.test.ts, server/omp.contract.test.ts and server/submit.contract.test.ts: 237 pass, 0 fail. With server/opencode-first-message.contract.test.ts and server/api.contract.test.ts too, on the commit before its last three-line change (40fb59850): 440 pass, 0 fail.
The end-to-end runs in the table above (this checkout's server, real omp 18.14.0, isolated herdr session, throwaway HOME, a proxy that refuses every request): the control on main, five runs on the first commit and two on this head (the queue's own send: its row stayed queued until the report at 14.1 s, then went, and the panel opened; by hand: answered 0.3 s after the report, panel opened).
Skipped: bun run check full, the browser regressions (the page change is one status line of a pending row and one hold reason's words, covered by pendingStatus.test.ts and compose.test.ts; not run in a browser), Windows and macOS. On Windows herdr names only the shell in front, so nothing waits there, as for the immediate send.
…nt at once does
Found by a code review of `shared/` and `server/core/` (server/core/pending.ts:700).
omp draws its input box before it takes an Enter, and herdr reads a pane
with nothing reported as at rest a few seconds after it starts. The
immediate send waits for herdr's omp integration to report the session
(`untilOmpReported`, #1475). The queue did not: a new workspace's first
message, a queued message at its turn, a queue request typed at once and
Send now pasted the message and pressed Enter as soon as herdr showed
the pane at rest. On a start slower than that, the message stayed in
omp's input box and never ran, while its row said sent.
Measured with omp 18.14.0 under herdr 0.9.5 in an isolated session, a
throwaway HOME with herdr's integration, the start slowed to 12% of a
CPU: herdr showed `omp`, `idle` and no session at 3.7 s and the session
at 12.5 to 15 s. Through this checkout's server, a queue request for
`/hotkeys` sent in between, typed at once (by hand) or sent by the queue
at a turn's end:
- main: answered or sent 0.3 s later, and `/hotkeys` was still in the
input box 4 s after the report (1 of 1 each way).
- here: the queue's own send left its row queued until the report, then
sent it, and the panel opened (3 of 3); the request typed at once was
answered 0.3 to 0.5 s after the report, and the panel opened (2 of 2).
How each waits:
- A send a person makes (Send now, a queue request typed at once) waits
as part of the send, in `dispatchPendingText`, as the immediate send
does: within its deadline, counted from when it was asked for, and its
sender's leave to type. What it read before the wait is read again:
an omp that quit refuses it, and a queue request whose omp is at work
by the report is queued for that turn's end instead of typed into it.
- A send the queue makes by itself waits before it is taken up
(`awaitsOmp` in `drainPending`, `waitForOmp`): the message stays
queued, with nothing claimed and the pane's lane free, and the queue
is drained again when the wait ends. So what is typed into the pane's
terminal meanwhile goes at once, Send now and Discard find the message
as it is, and a pane that ends takes the message with it. That wait
goes on through a look herdr does not answer, since nothing else would
drain the pane at the report. A send of the queue's own that finds omp
starting after all gives the message back to the queue rather than
wait with the lane held. The first version of this change waited
inside the send for these too, which held the pane's lane, and every
key typed there, for up to half a minute.
An omp that has reported, one without the integration and one started
more than 30 s ago are typed into at once, as before. So is an omp whose
process `ompProcess` does not recognise (run through bunx or npx, or
listed without its arguments), as for the immediate send. `ompProcess`
also takes one of omp's own helper processes for the omp and reads the
process's environment on the server's thread; both are as they were for
the immediate send, and the queue now does them at a pane's first rest.
Also here, since a send can now be on its way for seconds: a first
message whose pane ended while it was on its way could not be taken with
the pane then, and went back to the queue (or stayed held) under the
dead pane's id, where the next pane herdr gave that id showed it and
could queue no first message of its own. It now goes once its send has
ended, with no receipt left for that id (`takenWithPane`). A
connection's own message stays held for it, as before. On main the
window was the send's own reads.
Tests first: 28 of the 36 unit tests in
server/core/pending-omp-start.test.ts fail with main's queue code; six
of the eight that pass are sends that do not wait, and two pin what
stays as it was (an earlier pane of the same id, a connection's own
message). The contract test (real herdr, a stand-in omp that loads the
integration and has not reported) fails on main, where the message is
typed before the report, and on the first version, where a key typed in
the terminal waited behind the message.
Mutants of the new code, run against the unit file: 19 of 25 fail a
test (one by never ending). The six that do not change nothing that is
typed: the status mark taken again after a wait, a second wait started
beside the first, the queue of another agent asked about omp, the
drain's shortcut while a wait is on, the mark that makes a running
drain run again, and the wait a send starts when it gives its message
back (the next drain starts it). 24 copies of the unit file run at once
on one CPU all passed, twice.
Two independent pre-push reviews ran; what each found is fixed here or
named above.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Messages sent while OMP is starting now wait until it is ready, then send in order. If startup takes too long, messages can still proceed after the wait expires.
Terminal input remains available while a queued message waits for OMP to report its session.
A first message for a workspace is no longer carried into another pane if its original pane closes during sending.
Pending OMP messages remain queued while an integrated OMP process starts. Delivery resumes after OMP reports its session or a stop condition occurs. The change also clears a first message when its pane ends during sending.
Changes: OMP queue delivery
Layer / File(s)
Summary
OMP startup detection and reporting server/core/composer.ts
The composer exports the report polling interval and startup deadline helper. untilOmpReported accepts polling and startup options, and the immediate-send path uses the updated options object.
Pending queue waits and delivery cleanup server/core/pending.ts, server/core/pending-omp-start.test.ts, server/pending-input.contract.test.ts, changelog.d/omp-queued-message-while-starting.md
Automatic delivery leaves qualifying OMP messages queued while waiting for a session report. Other OMP sends wait within the submit deadline. Tests cover queue behavior, wait conditions, send actions, and pane-end cleanup. The changelog records the two fixes.
devswha/ovis#1825: Fixes immediate-send waiting for Herdr’s OMP integration when OMP uses --session-dir; this PR extends startup-readiness handling to queued sends.
Suggested reviewers:jpcarranza94
Merge Risk: Minimal · previous review a5615
Queued messages now wait for a starting omp session to report before they are sent, matching the wait used by immediate sends. No concrete merge-blocking risk was found in the reviewed changes.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly summarizes the main change: queued messages wait for a starting OMP session, like immediate sends.
Docstring Coverage
Docstring coverage is 91.67% 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. Documentati…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description includes the required Change and Validation sections. It clearly explains the problem, resulting behavior, affected send paths, regression cases, test coverage, measured results, and s…
Full details: Docstring Coverage
Explanation
Docstring coverage is 91.67% 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 12 functions across 4 files. (1 skipped: 1 unsupported.)
Full details: Description check
Explanation
The description includes the required Change and Validation sections. It clearly explains the problem, resulting behavior, affected send paths, regression cases, test coverage, measured results, and skipped checks. It also includes contract-test coverage for the server changes.
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.
Reviewing files that changed from the base of the PR and between ce11b34 and a56150d.
Files selected for processing: 5
changelog.d/omp-queued-message-while-starting.md
server/core/composer.ts
server/core/pending-omp-start.test.ts
server/core/pending.ts
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; 5 remain after this review.
…terminal is typed into, keeps its place, and says what it waits for
Asked for by the merge pass's review of this PR's first push (a56150d).
1. (Opus, MEDIUM) The queue's own wait leaves the pane's lane free, and
omp has no check of its input box as Claude and Hermes have: a
partial line typed into omp's box during the wait was sent merged
with the queued message at the report, and two tests pinned that
order. The input lane now counts a person's own input to each pane
(typing, a key, an inserted line, a masked answer; not the
terminal's answers to its program, nor the mouse), and a wait that
sees any holds the pane's queued messages for their senders, with
the reason `typed_while_waiting`, at its next look. Typing that
reaches the pane another way (herdr's own window) is not seen: a
reader of omp's input box would be the larger fix.
2. (LOW, reproduced) A chat message sent at once during the wait waited
for the same report with the lane held, and was typed ahead of the
first message. It is accepted as a queued row behind what waits
(`pending` in its result), as a queue request that finds a message
waiting is. The terminal's input line still goes as typed, and a
saved copy's Send now is its sender's own choice of order.
3. (LOW, reproduced) A Discard pressed on a Send now that waited for omp
ran after the send, and answered ok for a message typed meanwhile.
The Discard now marks the message on its way, the send ends at its
next look with nothing typed, and the message goes as discarded:
both actions answer ok and the receipt says discarded. A Discard
that comes after the wait, in the send's last moment, answers with
the sent receipt, as on main.
4. (LOW) Nothing said why a row stayed queued at a pane at rest, or
sending for half a minute. A row has `waiting: "omp_starting"` while
it does (shared/protocol.ts), and the page says "Waiting for omp to
start…" on it. The new hold reason has the page's own words too.
Codex's two, both reproduced in the unit fixture:
- A look at omp's process that herdr did not answer read as "no omp is
starting", so the message was typed before omp took input. For the
queue it now fails (`startingOmp` strict): a send by hand is refused
with herdr's own code and nothing typed; the queue's own asks again
a moment later, the message still queued. The immediate send keeps
taking it for ready, as it always did.
- A snapshot herdr did not answer for the queue's look left a
connection's message queued with nothing to drain it. It is asked
again after one pause, for as long as an omp could still be starting
(half a minute); after that the send's own look decides, and a
failure there holds the message with herdr's code.
Tests first: 10 of the unit file's tests and the typing contract test
fail on a56150d. Mutants of this commit against the unit files: 17 of
18 fail a test; the one that did not (holding a message on its way too)
now has a test of its own in server/pending-input.test.ts.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ht after typing, is held while omp starts
The merge pass's review of 0f4ac18 (Codex, two HIGHs, reproduced): the merge of typed words and a
queued message through two other doors.
- A line sent from the terminal's input line counts as a person's typing before anything of it is
written, so what waits for a starting omp is held instead of pasted behind it.
- A chat message sent at once (or a queue request) after the terminal was typed into during omp's
start is accepted as held, also when the typing ended the wait while the message was admitted.
The start is remembered from the first message until omp takes input or the start is given up on.
- typedInto keeps the counts of the panes typed into last (it kept the first ones).
- A page's copy of a row the bridge no longer has no longer says "Waiting for omp to start…".
Merge pass: blocked at df62d01d1 on two reproduced HIGHs
The two HIGHs from 0f4ac18d5 are fixed: the old repro tests now show the queued message held (typed_while_waiting) and nothing pasted. Codex Terra found two new ones at this head, and both reproduce in the merge pass's own checkout with the PR's omp() fixture (appended to server/core/pending-omp-start.test.ts, both fail at expect(d.typed()).toEqual(["typed in the terminal"]), which also holds "\u001b[200~first words\u001b[201~" and "Enter").
HIGH 1: the start's deadline forgets the typing before it is compared (server/core/pending.ts, typedWhileOmpStarted). A first message waits for a starting omp, something is typed in the terminal, and the next 250 ms poll runs at or after start.until: forgetOmpStart runs before the counts are compared, the function answers false, and the wait's own deadline branch then sends the message behind the typed words.
it("review: typing just before startup deadline must hold the first message",async()=>{constd=omp();awaitd.first();awaitd.eventually("the wait for omp",()=>d.looks()>=2);awaitd.type();d.advance(30_001);awaitd.eventually("the hold or send",()=>d.listed()[0]?.state==="held"||d.calls.includes("Enter"));expect(d.typed()).toEqual(["typed in the terminal"]);expect(d.listed()[0]).toMatchObject({state: "held",error: {code: "typed_while_waiting"}});});
HIGH 2: typing during an unanswered startup look is not counted (awaitsOmp / waitForOmp(paneId, null)). A queued message reaches an omp at rest while herdr does not answer the look at its start; the wait with until === null records no start, so what is typed then is before the baseline that the later, answered wait takes. At omp's report the message is pasted and entered behind the typed words.
it("review: typing while startup probe is unavailable must hold queued message",async()=>{constd=omp();d.pane["agent_status"]="working";expect(awaitd.ways["a queue request typed at once"]()).toMatchObject({ok: true,pending: {state: "queued"}});d.pane["agent_status"]="idle";d.herdrNow.silent=true;awaitd.rest();awaitd.type();d.herdrNow.silent=false;d.hooks.look=(looks)=>{if(looks===2)d.report();};awaitd.eventually("the hold or send",()=>d.listed()[0]?.state==="held"||d.calls.includes("Enter"));expect(d.typed()).toEqual(["typed in the terminal"]);expect(d.listed()[0]).toMatchObject({state: "held",error: {code: "typed_while_waiting"}});});
Smallest fixes as the reviewer gave them: compare the counts before the start is given up on, and hold when they differ even past the deadline; take the typing baseline when the first unanswered look starts and carry it into the later wait.
The Claude (Opus) review of this head is still running; anything it adds follows in a second comment. Not merged.
Merge pass: from the Claude (Opus) review of df62d01d1 (CLEAR, nothing CRITICAL or HIGH)
One more for the same round, since both touch what ompStarts remembers:
MEDIUM (reproduced by the reviewer with the PR's fixture): a start that is over still holds messages for up to 30 s.
A new omp workspace's first message leaves the queue by Send now or Discard while it says "Waiting for omp to start…", and omp then starts with nothing typed. The start stays remembered, because only awaitsOmp forgets it and that no longer runs once nothing waits. Typing in the terminal after that, then sending a chat message or a queue request, gets the message held with "Something was typed in this terminal while omp was starting", though omp takes input. On main those went at once. Fix as given: forget the start when the Send now's own wait sees omp started with nothing typed, and when the queue's wait ends because nothing waits any more.
LOW, not run: an omp without herdr's integration can have its first message held for what was typed before omp started; the typing counter keeps the last 256 panes; a queued send to an omp that has not reported takes an extra snapshot and two process lookups.
Full reports: ~/.cache/ovis-tmp/reports/pr-3624-df62d01d-{claude,codex}.report.md.
…erdr does not answer, still holds; a start that is over holds nothing
The merge pass's review of df62d01 (Codex, two HIGHs; Opus, one MEDIUM, all reproduced):
- The queue's wait compares what was typed before it forgets the start at its end, so typing
just before that end holds the message instead of sending it behind those words.
- A look at omp's start that herdr does not answer takes the typing baseline then, and the wait
that follows once herdr answers keeps it.
- A start is forgotten once omp took input with nothing typed, also when the message left the
queue by Send now or Discard: what is typed and sent after that goes as before.
Merged head b221fc3202f1 as 711d7a885c34 on GitHub's checks, with no unresolved review threads.
Reviewer
Verdict
Note
claude
CLEAR
codex
CLEAR
Two reviewers at this head: Claude (Opus) CLEAR, Codex Terra CLEAR. Fourth head reviewed (a56150d48, 0f4ac18d5, df62d01d1, b221fc320); the four HIGHs of the earlier rounds were reproduced by the merge pass, and each one's test now passes at this head.
Left, both reproduced, for one follow-up PR (queued input a user can hit):
MEDIUM (Codex, reproduced by the merge pass): something is typed before the 30 s start deadline, and a chat message is sent after the deadline but before the wait's next 250 ms poll: the start is forgotten before the typing is compared, and the first message is pasted and entered behind the typed words.
MEDIUM (Claude, reproduced by it): after typing during the start held the first message and it went by Send now, the start stays remembered for the rest of its 30 s: the next chat message or queue request is held with "Something was typed in this terminal while omp was starting" though omp takes input.
LOW, not run: a herdr look that fails once at a long-running omp records a start that is not happening; the start outlives a change of agent in the pane; the new test file waits by a clock loop; an omp without herdr's integration can have its first message held for what was typed before it started; extra lookups per queued send.
Reports and tests: ~/.cache/ovis-tmp/reports/pr-3624-*.
… held first message went by Send now, goes as it should (#3638)
## Change
Fixes#3637. Follow-up to #3624 for the two MEDIUMs the merge pass
reproduced at its merged head `b221fc320` and asked for in one PR after
the merge. Both are about what `ompStarts` (the start of an omp that the
pane's queue waits for) remembers. Both affect queued input that a user
can reach.
1. **Typing just before omp's 30 s start limit, then a chat message sent
just after it (Codex).** The chat message's admission reached
`typedWhileOmpStarted` after the start's `until` and before the queue
wait's next 250 ms look. It forgot the start although the terminal had
been typed into. The wait's last check then had nothing to compare, and
the first message was pasted and entered behind the typed words. Now,
past `until`, a start whose wait is still on and whose pane was typed
into is kept and reads as typed into. The wait holds the first message
at its next look, and the chat message is held too.
2. **After a first message held for typing went by Send now, the next
message was held (Opus).** The Send now path forgot the start only when
nothing had been typed. After a hold, something always has been, so for
the rest of the 30 s a chat message sent at once, or a queue request,
was held with `typed_while_waiting`, although omp had reported and its
box was empty. On `main` before #3624 those went at once. A Send now to
an omp that has reported its session (`herdr:omp`) now ends the start:
its Enter submitted the box, typed words and all, as its sender chose.
Discard of the held message does not end the start (the reviewer's
alternative). The typed words are still in omp's box, and the next
message would be pasted behind them.
The reviewers' LOWs at that head are on the after-release list, as the
merge pass agreed: a herdr failure at a reported omp's turn end, an
agent change within the 30 s, the polled `eventually` helper of the test
file, and the earlier rounds' LOWs.
## Validation
- **Failing first:** the merge pass's repro
(`pr-3624-b221fc32-mergepass-review3.test.ts`, adapted into
`server/core/pending-omp-start.test.ts`) and Opus's run (one case each
for a chat message sent at once and a queue request) fail on
`b221fc320`'s `pending.ts` (3 fail) and pass with this change.
- `HERDR_TEST_MODE=unit bun test` on
`server/core/pending-omp-start.test.ts`,
`server/core/input-receipt.test.ts`,
`src/components/pendingStatus.test.ts`, `server/pending-input.test.ts`:
133 pass, 0 fail.
- `bun run check fast` on `1e30523da` (rebased on main `711d7a885`):
passed, unit 15,855 pass, 0 fail; typecheck and build ok.
- **Skipped:** contract tests (no HTTP/WS change), the browser
regressions (no page change), and the real-omp probe.
… so herdr keeps their state reports (#3644)
## Change
Since #3624, `server/pending-input.contract.test.ts` fails often on PR
runs (#3517, #3639, #3551 each needed a rerun). The failure is an omp
case of "delivers queued $text as $expected to $agent" at about 8.6 to
8.9 s ("queued command was not recorded", then "pending frame timeout"
in `state("idle")`), and once, the hookless-process test after it.
The cause is the test setup #3624 added, not the queue's wait for a
starting omp. For every omp stand-in, setup reported a `herdr:omp`
session (so a send would not wait for an omp that loads the integration
on a PC where it is installed). After that report, herdr drops the
manual `pane.report_agent` state report that `state("idle")` makes about
half the time. The pane stays `working`, the queue never sees its turn
end, and the queued message is never typed.
Measured on the isolated test herdr (a stand-in reported `working`, the
session report or not, then `idle`; the status read for a second after):
| stand-in | pane still `working` after `idle` |
|---|---|
| omp, with the `herdr:omp` session report | 7 of 15 |
| omp, without it | 0 of 15 |
| claude | 0 of 15 |
Fix: setup's omp stand-ins (other than the two omp-start tests', which
load the integration with `-e`) start with `--no-extensions`. The bridge
sees an omp that loads no integration, also on a PC where it is
installed, so no send waits for a report, and no session is reported.
The omp-start tests report their state before their session, and are
unchanged.
The hookless-process test that failed after the omp case did not fail in
any run here once the omp case passed. Not proven beyond that.
Test-only change.
## Validation
- Before (main `dd21d2155` test file): `bun run check run bun test
--timeout 30000 ./server/pending-input.contract.test.ts -t
"connection-owned pending input"`, 6 runs: 2 failed, each with an omp
case at about 8.6 to 9 s and one #540 neighbour.
- After: the same, 6 runs: 81 pass, 0 fail in each.
- The whole `server/pending-input.contract.test.ts`: 125 pass, 0 fail.
- `bun run check fast`: passed (unit 15,982 pass, 0 fail; typecheck and
build ok).
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
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.
Change
The queued-input finding of the code review of
shared/andserver/core/(server/core/pending.ts:700), which the merge pass held until #3574 and #3619 were merged.omp draws its input box before it takes an Enter, and herdr reads a pane with nothing reported as at rest a few seconds after it starts. The immediate send waits for herdr's omp integration to report the session (
untilOmpReported, #1475). The queue did not: a new workspace's first message, a queued message at its turn, a queue request typed at once and Send now pasted the message and pressed Enter as soon as herdr showed the pane at rest. On a start slower than that, the message stayed in omp's input box and never ran, while its row said sent.How each waits now:
awaitsOmp,waitForOmp): the message stays queued, with nothing claimed and the pane's lane free, and the queue is drained again when the wait ends. What is typed into the pane's terminal meanwhile goes at once, Send now and Discard find the message as it is, and a pane that ends takes the message with it. The wait goes on through a look herdr does not answer.Also here, since a send can now be on its way for seconds: a first message whose pane ended while it was on its way went back to the queue (or stayed held) under the dead pane's id, where the next pane herdr gave that id showed it and could queue no first message of its own. It now goes once its send has ended (
takenWithPane). A connection's own message stays held for it, as before.Second commit: the merge pass's review of the first push (a56150d)
typed_while_waiting. The two tests that pinned the merged order now pin the hold.pendingin its result), as a queue request that finds a message waiting is. The terminal's input line still goes as typed.PendingMessage.waiting: "omp_starting"on a queued row at a pane at rest and on a row on its way; the page shows "Waiting for omp to start…" (ko, ja, zh), and has its own words for the new hold reason.Limits of the second commit: typing that reaches the pane another way than through Ovis (herdr's own window) is not seen, so a reader of omp's input box would be the larger fix; a Discard that comes in a send's last moment, after its wait, still answers with the sent receipt, as on main; a Send now and a queue request typed at once still hold the pane's lane while they wait, as the immediate send does.
Not in this PR
An omp that has reported, one without the integration and one started more than 30 s ago are typed into at once, as before. So is an omp whose process
ompProcessdoes not recognise (run through bunx or npx, or listed without its arguments), as for the immediate send.ompProcessalso takes one of omp's own helper processes for the omp, and reads the process's environment on the server's thread; both are as they were for the immediate send, and the queue now does them at a pane's first rest. These three are on this session's list for the one PR after the release.Measured on a real omp
omp 18.14.0 under herdr 0.9.5 in an isolated session, a throwaway HOME with herdr's integration, the start slowed to 12% of a CPU: herdr showed
omp,idleand no session at 3.7 s and the session at 12.5 to 15 s. Through this checkout's server, a queue request for/hotkeyssent in between:/hotkeysstill in the input box 4 s after the report (1 of 1)/hotkeysstill in the input box (1 of 1)Tests
Written first:
server/core/pending-omp-start.test.ts(48 tests). First commit: 28 of its 36 fail with main's queue code. Second commit: 10 more fail on a56150d.server/pending-input.contract.test.ts, on real herdr with a stand-in omp that loads the integration and has not reported: the message goes only at the report and its row says what it waits for (fails on main); a key typed meanwhile goes at once and the message is held (fails on a56150d).server/core/input-receipt.test.ts(what counts as a person's typing),server/pending-input.test.ts(the row note, holding a pane's queued messages),src/components/pendingStatus.test.ts,src/lib/compose.test.ts.Pre-push reviews: two independent ones on the first commit (the lane held by the queue's own send, the message left under a dead pane's id, a timing-dependent test, the wait ending on a herdr failure, four unpinned guards: all fixed). The one started for the second commit ended on the account's rate limit before it reported, so the second commit has the merge pass's review only.
Validation
On
0f4ac18d5(two commits on mainf6cc7c384), on this PC (Linux, herdr 0.9.5):bun run check fast: workflow syntax, generated types and themes, typecheck, build and unit tests pass (15,794 pass, 0 fail, 51 skip in 899 files).bun run check run bun test --timeout 15000onserver/pending-input.contract.test.ts,server/omp.contract.test.tsandserver/submit.contract.test.ts: 237 pass, 0 fail. Withserver/opencode-first-message.contract.test.tsandserver/api.contract.test.tstoo, on the commit before its last three-line change (40fb59850): 440 pass, 0 fail.Skipped:
bun run check full, the browser regressions (the page change is one status line of a pending row and one hold reason's words, covered bypendingStatus.test.tsandcompose.test.ts; not run in a browser), Windows and macOS. On Windows herdr names only the shell in front, so nothing waits there, as for the immediate send.🤖 Generated with Claude Code