Skip to content

test(keybar): type into the demo shell only after its replay is written - #5073

Merged
devswha merged 2 commits into
mainfrom
fix/flaky-pinned-history
Nov 30, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/flaky-pinned-history

Conversation

@devswha

@devswha devswha commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Why

scripts/key-bar-pinned-history-regression.ts (added by #5059) flakes in the CI browser lane and keeps main red (run 46415772335: :179 TimeoutError: waitFor: Timeout 5000ms exceeded), which blocks every merge.

Cause

The demo's shell pane replays a recorded git log / bun test session on attach (site/demo/transport.ts, terminalFixture.frames, about 1.25 s). Its first frame switches to the alternate screen and clears it, and the later frames draw at fixed rows. The History and desktop sections typed into the shell straight after the page connected, so on a slow runner the typed line or the shell's answer was drawn over by the rest of the replay. A diagnostic run showed 0 frames written when typing started, and at the timeout the screen held only the replayed git log.

This is the test racing the demo's recording, not a product bug: a real pane has no replay.

Fix

Before typing into the shell, wait until the replay's last frame has been written and nothing is queued or in flight, read from the terminal's test-build outputProbe. This is the same wait terminal-release-no-watch-demo-regression.ts uses. Bounded at 10 s, with no fixed sleep.

Verification (this PC, under load, 5 runs at a time)

  • Before: 3 of 10 runs failed (lines 176 and 179).
  • After: 20 of 20 runs passed, each with all 7 PASS lines.
  • bun run typecheck passed, and the conventions.test.ts files passed (141 pass).

The demo shell replays a recording on attach; text typed before its last frame was drawn over, so the History and desktop checks timed out on slow CI runners.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

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.

Run configuration

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

  • Tests
    • Updated the History regression checks to wait for terminal replay to finish before typing on phone and desktop.

The regression script checks terminal output against the demo fixture and waits for replay to finish before starting the phone and desktop History interactions.

Changes: History regression replay gate

Layer / File(s) Summary
Replay completion before History interactions
scripts/key-bar-pinned-history-regression.ts
The script waits up to 10 seconds for terminal output to end with the fixture’s final-frame text and for in-flight and queued output to clear. The phone and desktop History interactions wait for replay completion.

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

Change: Other

Possibly related PRs

  • devswha/ovis#5059: This PR also changes timing behavior in the same regression script.
Merge Risk: Minimal · previous review e48cf

This change makes a CI regression script wait for the demo replay to finish before typing, which reduces flaky timeouts. It does not touch product code, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the History/desktop test now types into the demo shell only after its replay is written. It is specific, single-sentence, and matches the raw summary and objectives.
Description check Passed The description covers the cause (replay racing typed input), the fix (wait on the terminal test-build outputProbe, bounded at 10 s), and verification results (before/after run counts, typecheck, conv…
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: Description check

Explanation

The description covers the cause (replay racing typed input), the fix (wait on the terminal test-build outputProbe, bounded at 10 s), and verification results (before/after run counts, typecheck, conventions tests). It does not follow the repository template: the '## Change' and '## Validation' headings are absent, and the Validation section does not state the check commands run (bun run check fast, full) or whether any were skipped. The contract-test note for HTTP/WS changes is also not addressed. The required content is largely present, so the check passes, but the headings should be aligned with the template.

Finishing Touches

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 71e37b0 and e48cf7a.

Files selected for processing: 1

  • scripts/key-bar-pinned-history-regression.ts

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

@devswha

devswha commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

Review round at head e48cf7a:

  • omo reviewer (dori review): CLEAR.
  • Codex via axwith (gpt-6.2-sol, xhigh): CLEAR. It reproduced the original overwrite, confirmed that the 512-char tail first matches only on the replay's last frame and fits the 4096-char probe buffer, and confirmed that both the 360px and 1280px layouts select the shell pane.
    • LOW, not fixed: a detach and reattach on the same socket during the replay could let the previous replay's last frame satisfy the wait. The test's flow never reattaches, so this cannot happen in this script today.

@devswha
devswha merged commit dac4114 into main Nov 30, 2026
15 checks passed
@devswha

devswha commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

Merged through pr-merge at head ab4e3d1a8. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit reviewed this head.

main had moved since the checks of e48cf7a3e: pr-merge --update merged it in (5df4ea407), and every required check was green at this head.

Fixes the key-bar-pinned-history flake that keeps main red. Reviews: omo CLEAR, Codex via axwith CLEAR (one LOW in the PR comment, not fixed: a same-socket reattach the script never does). CI browser lane 2/3 passed the script on all 4 runs at e48cf7a.

@devswha
devswha deleted the fix/flaky-pinned-history branch November 30, 2026 15:13
devswha added a commit that referenced this pull request Nov 30, 2026
#5082)

## What

`scripts/sidebar-heads-demo-regression.ts` timed out on main (run
46348181507) and on #5073's rerun (job 141903279281) at
`scripts/pc-menu.ts:21`, waiting for `.row-menu, .row-sheet` after a
held press in "a phone's drawer opens each PC's menu with a held press".

## Why

The demo transport ends its opening turn 4.5 s after load
(`setTimeout(finishOpeningTurn, 4500)` in `site/demo/transport.ts`). The
turn's `done` droplet is shown while the drawer is open, sits just under
the top row and stays about 4 s. That is exactly where the open drawer's
first PC header (Laptop) is. On a slow runner the phone check reaches
that header inside the window, so:

- the CDP touch lands on `.droplet-card`, not the header: no press
timer, no menu, timeout at `pc-menu.ts:21`;
- or the earlier hit-test fails: "a tap on the middle of Laptop's title
lands on it" (reproduced locally on a loaded machine).

Proof: forcing the turn to end (`__ovisDemoFinishTurn()`) right before
the check fails it on the first scene, with `elementFromPoint` at the
title's middle answering `SPAN.droplet-title > ... > BUTTON.droplet-card
> DIV.droplet` ("Idempotent payments").

The product behaves as designed (a droplet may cover the drawer
briefly), so the test is fixed, not the app.

## Fix

Set `__ovisDemoHoldTurn` in an init script, as 11 other demo checks
already do: the opening turn never ends on a timer, so no droplet or
status change lands mid-check. No sleeps, no timeouts changed.

## Verification

- `bun scripts/sidebar-heads-demo-regression.ts`: 20 full runs started
together on a loaded machine (load ~140 on 128 cores), all exit 0 with
39 PASS each.
- `bun run typecheck`: exit 0.
- Before the fix, the same machine failed the phone scene once in 12
focused runs.

Test-only change: no changelog fragment.
devswha added a commit that referenced this pull request Nov 30, 2026
…UI retries a failed terminal list, a newly waiting agent shows through the resting fold (#5092)

Three bug fixes from the issue triage, bundled to cut CI reruns (each
already passed its own review round on its own PR; this PR adds no code
of its own).

- #5056: an update check's tag fetch gets five minutes (was #5080)
- #4493 item 6: the native TUI retries a failed terminal list read while
Online (was #5083)
- #3439 items 1-2: a newly waiting agent shows through the resting fold;
a short phone's row sheet stays usable (was #5091)

The combined diff is exactly the sum of the three branches: the same 16
files, each byte-identical to its original branch tip (checked file by
file).

Addresses #5056 (cause 2; cause 1 is kept as documented policy), items
1-2 of #3439 and item 6 of #4493; no closing keywords, since #4493 and
#3439 keep other items open. #5056 is closed by hand after the merge.

---

## #5056: updater tag fetch timeout (was #5080)

Fixes part of #5056 (cause 2: the tag fetch timeout).

### What happened
A check for updates fetches the release tags with `git fetch --no-tags
origin '+refs/tags/v*:refs/tags/v*'` through the updater's ordinary
`git()`, which kills any command after 30 s. On a shallow source
checkout the first such fetch brings every newer release's objects,
which takes longer than that on a slow link, so the check failed with
"git timed out" every time until the user ran the fetch by hand. The
unshallow fetch already had its own 10-minute bound for the same reason
(#1252); the tag fetch did not.

### Fix
The tag fetch goes through its own `tagFetch` with a five-minute bound
(`TAG_FETCH_TIMEOUT_MS`); every other git command keeps 30 s. Two test
fixtures that paused or failed the tag fetch by matching its arguments
in `git()` now override `tagFetch`.

### Not changed
Cause 1 (a detached, shallow tag checkout of a standalone install is
refused with "Switch the source checkout to main to update.") is the
documented policy for a non-plugin checkout and is left as is; the
issue's workaround (`git switch -c main`) remains the path.

### Verification
- Real repro with a `git` wrapper on PATH that sleeps 35 s before every
`fetch`, against a real upstream with a newer `v0.2.0` tag:
- main: `check after 30 s: {"error":"git timed out","available":false}`
- this branch: `check after 35 s:
{"error":null,"available":true,"latest_version":"0.2.0"}`
- New test "gives a check's tag fetch five minutes" fails on main,
passes here; `server/updater.test.ts` 57/57.
- `bun run check fast`: typecheck and build ok; unit tests had one
failure in `tui/testing/entry-pty.test.ts` (a 15 s flood deadline under
load, unrelated to this change), which passes 24/24 when run alone.

### Review round
Review round (omo gate + Codex via axwith), fixed in the commit above:
- MEDIUM (both reviewers): cancelling an install while its check's tag
fetch is in flight left the fetch running for up to five minutes and
then reported the git error. `cancel()` now ends a tag fetch in flight
(its own abort signal, not the updater's shutdown one), the run reports
`update_cancelled` and keeps the offered revision from installing by
itself; a tag fetch that starts after the cancel keeps the ordinary 30 s
bound. A cancel that comes before the fetch still lets the check finish,
so the offer stays shown (the existing "stops an install cancelled while
it still checks" test).
- LOW (both): the timeout test now checks that the five-minute deadline
is set by the tag fetch itself, not only that one exists somewhere.
- New test "ends a check's tag fetch in flight when its install is
cancelled" uses a git whose tag fetch never ends; it times out on the
previous head and passes here.

Not changed: a stalled fetch on the timer's own check still holds the
next 5-minute tick (LOW, unchanged in kind from main's 30 s). The CI
failure on the previous head was `key-bar-pinned-history-regression.ts`,
the flake #5073 addresses, not this change.

updater tests 58/58, typecheck ok.

---

## #4493 item 6: TUI terminal list retry (was #5083)

Fixes item 6 of #4493 (`tui/core/world.ts`: retry a failed terminal list
read while the link stays Online). The other items of #4493 are
untouched.

### What happened
In the native TUI, `CoreWorld` reads `terminal.list` once after a
change. When that read failed while the link stayed Online, nothing
asked again: the screen kept the old terminal list (a new terminal
stayed missing) until another change, a snapshot or a reconnect.
`world.test.ts` pinned that behavior.

### Fix
- A failed read while Online is retried after 250 ms, 500 ms and 1 s
(`TERMINAL_LIST_RETRY_MS` in `tui/model/deadlines.ts`), through the
loop's one timer as a `terminal_list` deadline; after the last one the
world waits for the next change, whose own read gets the same backoff
again.
- A snapshot, or the link leaving Online, drops the read in flight and
any retry due; a newer read for a change replaces a retry due.
- `readCore()` reads only while the link is Online.

### Verification
- New `tui/loop-terminal-list.test.ts` (fake core, fake clock, no
sleeps): a failed read shows the added terminal 250 ms later without
another event; a persistently failing list backs off 0/250/750/1750 ms
and stops, then a new change's failed read is retried at +250 ms; a
newer read supersedes the retry; no read while Offline and none extra
after reconnect. The first two fail on main (`0 pass, 4 fail` over two
runs). Removing the Online guards makes the Offline test fail. 3
consecutive runs green.
- `tui/core/world.test.ts` updated from pinning no retry to the retry.
- `bun run check fast` at the second commit: unit: 1367 test files unit:
28059 pass, 0 fail, 276 skip in 1367 files, 8 at a time, 262.3s;
typecheck, build and the other steps ok.

### Reviews
omo gate and Codex (via axwith, gpt-6.2-sol-fast xhigh) on `aa5f96180c`
both found the production change correct (no offline reads, no stale
answers applied, no timer spin) and flagged the Offline test for
checking the earliest timer of any kind (a repaint can be due first).
Fixed in the second commit: it now checks list reads while Offline; the
backoff test also covers a fresh read failing after the backoff (Codex
LOW).


---

## #3439 items 1-2: sidebar waiting row and row sheet (was #5091)

Fixes items 1 and 2 of #3439. Items 3-5 of that issue are done or
already decided there.

### What happened
1. With "Waiting first", a resting agent that started waiting while
focus was in the Agents section stayed hidden under the closed "+N
resting" line, because the list holds its order while focus is there.
2. On a short phone (375x500), a long agent title or workspace path made
the row menu sheet's header take the whole height: the actions got 0 px
and Cancel sat off screen.

### Fix
1. While the order is held, a newly waiting row shows through the closed
resting line in its held place (as the selected row already does), and
"+N resting" counts the rows still folded. If the focused "+N resting"
line disappears because its last row started waiting, focus moves to the
row that takes its place (or the Agents heading), so the hold still ends
when focus leaves.
2. `.row-sheet-head` is capped at 30vh and scrolls; the reason and token
parts inside it no longer scroll on their own (no nested scrollers).
When the header overflows it becomes a keyboard-focusable region (Tab
reaches it, arrows scroll it); the sheet still opens on its first
action.

Changes what the sidebar shows (item 1), so the screenshots are below;
DESIGN.md is updated.

### Before / after
Row menu sheet, 375x500, a long agent title:

| Before (main) | After |
|---|---|
|
![](https://raw.githubusercontent.com/devswha/ovis/114d9643fea71aec07f4a3f32f94211c70e89c71/3439/before-sheet-long-title-375x500-light.png)
|
![](https://raw.githubusercontent.com/devswha/ovis/114d9643fea71aec07f4a3f32f94211c70e89c71/3439/after-sheet-long-title-375x500-light.png)
|

Keyboard: Tab now reaches the scrolling header (focus ring):

| Before | After |
|---|---|
|
![](https://raw.githubusercontent.com/devswha/ovis/114d9643fea71aec07f4a3f32f94211c70e89c71/3439/before-sheet-head-keyboard-focus-375x500-light.png)
|
![](https://raw.githubusercontent.com/devswha/ovis/114d9643fea71aec07f4a3f32f94211c70e89c71/3439/after-sheet-head-keyboard-focus-375x500-light.png)
|

Sidebar 1280x800: a resting agent starts waiting while focus is in
Agents:

| Before (main) | After |
|---|---|
|
![](https://raw.githubusercontent.com/devswha/ovis/114d9643fea71aec07f4a3f32f94211c70e89c71/3439/before-sidebar-waiting-while-focused-1280x800-light.png)
|
![](https://raw.githubusercontent.com/devswha/ovis/114d9643fea71aec07f4a3f32f94211c70e89c71/3439/after-sidebar-waiting-while-focused-1280x800-light.png)
|

### Verification
- 375x500 measurement: before, header 393 px, actions 0 px, Cancel at
462-506 px (off screen); after, header 150 px, actions 96 px, Cancel at
435-479 px.
- `AgentSidebar.test.tsx`: the old test that pinned the hidden row now
expects it shown; a new test focuses the "+N resting" button itself and
checks focus stays in the list and the hold ends when focus leaves
(fails before). A touch test's held order and the "+N resting" count
changed deliberately with item 1.
- `scripts/sidebar-tokens-demo-regression.ts`: the 375x500 cases check
the actions and Cancel are hit-testable, and that Tab reaches the header
and ArrowDown scrolls it (fails on the first commit; `overflow-y:
hidden` fails it too).
- Sidebar and row menu tests 64/64 after merging main, typecheck ok;
`bun run check fast` green on the first commit.

### Reviews
omo gate and Codex (via axwith, gpt-6.2-sol-fast xhigh) on ec232a4:
both confirmed the two fixes and flagged two keyboard regressions (focus
lost with the disappearing "+N resting" line; the scrolling header
unreachable by Tab), fixed in bdeacd8. Left as is: a 320x150 viewport
(400% zoom) still leaves no room for the actions (it had none before
either), and the demo regression does not check which element scrolls
when a wheel starts over the reason or tokens.

---------

Co-authored-by: sisyphus-dev-ai <[email protected]>
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