Repository navigation
test(skills): ignore filesystem order in discovery assertion - #1251
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
…1248) ## Change Short Codex replies now appear in Chat when the terminal adds a completion footer such as `Worked for <1s • 13:02`. Previously, that timing line became part of the answer being compared with the saved transcript, leaving Chat unavailable. This covers a remaining case after the earlier short-reply fix. Literal answer text and the existing checks against selecting another conversation are preserved. All existing test assertions remain unchanged. Fixes #1247. Related: #1155. ## Validation - `TMPDIR=/dev/shm bun run check fast`: 4,166 passed, zero failures, eight skips; typecheck, build, generated types and workflow syntax passed. - `bun run check run bun test server/codex.contract.test.ts server/codex-binding.contract.test.ts`: 14 passed. - The new footer regressions fail on unchanged upstream. With the fix, real Codex 0.163.0 and native herdr 0.9.5 show the same saved reply in Chat on desktop and phone. The replay uses local fixed responses and agent-browser CLI. - Two independent agent reviews completed with no remaining findings. The fix is also deployed on our own fork. Hosted CI encountered two failures in unchanged checks. Separate test-only PR #1251 fixes the skills directory-order assertion and has all checks green. The unchanged split-view browser check passed when rerun on this exact PR head; a fresh full UI-contexts run stopped earlier in a different secret-input check. [Results and runner](https://github.com/christso/herdr-web-ui/blob/b6426db339ae029b4f555c5dafb3de5362c86bcc/docs/upstream-review-refresh/README.md#unrelated-ci-failures-1192--1248). The full hosted browser check still needs a maintainer rerun; existing assertions remain unchanged. [Reproduction commands and detailed evidence](https://github.com/christso/herdr-web-ui/blob/933a2c08d3659d87e2f975d907dd3c5c227459e5/docs/codex-completion-footer/upstream-follow-up/README.md). All screenshots and testing documents live on the fork's orphan evidence branch and are absent from this PR. | Before | After | | --- | --- | |  |  | --------- Co-authored-by: Hako <[email protected]>
## Change When OMP asks you to choose an answer, shrinking its terminal pane can cut off the keyboard instructions at the bottom. This can happen in a small window or side-by-side panes; splitting is not required. In our OMP 18.0.0 reproduction, the pane was 43 text columns wide and OMP shortened `Esc cancel` to `Esc…`. Chat then shows no question card, even though OMP is waiting for an answer in Terminal. The web UI expects the full instructions and misses the shortened version. This recognizes the older OMP instructions ending at `Esc can…`, `Esc…` or `Tab/←/→…`. It still requires complete preceding controls, exactly one selected option and aligned option markers. Ambiguous menus and questions followed by later output remain rejected. Current OMP handling from the merged #1184 is preserved. ## Validation - Refreshed against upstream `95507e2`; the diff remains three files: parser, additive tests and changelog. Existing test assertions are unchanged. - `HERDR_TEST_MODE=unit bun test server/prompt.test.ts` — 302 passed. - `TMPDIR=/dev/shm bun run check fast` — 4,163 passed, zero failures, eight skipped. The first run hit an unchanged Portal process-identity test; that file passed separately, and the complete rerun passed without changes. - Independent Standards and Spec reviews found no issues. - Hosted Fast checks hit the unchanged directory-order assertion in `server/skills/walk.test.ts:35`. Separate test-only PR #1251 fixes that assertion and has all CI checks green; it is not bundled here. - Earlier native checks verified the question-and-answer round trip with OMP 18.0.0 and 18.10.4 ([results and screenshots](https://github.com/christso/herdr-web-ui/blob/b72e5026bbe18a238bba749157450c1a4c95a479/docs/omp-clipped-footer/final-native-check.md)). [OMP 18.11.1 also passed](https://github.com/christso/herdr-web-ui/actions/runs/38826118600). Before and after, using an isolated fictional session:   Evidence stays on the fork's orphan branch. Related: #1182 and #1187. --------- Co-authored-by: Hako <[email protected]>
## Change Three integration and unit tests fail CI intermittently on PRs that do not touch them. This makes one of them reliable (root cause reproduced), hardens another, and makes the third report why it failed. Test code only; production code is untouched, so there is no changelog fragment. - **`scripts/check.test.ts` › "fails closed when source identity is lost after the fast checks"** (Fixes #1225). The nested `check.ts fast` runs with `CHECK_DIR`, so it takes the PC-wide admission port (41745). The self-hosted runners share one loopback, and lanes waiting for a slot (`CHECK_WAIT_SECONDS: 2400`) hold that port while they poll. Fast checks sets no wait, so a moment's overlap refused the nested run before it wrote its report. The test then read the previous report (`unchanged: null`) or found none (ENOENT), which are the two symptoms in the issue. The nested run now gets `CHECK_WAIT_SECONDS=20`. - **`server/pending-input.contract.test.ts` › "two connections share refusal then retry a new attempt once" / "shares a held row's send with its saved copy"**. The typed barrier was awaited through an `fs.watch` on the temp root with a 5 s limit. It failed with `recorder barrier timed out` on three main pushes in a row on 2026-10-16 (runs 38927859150, 38929423777, 38932829315); no issue was filed. The file's own notes say `fs.watch` can drop a change, and every other barrier in the file uses `waitBytes`. The barrier now uses `waitBytes` too: it reads the recorder log directly, allows 8 s, and prints the bytes it saw on timeout. - **`server/usage-login.contract.test.ts` › "starts claude in an isolated credential home"** (Refs #1260). The root cause is not found. As the issue suggests, the timeout now says whether the receipt was written, whether the pane exited, and what the pane shows. Not included: the skill-walk ordering failure in Fast checks, which #1251 fixes. ## Validation - #1225, reproduced: with 127.0.0.1:41745 held for 3 s, the old test fails with `ENOENT .../.check/report.json` (the CI symptom) and the new test passes (6.1 s). It also passes with the port free (2.1 s). Command: `HERDR_TEST_MODE=unit bun test --timeout 60000 scripts/check.test.ts -t "fails closed when source identity is lost after the fast checks"`. - pending-input and usage-login could not be reproduced locally: secret then usage-login ×8 on one isolated session, then usage-login plus the two pending-input cases ×10 with 28 busy cores, all through `bun run check run`, all green. So the pending-input change is a hardening whose effect on CI is not yet measured. - The new usage-login diagnostic was exercised with a temporary copy whose fake claude exits before its receipt: `login did not finish: receipt missing, pane exited; the pane shows: ...`. - `bun run check run` for both integration files in full: 80 pass, 0 fail. - `bun run check fast`: exit 0; unit 4,284 pass, 0 fail, 8 skip; typecheck, build and workflow checks pass.
## Change OMP updates can change the question dialog and stop Chat's question cards working. This adds a Monday check comparing OMP 18.10.4 with the latest stable release, plus a manual run for a specific version. The candidate version is resolved once per run. The check starts real OMP in an isolated Herdr pane. A fake provider invokes its built-in `ask` tool without credentials or paid model calls. Agent-browser selects answers, enters custom text and submits the final review; the provider verifies exactly what OMP received. Versions, logs and fictional screenshots are uploaded even on failure. The workflow is separate from PR checks and has read-only repository permissions. It does not create issues. Related: #1182; the companion parser fix #1184 is now merged. This branch includes current upstream and changes only the workflow, its script and the tools TypeScript configuration. ## Validation - `bun run check fast`: 4,162 passed, eight skips, no failures; workflow syntax, generated types, typecheck and build passed. - On exact refreshed head `640c440`, real OMP 18.10.4 and latest stable 18.11.3 passed desktop and phone checks: non-default selection, multiple answers, custom text, a wrapped question and review submission. Both verified the exact native answers using the merged upstream parser. - Hosted integration, both browser jobs, Windows and macOS passed. The sole CI failure is the unchanged skills directory-order assertion. Separate test-only PR #1251 fixes it and has all CI checks green; that change stays out of this PR. - Independent Standards and Spec reviews found no issues. [Current reports, screenshots and repeat commands](https://github.com/christso/herdr-web-ui/blob/b6426db339ae029b4f555c5dafb3de5362c86bcc/docs/upstream-review-refresh/README.md#omp-weekly-compatibility-check-1187). - [Earlier hosted red/green checks and commands](https://github.com/christso/herdr-web-ui/blob/8a86871d6e882fd612f5e5fd6f200d13da435a53/docs/native-omp-question-compatibility.md) demonstrate detection of the original parser failure. [Older-version checks](https://github.com/christso/herdr-web-ui/blob/7434a30dfcf9640709b5b2b2558c2c394ecdeaac/docs/older-omp-compatibility.md) exposed the separate clipped-hint case in #1192. The check runs on hosted Linux and covers the baseline and candidate, not every historical release. Wrapped-question fixtures keep all choices visible; Chat still declines ambiguous or off-screen menus. Evidence stays on the fork's orphan branch. --------- Co-authored-by: Hako <[email protected]>
… a failed unshallow fetch (#1258) Fixes #1252. ## Problem On a slow link the unshallow fetch in `Updater.ancestor()` does not finish within the 30 s bound of `runCommand()`, the process group is killed with `SIGKILL`, and git leaves its half-written pack behind as `.git/objects/pack/tmp_pack_*`. The 5-minute check then repeats the same fetch. On our machine this added up to 879 files, 17.2 GiB and as much wasted traffic in three days. ## Change Options 1 and 2 from the issue, plus a cleanup that the measurement below showed is needed: - **`Updater.fetchInto()`**: every fetch into the checkout (the tag fetch of each check and the one-off unshallow fetch) records the `tmp_pack_*` files in `.git/objects/pack` before it runs and, if it fails, removes the ones it added. Files that were there before, and the directory's other files, are left alone, and a removal that fails does not replace the fetch's own error. This does not depend on how git was stopped, so it also covers Windows, where a process group cannot be signalled. It assumes this updater's fetches are the only git writing into the checkout. - **`runCommand()`**: on timeout or cancel, the process group first gets `SIGTERM`; `SIGKILL` follows only if it has not exited after a grace period (`KILL_GRACE_MS`, 2 s; optional parameter so tests can shorten it). This is for git's lock files: after `SIGTERM` git removes `.git/shallow.lock`, after `SIGKILL` it stays and every later fetch fails with `Unable to create '…/.git/shallow.lock': File exists`. Error messages and resolve/reject behaviour are unchanged; the grace timer is cleared when the child closes. - **`Updater.ancestor()`**: the unshallow fetch runs with its own timeout (`UNSHALLOW_TIMEOUT_MS`, 10 min) instead of the 30 s default. After a failure the 5-minute timer does not try it again for `UNSHALLOW_RETRY_MS` (6 h, in memory), whichever request the failure came from; during that time its check fails with an error that says when the next attempt is, rather than fetching again or reporting a false "not part of the release history" block. - **`Updater.request(command, byUser)`, `supervisor.ts`**: a Check or Update from Settings reaches the updater through the supervisor's IPC, which now passes `byUser = true`. Such a request fetches the history again at once instead of waiting the 6 hours out; after a failed check the API refuses an install (nothing is available), so Check is the user's way to retry. Both timers (the first check after 10 s and the 5-minute one) pass nothing. - Changelog fragment `changelog.d/updater-fetch-tmp-pack-leak.md`. I left out `--filter=blob:none`: it would turn the plugin checkout into a partial clone, and later `git show` of the release's CHANGELOG would fetch blobs lazily over the network. ## Tests New tests in `server/updater.test.ts`: | Test | Breaks if | |---|---| | a timed-out command is asked to end with `SIGTERM` (the child's handler writes a marker) | the timeout kills with `SIGKILL` right away | | a command that ignores `SIGTERM` is killed once the grace period is up (bounded wait, no hang) | the `SIGKILL` fallback is removed | | a cancelled command (abort) also gets `SIGTERM` first | the abort path kills with `SIGKILL` | | a failed unshallow fetch is not repeated by the next check; the check ends with an error, not a block | the backoff is not checked or not set | | a user's own check fetches again at once, with the fetch's own error | the flag is dropped on the way to `ancestor()` | | the supervisor's IPC hands `check` to the updater as the user's own (real `runSupervisor` in a child process, updater swapped for a recording one) | the IPC passes no flag, or `false` | | a user's own failed fetch starts the backoff too: the timer's next check does not fetch | a user's failure sets no backoff | | the timer's checks (first after 10 s, then every 5 min, fake timers) never pass as a user's | either timer passes `byUser = true` | | the fetch is tried again once the backoff is over | the backoff never ends | | the unshallow fetch gets its own timeout, and the real `unshallowFetch()` hands that argv and timeout to its runner | it falls back to the 30 s default | | a failed tag fetch's `tmp_pack_*` is removed (its own checkout) | the tag fetch bypasses the cleanup | | a failed unshallow fetch's `tmp_pack_*` is removed | the unshallow fetch bypasses the cleanup | | a `tmp_pack_*` that was there before the fetch is kept | the snapshot is empty or taken after the fetch | | no other file in the pack directory is touched | the cleanup removes more than new `tmp_pack_*` | | a successful fetch keeps what it wrote | the cleanup also runs on success | | the fetch's own error is reported even when a removal fails | a removal error replaces it | Each row was checked with a mutant of the fix: the named test failed. Against `main`'s `updater.ts` and `supervisor.ts`, 13 of the 16 new tests fail. Three pass there too: the `SIGKILL` fallback (an immediate `SIGKILL` also ends a child that ignores `SIGTERM`), "a `tmp_pack_*` that was there before is kept" (`main` removes nothing), and the timer's checks (`main`'s `request()` takes no flag, so nothing can pass as the user's there). Run locally (macOS 27, Bun 1.4.2, git 2.54.0): ``` bun test server/updater.test.ts 34 pass, 0 fail (2 consecutive runs) bun run typecheck ok bun test server/conventions.test.ts scripts/conventions.test.ts scripts/changelog-fold.test.ts 31 pass, 0 fail ``` `scripts/fixed-sleeps.json` counts are unchanged. I did not run the integration suite, since it needs a live herdr session; CI will. The earlier CI run on c04ef8d failed in `server/skills/walk.test.ts` (filesystem order, fixed on `main` by #1251) and in `scripts/split-view-regression.ts`; neither file is touched here. ### Correction An earlier version of this description, and the issue (#1252, "Suggested fix" 1 and step 5), said that git removes its temporary `tmp_pack_*` files on `SIGTERM`/`SIGINT` and that only `SIGKILL` leaves them behind. That was wrong. I measured it, and git leaves the half-written pack behind however the fetch ends: `SIGTERM`, `SIGINT`, `SIGKILL`, and also when git exits on its own error because the server side went away. A later successful fetch does not remove it either; `git count-objects -v` reports it as `garbage`. The signal only decides what happens to `.git/shallow.lock`. That is why the fix now removes the files itself after a failed fetch, instead of relying on `SIGTERM`. Measured with git 2.54.0 (Apple Git-157) on macOS 27 (arm64), using a local origin and a throttled upload-pack so that the unshallow fetch is still running when it is interrupted. The same result came from an HTTPS fetch of `github.com/git/git` that was interrupted the same way. <details><summary>Script (bash; needs git, python3, pgrep with <code>-g</code>)</summary> ```bash #!/bin/bash # What does an interrupted `git fetch --unshallow` leave in .git? Self-contained: a local origin, # a shallow clone, and an upload-pack throttled to ~200 KB/s so the fetch is still running when # it is interrupted. Usage: probe.sh WORKDIR set -eu W=$1; rm -rf "$W"; mkdir -p "$W"; cd "$W" git --version # origin: 150 commits, each rewriting one 256 KiB random file -> the tip holds one blob, # the history 150 incompressible ones (~38 MiB) that only an unshallow fetch downloads git init -q origin for i in $(seq 1 150); do head -c 262144 /dev/urandom > origin/blob.bin git -C origin add blob.bin; git -C origin -c user.name=p -c user.email=p@p commit -qm "c$i" done cat > throttle.py <<'PY' import sys, time i, o = sys.stdin.buffer, sys.stdout.buffer while True: b = i.read1(16384) if not b: break o.write(b); o.flush(); time.sleep(0.08) PY printf '#!/bin/sh\ngit-upload-pack "$@" | python3 -I %s/throttle.py\n' "$W" > slow-upload-pack.sh chmod +x slow-upload-pack.sh git clone -q --depth 1 "file://$W/origin" base echo "base is shallow: $(git -C base rev-parse --is-shallow-repository)" for mode in TERM INT KILL SERVER-EOF; do rm -rf "c-$mode"; cp -R base "c-$mode"; cd "c-$mode" set -m # the fetch gets its own process group, like runCommand's detached spawn git fetch --no-tags --unshallow --upload-pack="$W/slow-upload-pack.sh" origin 2>"../$mode.err" & pid=$!; set +m n=0; until ls .git/objects/pack/tmp_pack_* >/dev/null 2>&1; do sleep 0.1; n=$((n+1)); [ $n -lt 600 ]; done sleep 1 echo "== $mode: before: $(cd .git && ls objects/pack/ | grep tmp_ | tr '\n' ' ')$(cd .git && ls *.lock 2>/dev/null | tr '\n' ' ')" case $mode in TERM) kill -TERM -- -$pid ;; INT) kill -INT -- -$pid ;; KILL) kill -KILL -- -$pid ;; SERVER-EOF) kill -KILL $(pgrep -g $pid -f throttle.py) ;; # the server side goes away; git ends itself esac rc=0; wait $pid 2>/dev/null || rc=$? sleep 1 echo " rc=$rc after: $(cd .git && ls objects/pack/ | grep tmp_ | tr '\n' ' ')$(cd .git && ls *.lock 2>/dev/null | tr '\n' ' ') group left: $(pgrep -g $pid | tr '\n' ' ')" echo " git stderr: $(tail -c 160 ../$mode.err | tr '\r\n' ' ')" nrc=0; git fetch -q --no-tags --unshallow origin 2>../$mode.next || nrc=$? echo " next plain fetch: rc=$nrc $(grep -i fatal ../$mode.next | head -1)" cd .. done ``` </details> Output (two runs, same result; the working directory is shown as `$W`): ``` git version 2.54.0 (Apple Git-157) base is shallow: true == TERM: before: tmp_pack_2gx4Rl shallow.lock rc=143 after: tmp_pack_2gx4Rl group left: git stderr: next plain fetch: rc=0 == INT: before: tmp_pack_ADFdcN shallow.lock rc=130 after: tmp_pack_ADFdcN group left: git stderr: … KeyboardInterrupt fetch-pack: unexpected disconnect while reading sideband packet next plain fetch: rc=0 == KILL: before: tmp_pack_QQn8FI shallow.lock rc=137 after: tmp_pack_QQn8FI shallow.lock group left: git stderr: next plain fetch: rc=128 fatal: Unable to create '$W/c-KILL/.git/shallow.lock': File exists. == SERVER-EOF: before: tmp_pack_izlx4C shallow.lock rc=128 after: tmp_pack_izlx4C group left: git stderr: fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF fatal: fetch-pack: invalid index-pack output next plain fetch: rc=0 ``` After the next successful fetch, every clone still holds its leftover: ``` $ git -C $W/c-TERM count-objects -vH | grep garbage warning: garbage found: .git/objects/pack/tmp_pack_2gx4Rl garbage: 1 size-garbage: 127.96 KiB ``` (the same for `c-INT`, `c-KILL` and `c-SERVER-EOF`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: GLM-5.3 (z.ai) via Claude Code <[email protected]> Co-authored-by: Hako <[email protected]>
Change
Fast checks can fail even when skill discovery returns the correct names and descriptions, because this assertion also depends on filesystem directory order. This sorts the complete results before comparison, matching the neighboring tests. The expected values and result count are unchanged; production code is untouched.
Related: #1192 and #1248, whose CI runs both hit this failure.
Validation
/dev/shm.bun run check fast: 4,162 passed, zero failures, eight skipped; typecheck, build and workflow checks passed.