Skip to content

🙌 OpenHands: AI-Driven Development

feat(verify-openhands): close the harness gaps, re-drive the recipes, and file the reproduced defects (#18162)

Engel Nystd7468b5af9a5
diff --git a/.agents/skills/verify-openhands/SKILL.md b/.agents/skills/verify-openhands/SKILL.md
index 3acbd38f61..5dc2aa0cf9 100644
--- a/.agents/skills/verify-openhands/SKILL.md
+++ b/.agents/skills/verify-openhands/SKILL.md
@@ -122,9 +122,12 @@ control-openhands stop # stops only this run; evidence s
(stale session key). `restart` keeps the browser on its page. While a service
is stopped, a reload replaces the page with the backend-unavailable screen, so
drive backend-down states on the page that was already loaded. `browser
- network`, `browser toasts` and `browser media` observe requests by origin,
- toasts and sound without changing anything. Check `--help` before calling a
- state unreachable: most "can't be driven" claims predate a verb.
+ network` (with `--bodies`, what the page sent, credentials redacted),
+ `browser toasts` and `browser media` observe requests by origin, toasts and
+ sound without changing anything; `click --observe SEL` and `scroll
+ --observe SEL` record the transient states SEL shows while the action's
+ effects play out (a "Saving..." label, a loading row). Check `--help` before
+ calling a state unreachable: most "can't be driven" claims predate a verb.
- **Evidence** goes under `<run>/evidence/<feature-id>/` and the append-only
ledger `<run>/evidence/ledger.jsonl`. Nothing is overwritten: a repeated
screenshot name is saved as `<name>-2.png`, so cite the path the command
diff --git a/.agents/skills/verify-openhands/references/feature-map/F05-composer.md b/.agents/skills/verify-openhands/references/feature-map/F05-composer.md
index d7a7912d9f..0231e6f259 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F05-composer.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F05-composer.md
@@ -66,7 +66,7 @@ Preconditions:
- **Agent profile before start (`F05.agent-profile-switch`).** Run `control-openhands browser goto /`, `control-openhands browser click 'testid=chat-plus-button'`, `control-openhands browser hover 'testid=switch-agent-profile-button'` and `control-openhands browser text 'testid=agent-profile-submenu'`: `AVAILABLE PROFILES`, `default` (checked; `chat-input-agent-profile-option-default`), `Manage agent profiles`. `control-openhands browser click 'testid=agent-profile-submenu >> text=Manage agent profiles' --expect-url 'settings/agents'` lands on `/settings/agents`. In a started conversation (`control-openhands browser goto /conversations/<id>`) `control-openhands browser click 'testid=chat-plus-button'` then `control-openhands browser count 'testid=switch-agent-profile-button'` is `0`.
- **Attach a file and an image (`F05.attach-files`).** On `/conversations/<id>` run `control-openhands browser upload 'testid=upload-image-input' "$OH_VERIFY_RUN/evidence/_fixtures/qa-image.png" "$OH_VERIFY_RUN/evidence/_fixtures/qa-note.txt"` and `control-openhands browser screenshot 'testid=interactive-chat-box' --feature F05.attach-files --name attached`: a `qa-note.txt TXT` chip and a thumbnail. `control-openhands browser count 'testid=interactive-chat-box >> alt=qa-image.png'` is `1`. `control-openhands browser click 'role=button[name="Upload as file"]'` turns the image toggle into `Do not upload as file` (`control-openhands browser attr 'role=button[name="Do not upload as file"]' aria-pressed` is `true`); click it again to restore. The remove buttons are named: `control-openhands browser snapshot 'testid=interactive-chat-box'` lists `button "Remove qa-note.txt"` and `button "Remove image"`. Remove the image with `control-openhands browser click 'testid=interactive-chat-box >> role=button[name="Remove image"]'`; the `alt=qa-image.png` count is `0`. Then `control-openhands browser type 'testid=chat-input' 'Reply with only the content of the attached file.'`, `control-openhands browser press Enter --selector 'testid=chat-input'`, wait as in Type and send, and `control-openhands browser text 'testid=user-message >> nth=-1'`: it ends `NEW FILES ADDED: qa-note.txt`. `control-openhands conversation events <id> --kinds MessageEvent --last 3` shows the reply `QA attachment 7731`, and `qa-note.txt` sits in the conversation `workspace` printed by `control-openhands conversation status <id>`.
- **Size limit (`F05.attach-size-limit`).** Arrange `head -c 4194304 /dev/zero > "$OH_VERIFY_RUN/evidence/_fixtures/qa-big.bin"` (and `qa-two-a.bin`, `qa-two-b.bin` with `head -c 2097152`). Run `control-openhands browser upload 'testid=upload-image-input' "$OH_VERIFY_RUN/evidence/_fixtures/qa-big.bin"` and `control-openhands browser toasts`: `Error: Files exceeding 3MB are not allowed: qa-big.bin`. Uploading `qa-two-a.bin` and `qa-two-b.bin` together toasts `Error: Total file size would be 4.0MB, exceeding the 3MB limit. Please select fewer or smaller files.` `control-openhands browser count 'testid=interactive-chat-box >> text=qa-big.bin'` is `0`.
-- **Image alone (`F05.image-only-send`).** From the home composer: `control-openhands browser goto /`, `control-openhands browser enabled 'testid=submit-button'` (`false`, empty field), `control-openhands browser click 'testid=chat-plus-button'`, `control-openhands browser upload-via 'testid=add-files-and-images-button' "$OH_VERIFY_RUN/evidence/_fixtures/qa-image.png"`, then `control-openhands browser count 'testid=home-chat-launcher >> alt=qa-image.png'` (`1`) and `control-openhands browser enabled 'testid=submit-button'`: `true` while `control-openhands browser eval "document.querySelector('[data-testid=chat-input]').innerText"` is still empty (`control-openhands browser screenshot 'testid=home-chat-launcher' --feature F05.image-only-send --name image-alone-send-enabled`). Run `control-openhands browser click 'testid=submit-button' --expect-url '/conversations/'` and read `<image-id>` from `control-openhands browser url`. After `control-openhands browser wait 'testid=user-message'` and `control-openhands browser wait 'testid=chat-message-sending' --state detached --timeout 5000` (the pending bubble carries `testid=user-message` too, so wait for its `Sending...` to go, not only for a bubble; the wait returns `"state": "detached"` at once when the indicator has already gone, the usual case on a local stack), `control-openhands browser count 'testid=user-message >> testid=image-preview'` is `1`, and `control-openhands browser count 'testid=chat-message-sending'` and `control-openhands browser count 'testid=chat-message-retry'` are `0`. Server side, `control-openhands conversation events <image-id> --kinds MessageEvent --grep 'data:image/png;base64'` matches the one user row (`count` `1`; its text is a blank and the excerpt shows the `"type":"image"` block with `image_urls`). Whether the model is handed the picture needs a key (blocked here: DEEPSEEK_API_KEY): with one, send the image together with `Which two colours are the bars in this image? Answer with the colour names only.` and expect `orange` and `blue` in the reply (`fixture image` draws those bars). Return with `control-openhands browser goto /conversations/<id>`.
+- **Image alone (`F05.image-only-send`).** From the home composer: `control-openhands browser goto /`, `control-openhands browser enabled 'testid=submit-button'` (`false`, empty field), `control-openhands browser click 'testid=chat-plus-button'`, `control-openhands browser upload-via 'testid=add-files-and-images-button' "$OH_VERIFY_RUN/evidence/_fixtures/qa-image.png"`, then `control-openhands browser count 'testid=home-chat-launcher >> alt=qa-image.png'` (`1`) and `control-openhands browser enabled 'testid=submit-button'`: `true` while `control-openhands browser eval "document.querySelector('[data-testid=chat-input]').innerText"` is still empty (`control-openhands browser screenshot 'testid=home-chat-launcher' --feature F05.image-only-send --name image-alone-send-enabled`). Run `control-openhands browser click 'testid=submit-button' --expect-url '/conversations/'` and read `<image-id>` from `control-openhands browser url`. After `control-openhands browser wait 'testid=user-message'` and `control-openhands browser wait 'testid=chat-message-sending' --state detached --timeout 5000` (the pending bubble carries `testid=user-message` too, so wait for its `Sending...` to go, not only for a bubble; the wait returns `"state": "detached"` at once when the indicator has already gone, the usual case on a local stack), `control-openhands browser count 'testid=user-message >> testid=image-preview'` is `1`, and `control-openhands browser count 'testid=chat-message-sending'` and `control-openhands browser count 'testid=chat-message-retry'` are `0`. Server side, `control-openhands conversation events <image-id> --kinds MessageEvent --grep 'data:image/png;base64'` matches the one user row (`count` `1`; its `text` is a blank `" "`, the row carries `images: 1`, and the excerpt shows the `"type":"image"` block with `image_urls`), and `control-openhands conversation events <image-id> --kinds MessageEvent` (default `--last`) lists the same row with `images: 1` and no excerpt. `--kinds` filters before `--last` counts, so `--kinds MessageEvent --last 1` is that same row. Whether the model is handed the picture needs a key (blocked here: DEEPSEEK_API_KEY): with one, send the image together with `Which two colours are the bars in this image? Answer with the colour names only.` and expect `orange` and `blue` in the reply (`fixture image` draws those bars). Return with `control-openhands browser goto /conversations/<id>`.
- **Paste text (`F05.paste`).** Run `control-openhands browser type 'testid=chat-input' 'QA paste text'`, `control-openhands browser press Control+a`, `control-openhands browser press Control+c`, `control-openhands browser press Delete`, `control-openhands browser press Control+v`, then `control-openhands browser eval "document.querySelector('[data-testid=chat-input]').innerHTML"`: `QA paste text`, no markup. On a cleared field `control-openhands browser paste 'testid=chat-input' --file "$OH_VERIFY_RUN/evidence/_fixtures/qa-image.png"` attaches the image (`control-openhands browser count 'testid=interactive-chat-box >> alt=qa-image.png'` is `1`, with an `Upload as file` toggle) and `control-openhands browser paste 'testid=chat-input' --text 'QA pasted plain'` inserts plain text (`innerHTML` is `QA pasted plain`). `control-openhands browser drop-files 'testid=chat-input' "$OH_VERIFY_RUN/evidence/_fixtures/qa-note.txt" --stage over` makes `control-openhands browser text 'testid=interactive-chat-box'` start `Drop your files here`; the same command without `--stage` drops it: a `qa-note.txt` `TXT` chip appears. Remove the chip with `control-openhands browser click 'testid=interactive-chat-box >> role=button[name="Remove qa-note.txt"]'` and the image as in Attach; clear the field.
- **Dictation failure (`F05.dictation`).** Run `control-openhands browser click 'testid=chat-dictation-button' --observe '[role=status]' --observe-ms 3000`: the observed toasts include `Dictation failed. Check microphone access and your voice input settings.` and `control-openhands browser attr 'testid=chat-dictation-button' aria-label` is back to `Start dictation`. Real dictation is blocked without a microphone.
- **Switch LLM profile (`F05.llm-profile-picker`).** Run `control-openhands browser click 'testid=chat-input-llm-profile'` and `control-openhands browser text 'testid=chat-input-llm-profile-popover'`: `AVAILABLE PROFILES`, `deepseek-flash` / `deepseek/deepseek-flash`, `deepseek-pro` / `deepseek/deepseek-v4-pro`, `LLM Profiles`. Run `control-openhands browser click 'testid=chat-input-llm-profile-option-deepseek-pro'`, `control-openhands browser wait-text 'Switched to profile' --timeout 15000`, `control-openhands browser text 'testid=chat-input-llm-profile'` (`deepseek-pro`) and `control-openhands conversation status <id>` (`model` is `deepseek/deepseek-v4-pro`). Send `Reply with only: pro-ok` as in Type and send; the reply is `pro-ok`. After `control-openhands browser reload` the pill still reads `deepseek-pro`. Switch back with `control-openhands browser click 'testid=chat-input-llm-profile'` and `control-openhands browser click 'testid=chat-input-llm-profile-option-deepseek-flash'`.
@@ -96,11 +96,11 @@ Preconditions:
- Uploaded chips and thumbnails have no test ids. Their remove buttons are named `Remove <file name>` (file chip) and `Remove image` (thumbnail), and Send, Stop and Play read `Send message`, `Stop` and `Resume the agent task` (#18033); select by those names, or by text/alt.
- `browser upload` feeds the hidden input directly. To drive the real path, `+` > Add Files and Images, use `control-openhands browser upload-via 'testid=add-files-and-images-button' <file>`, which answers the native file chooser.
- The home composer has no `interactive-chat-box` wrapper: scope its chips and thumbnails with `testid=home-chat-launcher`.
-- `conversation events` rows show only a message's text, so an image-only message reads as a blank. Prove the attachment with `--grep 'data:image/png;base64'`, which searches whole events and quotes the `image` content block in `excerpts`.
+- `conversation events` rows show a message's text and its attachment count (`images: 1` for the image-only message, whose text is a blank); `--grep 'data:image/png;base64'` searches whole events and quotes the `image` content block in `excerpts`.
- The pill resolves the conversation's stamped profile before the user-level default, so profiles that share a model are told apart by name. The stamp lives in this browser's localStorage (`openhands-agent-server-conversation-metadata`), not on the server (`api GET /api/conversations/<id>` has no profile name): read it with `browser eval`, not `api GET`.
- The `Switched to profile` notes are client-side and gone after reload; assert the pill and `conversation status`.
- `/plan` messages go to a separate planner conversation; the browser stays on the parent `/conversations/<id>`, so wait on the planner id from `conversation list`.
- Only the newest goal status offers `Resume` (#18036): once a resumed goal has posted a newer status, the old `interrupted` row shows no button, also after a reload. Count `testid=goal-resume` after the resumed goal ends; while it runs the count is `0` anyway.
- Opening the context popover logs a 404 for `/api/llm/balance` on the local backend in `browser errors --app-only`; it does not break the popover.
-- `--observe` takes CSS selectors (`'[role=status]'`), not `role=` selector syntax.
+- `--observe` takes the verbs' selector syntax: `testid=` and plain CSS segments are watched by an in-page MutationObserver (`observedBy` `mutation`), while `role=`, `text=` and other engines are polled every 20 ms (`poll-20ms`), which misses a state shorter than that; prefer a `testid=` or CSS form for anything brief.
- At `narrow` (320 px) the overflow menu's Model submenu opens to the right of the menu and runs off screen: each profile row starts at x about 270 with width 210 (`browser bbox 'testid=chat-input-llm-profile-option-deepseek-flash'`, `insideViewport` `false`), so both names read `deepse…`. Pick profiles by test id: the click lands on the strip of about 50 px that stays on screen. Known issue: #18063 (filed from the follow-up noted in #18015; the submenu also runs past the bottom edge, so the LLM Profiles link cannot be clicked at `narrow`) (`F05.overflow-menu`).
diff --git a/.agents/skills/verify-openhands/references/feature-map/F06-agent-activity.md b/.agents/skills/verify-openhands/references/feature-map/F06-agent-activity.md
index cec91e7354..0de2633a5d 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F06-agent-activity.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F06-agent-activity.md
@@ -87,7 +87,7 @@ Preconditions:
- **Failed send survives leaving (`F06.failed-send-persists`).** With `/conversations/<id>` open and healthy, run `control-openhands service stop agent-server`, `control-openhands browser wait 'testid=error-message-banner' --timeout 20000`, `control-openhands browser fill 'testid=chat-input' 'Reply with only: retry-ok'` and `control-openhands browser click 'testid=submit-button' --observe '[data-testid=chat-message-sending],[data-testid=chat-message-error]' --observe-ms 8000`: `Sending...` turns into `Failed to send Retry Dismiss` and `control-openhands browser count 'testid=chat-message-retry'` is `1` (`control-openhands browser screenshot 'testid=chat-interface' --feature F06.failed-send-persists --name failed-before-leaving`). Run `control-openhands restart` and `control-openhands browser wait 'testid=error-message-banner' --state hidden --timeout 90000` (the page reconnects by itself; `testid=error-message-banner-retry` hurries it while the banner is still up): the Retry row is still there (count `1`). Leave through the sidebar and come back: `control-openhands browser click 'role=link[name="New Chat"]'`, `control-openhands browser wait 'testid=home-chat-launcher'`, `control-openhands browser click 'a[href*="/conversations/<id>"] >> nth=0' --expect-url '/conversations/<id>'`, `control-openhands browser wait 'testid=user-message'`; `control-openhands browser count 'testid=chat-message-retry'` is still `1` after the history reloaded (`control-openhands browser screenshot 'testid=chat-interface' --feature F06.failed-send-persists --name retry-after-reopen`). Send the same text again (fill `Reply with only: retry-ok`, click `testid=submit-button` with the same `--observe`): the new bubble goes `Sending...` and settles while `Failed to send Retry Dismiss` stays; `control-openhands browser count 'testid=chat-message-sending'` is `0`, `control-openhands browser count 'testid=chat-message-retry'` is `1`, and the rows of `control-openhands conversation events <id> --kinds MessageEvent --grep 'retry-ok'` whose `source` is `user` number exactly one, `Reply with only: retry-ok` (in a model-free run `count` is `1`; with a model the agent's `retry-ok` reply matches the grep too, so count the `user` rows, not `count`). Then `control-openhands browser click 'testid=chat-message-retry'` and `control-openhands browser wait 'testid=chat-message-retry' --state detached --timeout 15000`: `control-openhands browser count 'testid=chat-message-sending'` is `0` and the same `--grep` now lists exactly two `user` rows `Reply with only: retry-ok` (one per attempt, none duplicated). With a model, `control-openhands conversation wait <id> --fresh --timeout 120` before the next bullet.
- **Live chip, stop and resume (`F06.live-activity`, `F06.stop-resume`).** Run `control-openhands conversation start --prompt "Run exactly one terminal command: sleep 25 && echo qa-slept. Then reply with only its output."` (no `--wait`), `control-openhands browser wait 'testid=live-activity-chip' --timeout 30000` and `control-openhands browser text 'testid=live-activity-chip'`: first `Thinking`, then the action title (e.g. `Run sleep 25 then echo qa-slept`); `browser text 'testid=interactive-chat-box'` contains `Running`. Run `control-openhands browser click 'testid=stop-button'`: `control-openhands conversation status <id>` is `paused`, the composer reads `Stopped`, `count 'testid=play-button'` is `1` and the chip is gone. Stop interrupts the running `sleep` too: `control-openhands conversation events <id>` shows an `AgentErrorEvent` (`Tool call interrupted before completion. The conversation was paused.`) followed by an `InterruptEvent`, and `browser text 'testid=chat-scroll-container'` shows an `Agent error` row under the action title. Run `control-openhands browser click 'testid=play-button'`: status `running`, then `control-openhands conversation wait <id> --timeout 120` ends `finished` with a new agent `MessageEvent` (the model reports that the command was interrupted; `qa-slept` never prints).
- **Reload mid-run (`F06.reload-mid-run`).** Run `control-openhands conversation start --prompt "Run exactly one terminal command: sleep 15 && echo qa-reloaded. Then reply with only its output."`, wait for `testid=live-activity-chip`, then `control-openhands browser reload`. The composer still reads `Running` and the chip is back. After `control-openhands conversation wait <id> --timeout 120`: `testid=agent-message` is `qa-reloaded`, `count 'testid=user-message'` is `1`, `control-openhands browser eval "document.querySelectorAll('[data-testid=chat-scroll-container] [data-testid=generic-event-message-title]').length"` is `1`.
-- **Older history (`F06.load-older-history`).** Run `control-openhands conversation start --prompt "Run these 16 terminal commands strictly one per tool call, sequentially (never combine them): echo qa1, echo qa2, echo qa3, echo qa4, echo qa5, echo qa6, echo qa7, echo qa8, echo qa9, echo qa10, echo qa11, echo qa12, echo qa13, echo qa14, echo qa15, echo qa16. Then reply DONE." --wait --timeout 400` (note `<history-id>`); `control-openhands conversation events <history-id> --last 500` reports a count above 50. Run `control-openhands browser network --clear`, `control-openhands browser reload`, then `control-openhands browser network --last 300`: two `GET /api/conversations/<history-id>/events/search` requests (newest page, then the older page). `control-openhands browser text 'testid=chat-scroll-container'` starts with the prompt and shows `16 actions completed` and `DONE`. The other trigger is the user scrolling to the top, driven without a model on the dummy profile from Preconditions (`qa-zeta` active; in a keyed run create and activate it with that same `llm set` command for this bullet, then re-run `control-openhands llm preset deepseek` and remove it with `control-openhands api DELETE /api/profiles/qa-zeta --write`, so later families still count two profiles; arrange, not proof). Run `control-openhands conversation start --prompt "qa older 1"` (no `--wait`; note `<older-id>`), then `for N in $(seq 2 30); do control-openhands conversation send <older-id> --prompt "qa older $N"; done`: every send is accepted while the agent sits in error, about 1.3 s apiece, and each refused message adds five events (a `MessageEvent`, three `ConversationStateUpdateEvent`s, a `ConversationErrorEvent`), so the conversation ends with about 150 events (152 here). `control-openhands conversation events <older-id> --last 500` reports `"total": 100` (the CLI's one-page cap, see Gotchas) and its first row is `qa older 11`. Run `control-openhands browser network --clear`, `control-openhands browser reload`, `control-openhands browser wait 'testid=chat-input'`, then `control-openhands browser network --filter 'events/search' --last 10`: two requests, `?limit=50&sort_order=TIMESTAMP_DESC` and one with `timestamp__lt=<ts of qa older 21>`, because the newest 50 events hold only ten bubbles, shorter than the viewport, so the automatic fetch ran once and then stopped. `control-openhands browser count 'testid=user-message'` is `20`, `control-openhands browser text 'testid=chat-scroll-container'` starts `qa older 11` and holds none of `qa older 1`…`qa older 10`, and `control-openhands browser bbox 'testid=chat-scroll-container'` has `scrollHeight` `1576` against `clientHeight` `814`: taller than the viewport, so the third page waits for the user. Run `control-openhands browser scroll 'testid=chat-scroll-container' --by -100000`: `control-openhands browser network --filter 'events/search' --last 5` gains a request with `timestamp__lt=<ts of qa older 11>`, `control-openhands browser count 'testid=user-message'` is `29` and the text starts `qa older 2` (that page held messages 2–10 plus the tail of the first message's events; not seen in two runs: if the first refusal ever logs six events instead of seven, the arithmetic gives count `30`, text `qa older 1` and a last page of only the `SystemPromptEvent`), and the view stays on `qa older 11`: `control-openhands browser eval "document.querySelector('[data-testid=chat-scroll-container]').scrollTop"` is `684`, the height of the prepended rows. Scroll to the top again the same way: a fourth request (`timestamp__lt=` the oldest loaded event), the count is `30`, the text starts `qa older 1` and `scrollTop` is `76` (`control-openhands browser screenshot 'testid=chat-interface' --feature F06.load-older-history --name scroll-top-loaded-qa-older-1`). A third scroll adds no request: the short page ended the paging. `control-openhands browser count 'testid=loading-older-events'` is `0` after each scroll; the `Fetching older messages…` row lasts about 10 ms on a local stack and `browser scroll` has no `--observe`, so the `timestamp__lt=` network rows are the proof. Return to the 16-command conversation for the next bullet: `control-openhands browser goto /conversations/<history-id>` and `control-openhands browser wait 'testid=chat-input'`.
+- **Older history (`F06.load-older-history`).** Run `control-openhands conversation start --prompt "Run these 16 terminal commands strictly one per tool call, sequentially (never combine them): echo qa1, echo qa2, echo qa3, echo qa4, echo qa5, echo qa6, echo qa7, echo qa8, echo qa9, echo qa10, echo qa11, echo qa12, echo qa13, echo qa14, echo qa15, echo qa16. Then reply DONE." --wait --timeout 400` (note `<history-id>`); `control-openhands conversation events <history-id> --last 500` reports a count above 50. Run `control-openhands browser network --clear`, `control-openhands browser reload`, then `control-openhands browser network --last 300`: two `GET /api/conversations/<history-id>/events/search` requests (newest page, then the older page). `control-openhands browser text 'testid=chat-scroll-container'` starts with the prompt and shows `16 actions completed` and `DONE`. The other trigger is the user scrolling to the top, driven without a model on the dummy profile from Preconditions (`qa-zeta` active; in a keyed run create and activate it with that same `llm set` command for this bullet, then re-run `control-openhands llm preset deepseek` and remove it with `control-openhands api DELETE /api/profiles/qa-zeta --write`, so later families still count two profiles; arrange, not proof). Run `control-openhands conversation start --prompt "qa older 1"` (no `--wait`; note `<older-id>`), then `for N in $(seq 2 30); do control-openhands conversation send <older-id> --prompt "qa older $N"; done`: every send is accepted while the agent sits in error, about 1.5 s apiece (42 s for the 29 here), and each refused message adds five events (a `MessageEvent`, three `ConversationStateUpdateEvent`s, a `ConversationErrorEvent`), so the conversation ends with about 150 events (152 here). `control-openhands conversation events <older-id> --last 500` reports `"total": 152`, `"pages": 2`, `"more": false` (both server pages read, see Gotchas); its first row is the `SystemPromptEvent` and the first `MessageEvent` is `qa older 1`, while `--last 25` reports `"pages": 1`, `"more": true` and starts at `qa older 26`. Run `control-openhands browser network --clear`, `control-openhands browser reload`, `control-openhands browser wait 'testid=chat-input'`, then `control-openhands browser network --filter 'events/search' --last 10`: two requests, `?limit=50&sort_order=TIMESTAMP_DESC` and one with `timestamp__lt=<ts of qa older 21>`, because the newest 50 events hold only ten bubbles, shorter than the viewport, so the automatic fetch ran once and then stopped. `control-openhands browser count 'testid=user-message'` is `20`, `control-openhands browser text 'testid=chat-scroll-container'` starts `qa older 11` and holds none of `qa older 1`…`qa older 10`, and `control-openhands browser bbox 'testid=chat-scroll-container'` has `scrollHeight` `1576` against `clientHeight` `814`: taller than the viewport, so the third page waits for the user. Run `control-openhands browser scroll 'testid=chat-scroll-container' --by -100000`: `control-openhands browser network --filter 'events/search' --last 5` gains a request with `timestamp__lt=<ts of qa older 11>`, `control-openhands browser count 'testid=user-message'` is `29` and the text starts `qa older 2` (that page held messages 2–10 plus the tail of the first message's events; not seen in two runs: if the first refusal ever logs six events instead of seven, the arithmetic gives count `30`, text `qa older 1` and a last page of only the `SystemPromptEvent`), and the view stays on `qa older 11`: `control-openhands browser eval "document.querySelector('[data-testid=chat-scroll-container]').scrollTop"` is `684`, the height of the prepended rows. Scroll to the top again the same way: a fourth request (`timestamp__lt=` the oldest loaded event), the count is `30`, the text starts `qa older 1` and `scrollTop` is `76` (`control-openhands browser screenshot 'testid=chat-interface' --feature F06.load-older-history --name scroll-top-loaded-qa-older-1`). A third scroll adds no request: the short page ended the paging. `control-openhands browser count 'testid=loading-older-events'` is `0` after each scroll because the `Fetching older messages…` row lasts a few tens of milliseconds on a local stack; to see it, scroll with `control-openhands browser scroll 'testid=chat-scroll-container' --by -100000 --observe 'testid=loading-older-events' --observe-ms 1500` instead (both scrolls were driven this way here, with the same counts), whose `observed` goes `<absent>` at `0` ms, `Fetching older messages…` at about 20 ms and `<absent>` again within about 40 to 120 ms (`116` ms on the first scroll, `39` on the second; `observedBy` `mutation`); the `timestamp__lt=` network rows remain the durable proof. Return to the 16-command conversation for the next bullet: `control-openhands browser goto /conversations/<history-id>` and `control-openhands browser wait 'testid=chat-input'`.
- **Scroll to bottom (`F06.scroll-to-bottom`).** On the 16-command conversation (`<history-id>`; in a model-free run this bullet is blocked with the automatic-fetch half, prerequisite `DEEPSEEK_API_KEY`), `control-openhands browser click 'testid=event-group-toggle'` makes the transcript taller than the viewport while the view stays where it was. Run `control-openhands browser scroll 'testid=chat-scroll-container' --by 2000` first (the button only reacts to scroll events, so a page that is already at the top never shows it): `count 'testid=scroll-to-bottom'` is `0`. Run `control-openhands browser scroll 'testid=chat-scroll-container' --by -2000`; the count is `1`. `control-openhands browser click 'testid=scroll-to-bottom'`, then the count is `0` and `control-openhands browser eval "(()=>{const e=document.querySelector('[data-testid=chat-scroll-container]');return Math.round(e.scrollHeight-e.scrollTop-e.clientHeight)})()"` is `0`.
- **Confirmation mode on (`F06.confirmation-mode`).** Arrange through the settings UI, in this order (the Security Analyzer field appears only once Confirmation Mode is on): `control-openhands browser goto /settings/verification`, `control-openhands browser click 'testid=verification-settings-screen >> text=Confirmation Mode'`, `control-openhands browser click 'testid=sdk-section-all-toggle'`, `control-openhands browser click 'testid=verification-settings-screen >> role=button[name="Show suggestions"]'`, `control-openhands browser click 'role=listbox >> role=option[name="None"]'`, `control-openhands browser value 'testid=verification-settings-screen >> role=combobox[name="Security Analyzer"]'` (`None`), `control-openhands browser click 'testid=verification-settings-screen >> testid=save-button'`; `control-openhands api GET /api/settings` shows `"confirmation_mode": true` and `"security_analyzer": "none"` (None means every action is confirmed; the default LLM analyzer only stops HIGH-risk actions, so `echo` would run unprompted). Run `control-openhands conversation start --prompt "Run the terminal command 'echo qa-confirm-ok' and reply with its output." --wait --timeout 180`: it returns `"status": "waiting_for_confirmation"`. `control-openhands browser text 'testid=chat-scroll-container'` ends `Do you want to continue with this action? Cancel ⇧⌘⌫ Continue ⌘↩`, `control-openhands browser tooltip 'testid=action-confirm-button'` is `Confirm the requested action`, and a lock icon sits above the composer (screenshot). Run `control-openhands browser click 'testid=action-reject-button'`: status `idle`, the buttons are gone and `conversation events <id> --last 6` ends with `UserRejectObservation`. Send `Run the terminal command 'echo qa-confirm-two' and reply with its output.` through `testid=chat-input` / `testid=submit-button`, `control-openhands browser wait 'testid=action-confirm-button' --timeout 20000`, `control-openhands browser click 'testid=action-confirm-button'`; about 15 s later the status is `finished` and the events contain the observation `qa-confirm-two`. Expected after a Cancel: the rejected row is shown as resolved and the group stops spinning (currently fails, see Gotchas).
- **Confirmation shortcuts (`F06.confirmation-shortcuts`).** The previous bullet resolved its action, so arrange a new one in the same conversation: send `Run the terminal command 'echo qa-confirm-three' and reply with its output.` through `testid=chat-input` / `testid=submit-button` and `control-openhands browser wait 'testid=action-confirm-button' --timeout 20000`. While it awaits confirmation, `control-openhands browser press Control+Enter` does nothing (`control-openhands conversation status <id>` stays `waiting_for_confirmation`); see Gotchas. `control-openhands browser press Meta+Enter` continues it: `control-openhands conversation wait <id> --fresh --timeout 120` ends `finished` and `control-openhands conversation events <id> --kinds ObservationEvent` contains `qa-confirm-three`. Restore afterwards: `browser goto /settings/verification`, click `testid=sdk-section-all-toggle`, `Show suggestions`, `role=listbox >> role=option[name="LLM"]`, then `testid=verification-settings-screen >> text=Confirmation Mode`, then `save-button`; `api GET /api/settings` shows `"confirmation_mode": false`, `"security_analyzer": "llm"`.
@@ -102,8 +102,8 @@ Preconditions:
## Gotchas
-- `control-openhands conversation events <id>` returns only the last 25 events unless you pass `--last N`, and never more than the newest 100 whatever `N` is (one API page; the Agent Server rejects `limit` above 100), so on a long conversation `"total"` reads `100` and the oldest rows are missing: `--from-start` reads the oldest 100 instead, and `control-openhands api GET "/api/conversations/<id>/events/search?limit=100&sort_order=TIMESTAMP"` pages through all of them with `page_id=<next_page_id>`. Event texts are cut at about 160 characters.
-- `--observe` takes a CSS selector (`'[data-testid=chat-message-sending]'`), not the ` >> ` syntax; a `testid=` value there fails with "not a valid selector".
+- `control-openhands conversation events <id>` returns the last 25 events unless you pass `--last N`; it reads the server's 100-event pages until `N` rows are in hand (`pages` says how many it read, `more: true` that older pages remain), so `--last 500` covers a 150-event conversation in two pages (`total` `152`, `pages` `2`, `more` `false` on the Older history conversation; `--last 25` there reads one page, `more` `true`) and `--from-start` reads from the oldest. `--kinds` and `--grep` filter before `--last` counts, and pages are read until `--last` matching rows are in hand: `--kinds MessageEvent --last 3` is the three newest messages, `--kinds MessageEvent --last 500` all thirty, and `--grep 'qa older 1'` reaches `qa older 1` on the oldest page with the default `--last` (`count` `11`, `pages` `2`). Event texts are cut at about 160 characters.
+- `--observe` takes the same selector syntax as the verbs: `testid=` and plain CSS segments (joined with ` >> `) are watched by an in-page MutationObserver (`observedBy` `mutation`; the Older history bullet's `--observe 'testid=loading-older-events'` is one), while other engines (`role=`, `text=`, `nth=`) are polled every 20 ms instead (not driven in this family).
- `role=button[name="Expand"]` also matches "Expand thinking" and "Expand actions"; use `[exact]` to target tool rows. Each click flips the row to Collapse, so `nth=0` walks to the next collapsed row.
- Tool rows show no success icon; the only indicators are the `exit N` badge for non-zero exits and a clock icon (`status-icon`) for timeouts. A single action is not grouped: it renders as a bare row without `event-group`.
- The model writes the tool titles and may append to commands (it turned `ls /missing` into `ls ...; echo "EXIT:$?"`, exit 0). Ask for the command "verbatim, with nothing appended" when the exit code matters.
diff --git a/.agents/skills/verify-openhands/references/feature-map/F17-mcp-servers.md b/.agents/skills/verify-openhands/references/feature-map/F17-mcp-servers.md
index 60a9e6dff6..527526ee2b 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F17-mcp-servers.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F17-mcp-servers.md
@@ -36,9 +36,9 @@ Source: `src/routes/extensions-hub.tsx`, `src/routes/mcp.tsx`, `src/components/f
- `F17.server-health`: each card's health row runs **Test connection** (`Checking connection…`), then shows a verdict with a coloured dot; a failure is red, worded for the transport (a STDIO command that cannot start, a remote server that cannot be reached) with the Agent Server's detail, and offers **Retry**.
- `F17.enable-disable`: the card toggle disables a server without removing its configuration; the state persists and a disabled server is withheld from new conversations.
- `F17.custom-edit`: clicking a card opens **Edit MCP server** prefilled (secrets shown as `**********`); Save tests and persists the change.
-- `F17.stored-secret-reuse`: a saved server's env values and tokens come back from the settings API and in the editor as `**********`; the editor's Test connection and Save both send the stored values behind those placeholders, never the placeholder text, so a Save from the edit form that keeps them changes only the edited fields.
+- `F17.stored-secret-reuse`: a saved server's env values and tokens come back from the settings API and in the editor as `**********`; the editor's Test connection swaps each placeholder for the stored encrypted value (never the placeholder text, never the plaintext) and Save leaves untouched secrets out of its sparse patch, so a Save from the edit form that keeps them changes only the edited fields.
- `F17.single-request-mutations`: adding, editing or deleting one server sends exactly one `POST`, `PATCH` or `DELETE` to `/api/settings/mcp/<name>` and leaves sibling servers and their stored credentials untouched.
-- `F17.credential-probe`: a catalog entry whose server lists its tools with any credentials (Slack) also gets a read-only credential probe during Install and Test connection: a failed probe reads `Credential check failed: <provider error>` and saves nothing. A hosted server that rejects the token at connect (GitHub) never reaches a probe and reads `Connection failed: … 401 Unauthorized …`, also saving nothing; a server the catalog does not know gets no probe.
+- `F17.credential-probe`: a catalog entry whose server lists its tools with any credentials (Slack) also gets a read-only credential probe during Install and Test connection: a failed probe reads `Credential check failed: <provider error>` and saves nothing (Known failure, reproduced 2026-10-08: any errored probe call, a network `fetch failed` included, is worded as a credential failure; #18161). A hosted server that rejects the token at connect (GitHub) never reaches a probe and reads `Connection failed: … 401 Unauthorized …`, also saving nothing (Known failure, reproduced 2026-10-08: the Agent Server's `POST /api/mcp/test` returns the 401 as `error_kind` `unknown`, so the modal cannot call it a credential failure; OpenHands/software-agent-sdk#5607); a server the catalog does not know gets no probe.
- `F17.delete-server`: **Delete** in the editor asks for confirmation; Cancel keeps the server, Confirm removes it with `MCP server removed.`
- `F17.native-git-tabs`: on a Cloud backend, GitHub/GitLab/Bitbucket offer a recommended native-integration tab next to the MCP tab (blocked here).
- `F17.agent-uses-server`: a conversation started after the save can call the server's tools.
@@ -88,7 +88,7 @@ Preconditions:
- **Card health (`F17.server-health`).** Run `control-openhands browser click 'testid=mcp-health-probe-qa_time' --observe 'testid=mcp-health-label-qa_time' --observe-ms 20000`: `Not checked yet`, `Checking connection…`, `Reachable — credentials not verified`. `control-openhands browser text 'testid=mcp-server-health-qa_time'` adds the hint `This check only proves the server is reachable and lists its tools; it does not verify your credentials.`, `control-openhands browser attr 'testid=mcp-server-health-qa_time >> testid=mcp-health-dot' data-status` is `healthy-connectivity`, and the click did not open the editor (`browser count 'testid=mcp-custom-editor'` is `0`). Failure: the editor refuses to save a broken server, so arrange one with `control-openhands api POST /api/settings/mcp/qa_broken --data '{"transport":"stdio","command":"qa-no-such-command","enabled":false}' --write`, `control-openhands browser reload`, then click `testid=mcp-health-probe-qa_broken`: the label is `Could not start the server command: Client failed to connect: [Errno 2] No such file or directory: 'qa-no-such-command'` in red (STDIO wording, no URL hint; the card clamps it to two lines, `browser text 'testid=mcp-server-health-qa_broken'` reads it whole), the dot's `data-status` is `failed` and the button reads `Retry`; `control-openhands browser screenshot 'testid=mcp-server-item >> has-text=qa_broken' --feature F17.server-health --name failed`.
- **Delete (`F17.delete-server`).** Run `control-openhands browser click 'testid=mcp-server-detail-qa_broken'` (a click on the card's centre lands on its health row and opens nothing: see Gotchas), `control-openhands browser click 'testid=mcp-custom-editor-delete'` and `control-openhands browser text 'testid=confirmation-modal'` (`Are you sure you want to delete this server?`, `Cancel`, `Confirm`). Run `control-openhands browser click 'testid=confirmation-modal >> testid=cancel-button'`; the editor is still open. Click Delete again, then `control-openhands browser click 'testid=confirmation-modal >> testid=confirm-button'` and `control-openhands browser toasts` (`MCP server removed.`). After `control-openhands browser reload`, `control-openhands browser count 'testid=mcp-server-item >> has-text=qa_broken'` is `0`, and `control-openhands api GET /api/settings` has no `qa_broken`.
- **Edit (`F17.custom-edit`).** Run `control-openhands browser click 'testid=mcp-server-detail-qa_time'` (the detail line opens the editor on every card; a plain click on the card's centre happens to open it on `qa_time`, whose Time description fills the centre, but not on a card without a description; keyboard: `browser focus '[data-server-id=qa_time]'` then `browser press Enter`) and `control-openhands browser snapshot 'testid=mcp-custom-editor'`: heading `Edit MCP server`, no Server Type field, a `Delete` button; `control-openhands browser value 'testid=edit-mcp-server-form >> testid=env-input'` is `UV_NATIVE_TLS=**********`. Run `control-openhands browser fill 'testid=edit-mcp-server-form >> testid=args-input' $'mcp-server-time\n--local-timezone\nUTC'` (bash ANSI-C quoting for the newlines), click `testid=edit-mcp-server-form >> testid=mcp-test-connection` (still `Connected — 2 tool(s) available`: the stored env value is reused), then `control-openhands browser click 'testid=edit-mcp-server-form >> testid=submit-button'` and wait for `testid=mcp-custom-editor` to detach. The card shows a verdict at once (seeded from the save's test). After `control-openhands browser reload`, `control-openhands browser text 'testid=mcp-server-detail-qa_time'` is `uvx mcp-server-time --local-timezone UTC`.
-- **Stored secrets are reused, not their placeholder (`F17.stored-secret-reuse`).** Make a STDIO server that only starts with the right secret: `control-openhands fixture mcp-server --name qa-vault` prints `<node>` and `<server.mjs>`. Run `control-openhands browser click 'testid=mcp-add-custom-server'`, pick `STDIO`, fill `testid=add-mcp-server-form >> testid=name-input` `qa_vault` and `testid=add-mcp-server-form >> testid=command-input` `/bin/sh`, then `control-openhands browser fill 'testid=add-mcp-server-form >> testid=args-input' $'-c\ntest "$QA_VAULT_TOKEN" = qa-vault-secret-000 && exec "$QA_NODE" "$QA_SERVER"'` and `control-openhands browser fill 'testid=add-mcp-server-form >> testid=env-input' $'QA_VAULT_TOKEN=qa-vault-secret-000\nQA_NODE=<node>\nQA_SERVER=<server.mjs>'`. Click `testid=add-mcp-server-form >> testid=mcp-test-connection`; `control-openhands browser text 'testid=add-mcp-server-form >> testid=mcp-test-message' --timeout 60000` is `Connected — 1 tool(s) available`. Click `testid=add-mcp-server-form >> testid=submit-button`, `control-openhands browser wait 'testid=mcp-custom-editor' --state detached --timeout 60000` and `control-openhands browser reload`. `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_vault` has `env` `{"QA_VAULT_TOKEN":"**********","QA_NODE":"**********","QA_SERVER":"**********"}` (every env value is redacted; the page reads this same endpoint, there is no `GET /api/settings/mcp`). Run `control-openhands browser click 'testid=mcp-server-detail-qa_vault'`; `control-openhands browser value 'testid=edit-mcp-server-form >> testid=env-input'` is the three lines `QA_VAULT_TOKEN=**********`, `QA_NODE=**********`, `QA_SERVER=**********`. Click `testid=edit-mcp-server-form >> testid=mcp-test-connection`: `control-openhands browser text 'testid=edit-mcp-server-form >> testid=mcp-test-message' --timeout 60000` is `Connected — 1 tool(s) available`, which the shell gate only allows when the stored token, binary and path were sent (`control-openhands browser screenshot 'testid=mcp-custom-editor' --feature F17.stored-secret-reuse --name masked-test-ok`). Counter-check that the gate bites: `control-openhands browser fill 'testid=edit-mcp-server-form >> testid=env-input' $'QA_VAULT_TOKEN=qa-wrong\nQA_NODE=**********\nQA_SERVER=**********'`, click Test connection again and `control-openhands browser wait 'testid=edit-mcp-server-form >> testid=mcp-test-message >> text=Connection' --timeout 90000`; the text is red and reads `Connection failed: McpError: Connection closed` or, when the client only notices at its deadline, `Connection timed out. Check the URL and try again.` (the gate exits before the MCP handshake; see Gotchas; `--name wrong-token`). `control-openhands browser click 'testid=mcp-custom-editor-close'` discards it (`count 'testid=mcp-custom-editor'` `0`); reopen with `testid=mcp-server-detail-qa_vault`: the env is the three placeholders again and Test connection is `Connected — 1 tool(s) available`. `control-openhands browser press Escape`. Save with the placeholders in place: reopen with `control-openhands browser click 'testid=mcp-server-detail-qa_vault'`, append one harmless argument (it only becomes the shell script's `$0`) with `control-openhands browser fill 'testid=edit-mcp-server-form >> testid=args-input' $'-c\ntest "$QA_VAULT_TOKEN" = qa-vault-secret-000 && exec "$QA_NODE" "$QA_SERVER"\nqa-v2'`, leave `env-input` as the three placeholders, run `control-openhands browser network --clear`, then `control-openhands browser click 'testid=edit-mcp-server-form >> testid=submit-button' --observe 'testid=edit-mcp-server-form >> testid=submit-button' --observe-ms 6000` (`Save Server`, `Save Server [disabled]`, `<absent>`) and `control-openhands browser wait 'testid=mcp-custom-editor' --state detached --timeout 60000`; `control-openhands browser network --filter '/api/settings/mcp'` lists one `PATCH /api/settings/mcp/qa_vault` (`200`) and the card's health label reads `Reachable — credentials not verified`. After `control-openhands browser reload`, `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_vault.env` is still `{"QA_VAULT_TOKEN":"**********","QA_NODE":"**********","QA_SERVER":"**********"}`, `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_vault.args` ends with `qa-v2`, and `control-openhands browser text 'testid=mcp-server-detail-qa_vault'` ends with `"$QA_SERVER" qa-v2`. Reopen with `control-openhands browser click 'testid=mcp-server-detail-qa_vault'` (the env is the three placeholders) and click `testid=edit-mcp-server-form >> testid=mcp-test-connection`: `control-openhands browser text 'testid=edit-mcp-server-form >> testid=mcp-test-message' --timeout 60000` is `Connected — 1 tool(s) available` again, which the gate only allows if the Save kept the real token, binary and path rather than storing the placeholder text (`--name saved-with-placeholders`). `control-openhands browser press Escape`.
+- **Stored secrets are reused, not their placeholder (`F17.stored-secret-reuse`).** Make a STDIO server that only starts with the right secret: `control-openhands fixture mcp-server --name qa-vault` prints `<node>` and `<server.mjs>`. Run `control-openhands browser click 'testid=mcp-add-custom-server'`, pick `STDIO`, fill `testid=add-mcp-server-form >> testid=name-input` `qa_vault` and `testid=add-mcp-server-form >> testid=command-input` `/bin/sh`, then `control-openhands browser fill 'testid=add-mcp-server-form >> testid=args-input' $'-c\ntest "$QA_VAULT_TOKEN" = qa-vault-secret-000 && exec "$QA_NODE" "$QA_SERVER"'` and `control-openhands browser fill 'testid=add-mcp-server-form >> testid=env-input' $'QA_VAULT_TOKEN=qa-vault-secret-000\nQA_NODE=<node>\nQA_SERVER=<server.mjs>'`. Run `control-openhands browser network --clear`, click `testid=add-mcp-server-form >> testid=mcp-test-connection`; `control-openhands browser text 'testid=add-mcp-server-form >> testid=mcp-test-message' --timeout 60000` is `Connected — 1 tool(s) available`. Direct proof of what the page sent: `control-openhands browser network --bodies --filter 'api/mcp/test' --last 1` lists one `POST /api/mcp/test` (`200`) whose `body` is `{"server":{"type":"stdio","command":"/bin/sh","args":["-c","test \"$QA_VAULT_TOKEN\" = qa-vault-secret-000 && exec \"$QA_NODE\" \"$QA_SERVER\""],"env":{"QA_VAULT_TOKEN":"<redacted 19 chars>","QA_NODE":"<redacted 40 chars>","QA_SERVER":"<redacted 142 chars>"}},"name":"qa_vault"}`: the command and args in clear, each env value replaced by the CLI with the length of the real value (19 for `qa-vault-secret-000`; 40 and 142 are `<node>` and `<server.mjs>` on this machine, `${#var}` in a shell). Click `testid=add-mcp-server-form >> testid=submit-button`, `control-openhands browser wait 'testid=mcp-custom-editor' --state detached --timeout 60000` and `control-openhands browser reload`. `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_vault` has `env` `{"QA_VAULT_TOKEN":"**********","QA_NODE":"**********","QA_SERVER":"**********"}` (every env value is redacted; the page reads this same endpoint, there is no `GET /api/settings/mcp`). Run `control-openhands browser click 'testid=mcp-server-detail-qa_vault'`; `control-openhands browser value 'testid=edit-mcp-server-form >> testid=env-input'` is the three lines `QA_VAULT_TOKEN=**********`, `QA_NODE=**********`, `QA_SERVER=**********`. Run `control-openhands browser network --clear` and click `testid=edit-mcp-server-form >> testid=mcp-test-connection`: `control-openhands browser text 'testid=edit-mcp-server-form >> testid=mcp-test-message' --timeout 60000` is `Connected — 1 tool(s) available`, which the shell gate only allows when the stored token, binary and path were sent (`control-openhands browser screenshot 'testid=mcp-custom-editor' --feature F17.stored-secret-reuse --name masked-test-ok`). The same `control-openhands browser network --bodies --filter 'api/mcp/test' --last 1` row now carries `"env":{"QA_VAULT_TOKEN":"<redacted 120 chars>","QA_NODE":"<redacted 140 chars>","QA_SERVER":"<redacted 268 chars>"}`: neither the `**********` placeholder (which `--bodies` would keep as is) nor the typed lengths. `control-openhands browser network --last 5` shows why: a `GET /api/settings` (and `/server_info`) right before the POST. The page fetches the settings in `encrypted` mode and swaps each placeholder for the stored *encrypted* value (`src/api/mcp-service/mcp-redacted-credentials.ts`), which the Agent Server decrypts, so the browser never holds the plaintext and the lengths are those of Fernet tokens of the real values (19 → 120, 40 → 140, 142 → 268). Counter-check that the gate bites: `control-openhands browser fill 'testid=edit-mcp-server-form >> testid=env-input' $'QA_VAULT_TOKEN=qa-wrong\nQA_NODE=**********\nQA_SERVER=**********'`, `control-openhands browser network --clear`, click Test connection again and `control-openhands browser wait 'testid=edit-mcp-server-form >> testid=mcp-test-message >> text=Connection' --timeout 90000`; the text is red and reads `Connection failed: McpError: Connection closed` or, when the client only notices at its deadline, `Connection timed out. Check the URL and try again.` (the gate exits before the MCP handshake; see Gotchas; `--name wrong-token`), and the `--bodies` row shows `"QA_VAULT_TOKEN":"<redacted 8 chars>"` next to the two kept placeholders at `140` and `268` chars: only the retyped value replaced its stored one. `control-openhands browser click 'testid=mcp-custom-editor-close'` discards it (`count 'testid=mcp-custom-editor'` `0`); reopen with `testid=mcp-server-detail-qa_vault`: the env is the three placeholders again and Test connection is `Connected — 1 tool(s) available`. `control-openhands browser press Escape`. Save with the placeholders in place: reopen with `control-openhands browser click 'testid=mcp-server-detail-qa_vault'`, append one harmless argument (it only becomes the shell script's `$0`) with `control-openhands browser fill 'testid=edit-mcp-server-form >> testid=args-input' $'-c\ntest "$QA_VAULT_TOKEN" = qa-vault-secret-000 && exec "$QA_NODE" "$QA_SERVER"\nqa-v2'`, leave `env-input` as the three placeholders, run `control-openhands browser network --clear`, then `control-openhands browser click 'testid=edit-mcp-server-form >> testid=submit-button' --observe 'testid=edit-mcp-server-form >> testid=submit-button' --observe-ms 6000` (`Save Server`, `Save Server [disabled]`, `<absent>`) and `control-openhands browser wait 'testid=mcp-custom-editor' --state detached --timeout 60000`; `control-openhands browser network --bodies --filter 'api/settings/mcp' --last 3` lists one `PATCH /api/settings/mcp/qa_vault` (`200`) whose `body` is `{"transport":"stdio","command":"/bin/sh","args":["-c","test \"$QA_VAULT_TOKEN\" = qa-vault-secret-000 && exec \"$QA_NODE\" \"$QA_SERVER\"","qa-v2"]}`: a sparse patch with no `env` key at all (untouched secrets are left out, so the server keeps its stored values; neither the placeholder nor an encrypted value travels). The same `control-openhands browser network --filter 'api/settings/mcp' --last 3` without `--bodies` lists that row without a `body` field. The card's health label reads `Reachable — credentials not verified`. After `control-openhands browser reload`, `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_vault.env` is still `{"QA_VAULT_TOKEN":"**********","QA_NODE":"**********","QA_SERVER":"**********"}`, `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_vault.args` ends with `qa-v2`, and `control-openhands browser text 'testid=mcp-server-detail-qa_vault'` ends with `"$QA_SERVER" qa-v2`. Reopen with `control-openhands browser click 'testid=mcp-server-detail-qa_vault'` (the env is the three placeholders), run `control-openhands browser network --clear` and click `testid=edit-mcp-server-form >> testid=mcp-test-connection`: `control-openhands browser text 'testid=edit-mcp-server-form >> testid=mcp-test-message' --timeout 60000` is `Connected — 1 tool(s) available` again, which the gate only allows if the Save kept the real token, binary and path rather than storing the placeholder text (`--name saved-with-placeholders`), and the `--bodies` row carries `qa-v2` in `args` with the three encrypted lengths (`120`, `140`, `268`) in `env`. `control-openhands browser press Escape`.
- **One request per mutation (`F17.single-request-mutations`).** With `qa_vault` as the sibling, run `control-openhands browser network --clear`, `control-openhands browser click 'testid=mcp-add-custom-server'`, pick `STDIO`, fill `testid=add-mcp-server-form >> testid=name-input` `qa_docs`, `testid=add-mcp-server-form >> testid=command-input` `<node>` and `testid=add-mcp-server-form >> testid=args-input` `<server.mjs>`, click `testid=add-mcp-server-form >> testid=submit-button` and `control-openhands browser wait 'testid=mcp-custom-editor' --state detached --timeout 60000`. `control-openhands browser network --filter '/api/settings/mcp'` has `total` `1`, a `POST /api/settings/mcp/qa_docs` with status `201`, and `control-openhands browser network --filter qa_vault` has `total` `0`. Edit: `control-openhands browser network --clear`, `control-openhands browser click 'testid=mcp-server-detail-qa_docs'`, `control-openhands browser fill 'testid=edit-mcp-server-form >> testid=args-input' $'<server.mjs>\n--qa-v2'`, click `testid=edit-mcp-server-form >> testid=submit-button` and the same `wait`; the filter now lists one `PATCH /api/settings/mcp/qa_docs` (`200`) and `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_docs.args` ends with `--qa-v2`. Delete: `control-openhands browser network --clear`, `control-openhands browser click 'testid=mcp-server-detail-qa_docs'`, `control-openhands browser click 'testid=mcp-custom-editor-delete'`, `control-openhands browser click 'testid=confirmation-modal >> testid=confirm-button'` and `control-openhands browser wait '[data-server-id=qa_docs]' --state detached --timeout 10000`; the filter lists one `DELETE /api/settings/mcp/qa_docs` (`200`). Sibling: `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_vault` is unchanged from the end of the previous bullet (command `/bin/sh`, args still ending with `qa-v2`, the three `**********` env values, `enabled` `true`), and after `control-openhands browser click 'testid=mcp-server-detail-qa_vault'` its Test connection still reads `Connected — 1 tool(s) available`: the stored secrets survived the sibling's writes. `control-openhands browser press Escape`.
- **Credential probe (`F17.credential-probe`).** GitHub (hosted): run `control-openhands browser click 'testid=mcp-marketplace-card-github'`, `control-openhands browser fill 'testid=mcp-install-modal >> testid=mcp-install-field-api_key' ghp_qaInvalid000`, `control-openhands browser network --clear`, then `control-openhands browser click 'testid=mcp-install-modal >> testid=mcp-install-submit' --observe 'testid=mcp-install-modal >> testid=mcp-install-submit' --observe-ms 20000` (`Install`, `Verifying…`, `Install`) and `control-openhands browser text 'testid=mcp-install-modal-error'`. The server refuses the token before any tool is listed, so the probe never runs and the text is `Connection failed: HTTPStatusError: Client error '401 Unauthorized' for url 'https://api.githubcopilot.com/mcp/' …`; the modal stays open (`control-openhands browser count 'testid=mcp-install-modal'` is `1`), `control-openhands browser network --filter 'api/(mcp|settings)'` shows one `POST /api/mcp/test` and no `/api/settings/mcp` write, `control-openhands api GET /api/settings --pick agent_settings.mcp_config.github` has no value and `control-openhands api GET /api/settings/secrets` lists no `GITHUB_PERSONAL_ACCESS_TOKEN` (`control-openhands browser screenshot 'testid=mcp-install-modal' --feature F17.credential-probe --name github-invalid`); `control-openhands browser click 'testid=mcp-install-cancel'`. Slack (stdio; it lists 8 tools with any token, so only the probe, a channel listing, can tell a bad token): `control-openhands browser click 'testid=mcp-marketplace-card-slack'`, `control-openhands browser fill 'testid=mcp-install-modal >> testid=mcp-install-field-SLACK_TEAM_ID' T_QA_INVALID`, `control-openhands browser fill 'testid=mcp-install-modal >> testid=mcp-install-field-SLACK_BOT_TOKEN' xoxb-qa-invalid-000` (`type` `password`), `control-openhands browser click 'testid=mcp-install-modal >> testid=mcp-install-submit'` and `control-openhands browser wait 'testid=mcp-install-modal-error' --timeout 150000` (the first run downloads the package through npx, about a minute: a plain click, then one long `wait`, rather than `--observe-ms`, which records a few transient states). `control-openhands browser text 'testid=mcp-install-modal-error'` is `Credential check failed: invalid_auth` with direct internet; behind the TLS-intercepting proxy the probe's own HTTPS call fails first and it reads `Credential check failed: fetch failed`. Either way the modal stays open and `control-openhands api GET /api/settings --pick agent_settings.mcp_config.slack` has no value (`--name slack-invalid`); `control-openhands browser click 'testid=mcp-install-cancel'`. For Slack's own verdict behind the proxy, run the same command as a custom server, which keeps the entry's probe (#18034): `control-openhands browser click 'testid=mcp-add-custom-server'`, pick `STDIO`, fill `testid=add-mcp-server-form >> testid=name-input` `qa_slack`, `testid=add-mcp-server-form >> testid=command-input` `npx`, `control-openhands browser fill 'testid=add-mcp-server-form >> testid=args-input' $'-y\n@zencoderai/slack-mcp-server'` and `control-openhands browser fill 'testid=add-mcp-server-form >> testid=env-input' $'SLACK_TEAM_ID=T_QA_INVALID\nSLACK_BOT_TOKEN=xoxb-qa-invalid-000\nNODE_EXTRA_CA_CERTS=/root/.ccr/ca-bundle.crt'` (your proxy's CA bundle), then `control-openhands browser click 'testid=add-mcp-server-form >> testid=mcp-test-connection'` and `control-openhands browser text 'testid=add-mcp-server-form >> testid=mcp-test-message' --timeout 90000`: `Credential check failed: invalid_auth`, class `text-red-500` (`control-openhands browser screenshot 'testid=mcp-custom-editor' --feature F17.credential-probe --name slack-custom-invalid-auth`). `control-openhands browser click 'testid=add-mcp-server-form >> testid=submit-button' --observe 'testid=add-mcp-server-form >> testid=submit-button' --observe-ms 20000` (`Add Server`, `Add Server [disabled]`, `Add Server`: Save tests first) keeps the editor open (`control-openhands browser count 'testid=mcp-custom-editor'` is `1`) with the same red message, and `control-openhands api GET /api/settings --pick agent_settings.mcp_config.qa_slack` has no value; close it with `control-openhands browser click 'testid=mcp-custom-editor-close'` (an Escape pressed while the Save's test still runs is ignored). A server the catalog does not know gets no probe: `control-openhands browser click 'testid=mcp-health-probe-qa_vault' --observe 'testid=mcp-health-label-qa_vault' --observe-ms 20000` ends on `Reachable — credentials not verified` (the Card health wording).
- **The agent uses it (`F17.agent-uses-server`).** With `qa_time` enabled run `control-openhands conversation start --prompt "Use the qa_time MCP server's get_current_time tool with timezone UTC. Do not use the terminal. Reply with only the tool's datetime value." --wait --timeout 240`, then `control-openhands conversation events <id> --kinds ActionEvent,ObservationEvent,MessageEvent` with the `id` it printed. There is an `ActionEvent` with tool `qa_time_get_current_time` (MCP tools reach the agent as `<server id>_<tool>`), its observation reads `[Tool 'qa_time_get_current_time' executed.] { "timezone": "UTC", "datetime": … }`, and the agent's reply is that `datetime`. `control-openhands conversation events <id> --grep qa_time_get_current_time --from-start` also matches the `SystemPromptEvent` (the tool was offered). `control-openhands browser screenshot --feature F17.agent-uses-server --name conversation` shows the tool step (its title is model-written, e.g. `Get current time in UTC via qa_time MCP`) and the datetime reply. `conversation start` leaves the browser on the conversation: `control-openhands browser goto /mcp` next.
@@ -116,8 +116,9 @@ Preconditions:
- Catalog installs are add-only: a second Time install becomes `time_1`. Since #18034 (closed #17930) STDIO servers match the catalog by command plus leading args instead of by name, so `time_1` and a custom server that runs a catalog command under its own name (`qa_time`) keep that entry's description, badge and search keywords, while a server that only borrows a catalog name does not (a STDIO `fetch` running `qa-no-such-command` shows only its command) (`F17.install-stdio`, `F17.custom-add`). Twelve library entries (provider-OAuth-only, such as Sentry, HubSpot or the Cloudflare OAuth servers) open an empty modal whose Install does nothing (`F17.install-unsupported`) (#17922).
- The section filter's trigger and menu are named `Filter MCP servers` since #18035 (closed #17939); a checkout without it reuses the conversation filter's `Filter conversations`. The test ids work on both.
- A malformed header line in the custom editor shows `Environment variables must follow KEY=value format` (`mcp-server-form.tsx` runs headers through `validateEnvFormat`) (#17958); see `F17.custom-validation`.
-- A catalog stdio server runs with the Agent Server's minimal environment: behind a TLS-intercepting proxy its own HTTPS calls fail (`fetch failed`) even when npx could download it, and the install modal has no field for `NODE_EXTRA_CA_CERTS`; use the custom editor with the same command to see the provider's real answer (`F17.credential-probe`).
-- GitHub's hosted MCP endpoint answers an invalid token with HTTP 401 at connect, before tools are listed, so its `get_me` probe never runs and the modal shows the connection wording (`Connection failed: HTTPStatusError … 401 Unauthorized`), not `Credential check failed`.
-- The shell-gated `qa_vault` fixture exits before the MCP handshake, which the Agent Server reports either at once as `Connection failed: McpError: Connection closed` or only at its deadline as `Connection timed out. Check the URL and try again.` (both seen on one stack); neither is the `Could not start the server command` wording, which needs a command that cannot be spawned at all. Wait on `text=Connection`, which matches both and not `Connected — …`.
+- A catalog stdio server runs with the Agent Server's minimal environment: behind a TLS-intercepting proxy its own HTTPS calls fail (`fetch failed`) even when npx could download it, and the install modal has no field for `NODE_EXTRA_CA_CERTS`; use the custom editor with the same command to see the provider's real answer (`F17.credential-probe`). The `Credential check failed: fetch failed` wording itself is #18161: the Slack interpreter turns any `is_error` tool result into a credential failure, though the server connected and listed its tools.
+- GitHub's hosted MCP endpoint answers an invalid token with HTTP 401 at connect, before tools are listed, so its `get_me` probe never runs and the modal shows the connection wording (`Connection failed: HTTPStatusError … 401 Unauthorized`), not `Credential check failed`; filed as OpenHands/software-agent-sdk#5607, since the test endpoint reports the 401 as `error_kind` `unknown`.
+- The shell-gated `qa_vault` fixture exits before the MCP handshake, which the Agent Server reports either at once as `Connection failed: McpError: Connection closed` or only at its deadline as `Connection timed out. Check the URL and try again.` (the timed-out wording was seen once on 2026-10-07; on 2026-10-08 all 21 tries answered `Connection closed` within 0.4 s); neither is the `Could not start the server command` wording, which needs a command that cannot be spawned at all. Wait on `text=Connection`, which matches both and not `Connected — …`.
+- `browser network --bodies` shows what the page sent, never a secret: a value under a key that names a credential (key, token, secret, auth, pass, session, sig, credential) and every value of an `env` or `headers` map becomes `<redacted N chars>` (N the real length), and a URL in any other string (a server's `url`) keeps its host and path but loses its userinfo and the values of its secret-named query parameters (`https://<redacted 2 chars>:<redacted 8 chars>@host/mcp?api_key=<redacted 17 chars>`), while the settings API's `**********` placeholder is kept as is, so a row tells "placeholder sent" from "a value sent". The MCP editor sends neither for an untouched secret: Test connection swaps the placeholder for the stored encrypted value (a `GET /api/settings` in `encrypted` mode first; Fernet tokens, so 120 chars for a 19-char token, 140 for 40, 268 for 142) and Save leaves `env` out of its sparse PATCH altogether (`F17.stored-secret-reuse`). Without `--bodies` no row carries a `body` field, and only app-origin writes keep one.
- A browser verb's client call waits 120 s, or 10 s longer than the verb's own `--timeout` or `--observe-ms` when that is longer, so `browser wait 'testid=mcp-install-modal-error' --timeout 150000` runs its full deadline and a miss ends with Playwright's timeout and a failure screenshot (before this, every call was aborted at 120 s with `TimeoutError: The operation was aborted due to timeout` while the page kept going). For a first Slack install use a plain click, then that `wait`; `--observe-ms` is for a few transient states, not a minute-long outcome.
- Known issue #17941: turning off an enabled card toggle can drop the click when the pointer moves in and presses at once (`F17.enable-disable`).
diff --git a/.agents/skills/verify-openhands/references/feature-map/F18-skills.md b/.agents/skills/verify-openhands/references/feature-map/F18-skills.md
index effe59b4c5..73feed0d4a 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F18-skills.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F18-skills.md
@@ -53,7 +53,7 @@ Preconditions:
- A fresh run lists only the bundled catalog, `<N>` skills, all with source `public`. `<N>` is the catalog length the checkout bundles: run `node --input-type=module -e "import {SKILLS_CATALOG} from '@openhands/extensions/skills'; console.log(SKILLS_CATALOG.length)"` in the checkout (68 with `@openhands/extensions` 0.29.0, #17998). The Source and Type facet groups stay hidden until a personal/project skill exists. `add-javadoc` and `flarglebargle` are off; `docker` is on (recommended).
- `F18.skill-in-chat`, `F18.toggle-local`, `F18.copy-source` and `F18.install-banner` need an active LLM profile (`control-openhands llm preset deepseek`). `F18.install-banner` also needs the agent to reach github.com.
- Personal skill fixture (arranged through the agent, not proof): run `control-openhands conversation start --prompt 'Use one shell command to create the file ~/.agents/skills/qa-hello/SKILL.md (create the folders) with exactly these 7 lines: "---", "name: qa-hello", "description: QA test skill that answers qa-ping with QA-PONG-7731.", "triggers:", "- qa-ping", "---", "When the user says qa-ping, reply with exactly QA-PONG-7731 and nothing else." Then reply done.' --wait --timeout 240`. Afterwards `/skills` shows `<N+1> result(s)` and a `qa-hello` card (type pill `Auto-discovery`), and the Enabled facet count goes from 12 to 13.
-- Project skill fixture for `F18.project-skill` (arranged, not proof; no model needed), in this family's own repo so the commit never lands in F08's `qa-repo`: `control-openhands fixture git-repo --name qa-f18-repo`, `control-openhands fixture skill --repo qa-f18-repo --name qa-f18-skill --trigger qa-f18-ping`, then commit it with an arrange step outside the UI, `git -C "$OH_VERIFY_RUN/workspace/qa-f18-repo" add -A && git -C "$OH_VERIFY_RUN/workspace/qa-f18-repo" -c user.name=qa -c [email protected] commit -q -m "Add qa-f18-skill"`: `fixture skill` writes the file but does not commit it, and a New Worktree checkout holds only committed files. A fixture skill's name must not be a substring of its trigger (see Gotchas).
+- Project skill fixture for `F18.project-skill` (arranged, not proof; no model needed), in this family's own repo so the commit never lands in F08's `qa-repo`: `control-openhands fixture git-repo --name qa-f18-repo`, then `control-openhands fixture skill --repo qa-f18-repo --name qa-f18-skill --trigger qa-f18-ping --commit`: it writes `<run>/workspace/qa-f18-repo/.agents/skills/qa-f18-skill/SKILL.md` (`scope` `project`) and commits it in the fixture repo (`committed.sha` and `committed.message` `Add qa-f18-skill skill`; `git -C "$OH_VERIFY_RUN/workspace/qa-f18-repo" log --oneline` lists `Add qa-f18-skill skill` above `Initial fixture commit`). A re-run reports the same `committed.sha` with `committed.unchanged` `true`. Without `--commit` the file stays uncommitted, and a New Worktree checkout holds only committed files. A fixture skill's name must not be a substring of its trigger (see Gotchas).
- `F18.skill-deleted` creates its own personal fixture right before its bullet (`control-openhands fixture skill --name qa-gone --trigger qa-farewell`, written into the run's private HOME) and deletes it inside the bullet, so the counts in the other bullets are unaffected.
- `F18.cloud-link` needs an OpenHands Cloud backend and account (blocked in a sandbox).
@@ -70,7 +70,7 @@ Preconditions:
- **Toggle a built-in skill (`F18.toggle`).** Run `control-openhands browser attr 'testid=skill-toggle-add-javadoc' aria-checked` (`false`; `aria-label` is `Enable skill`), `control-openhands browser click 'testid=skill-toggle-add-javadoc'` (no modal opens; `aria-checked` turns `true` and the Enabled facet count goes up by one), wait a second, `control-openhands browser reload` and read `aria-checked` again: `true`. `control-openhands api GET /api/settings --pick misc_settings.app_preferences.enabled_skills` lists `add-javadoc` (`--pick` paths start inside `body`). To switch an enabled skill off from its card, `control-openhands browser hover 'testid=skill-toggle-add-javadoc'` first (`attr ... data-showing-remove` is `true`), then click (see Gotchas).
- **Toggle a personal skill (`F18.toggle-local`).** Run `control-openhands browser hover 'testid=skill-toggle-qa-hello'`, `control-openhands browser click 'testid=skill-toggle-qa-hello'`, wait a second, `control-openhands browser reload` and `control-openhands browser attr 'testid=skill-toggle-qa-hello' aria-checked` (`false`). `control-openhands api GET /api/settings` shows `disabled_skills: ["qa-hello"]` under `body.misc_settings.app_preferences` and `enabled_skills` without it. `control-openhands conversation start --prompt "qa-ping" --wait --timeout 240`, then `control-openhands api GET '/api/conversations/<id>/events/search?limit=5' --max-bytes 2000000` (id from `conversation start`): the user `MessageEvent` has `"activated_skills": []`. Back on `/skills` (`control-openhands browser goto /skills`; `conversation start` left the browser on the conversation), click the toggle on again (no hover needed), start another `qa-ping` conversation: `"activated_skills": ["qa-hello"]` and `control-openhands browser text 'testid=agent-message >> nth=-1'` is `QA-PONG-7731`; `disabled_skills` is `[]` again.
- **Skill reaches chat (`F18.skill-in-chat`).** Run `control-openhands browser goto /skills` (the previous bullet ends on a conversation), `control-openhands browser click 'testid=skill-toggle-flarglebargle'` (`aria-checked` `true`), then `control-openhands conversation start --prompt "flarglebargle" --wait --timeout 240`, `control-openhands api GET '/api/conversations/<id>/events/search?limit=5' --max-bytes 2000000` (`"activated_skills": ["flarglebargle"]`) and `control-openhands browser text 'testid=agent-message >> nth=-1'` (a reply praising how smart the user is). `control-openhands browser screenshot --feature F18.skill-in-chat --name enabled`. Switch it off again on `/skills` (`control-openhands browser goto /skills`, hover, click; `enabled_skills` no longer lists it) and start another `flarglebargle` conversation: `"activated_skills": []` and the agent says it does not recognise the word.
-- **Project skill in a workspace (`F18.project-skill`).** With the committed `qa-f18-skill` fixture, run `control-openhands browser goto /skills`, `control-openhands browser reload` and `control-openhands browser count 'testid=skill-card-qa-f18-skill'`: `0` (the catalog lists the Agent Server's own skills, not a workspace's). Then `control-openhands conversation start --workspace qa-f18-repo --prompt "qa-f18-ping" --wait --timeout 240` (note `<repo-skill-id>`; its `workspace` is the fixture's path) and, in the chat it leaves open, `control-openhands browser text 'testid=generic-event-message-title'` (`Skill Ready`), `control-openhands browser click 'role=button[name="Expand"]'` and `control-openhands browser count 'role=button[name="qa-f18-skill"]'` (`1`, under `Triggered Skill Knowledge:`); `control-openhands browser screenshot --feature F18.project-skill --name skill-ready`. With an LLM the agent also obeys the skill, and this is the moment to read it, while the chat is still open: `control-openhands browser text 'testid=agent-message >> nth=-1'` ends with `QA_SKILL_OK`; without a key the conversation ends in `error` right after the events below and that reply check is blocked (prerequisite: `DEEPSEEK_API_KEY`). Agent side, `control-openhands conversation events <repo-skill-id> --grep qa-f18-skill --from-start` matches the `SystemPromptEvent` (its `<available_skills>` lists `<name>qa-f18-skill</name>`) and the user `MessageEvent` (`skills: ["qa-f18-skill"]`, with excerpts showing `"activated_skills":["qa-f18-skill"]` and the `…/qa-f18-repo/.agents/skills/qa-f18-skill/SKILL.md` path). New Worktree: run `control-openhands workspace open qa-f18-repo`, `control-openhands browser click 'testid=workspace-mode-selector'`, `control-openhands browser click 'testid=workspace-mode-selector-option-new_worktree'` (`control-openhands browser text 'testid=home-git-control-bar-preview'` reads `qa-f18-repo` and `New Worktree`), then `control-openhands conversation start --stay --prompt "qa-f18-ping" --wait --timeout 240` (note `<worktree-id>`): its `workspace` is `/tmp/conversation-worktrees/<worktree-id>/qa-f18-repo`, a worktree of the fixture on branch `openhands/<worktree-id>` (read-only check: `git -C /tmp/conversation-worktrees/<worktree-id>/qa-f18-repo log --oneline` lists `Add qa-f18-skill`), `control-openhands browser text 'testid=generic-event-message-title'` is `Skill Ready` again (and the same reply check applies here, with a key), and `control-openhands conversation events <worktree-id> --grep qa-f18-skill --from-start` matches the same events with the worktree's `SKILL.md` path (a `ConversationStateUpdateEvent` carrying the agent context matches in both conversations too). Restore the mode: `control-openhands workspace open qa-f18-repo`, `control-openhands browser click 'testid=workspace-mode-selector'`, `control-openhands browser click 'testid=workspace-mode-selector-option-local_repo'` (the preview reads `Local Repo`).
+- **Project skill in a workspace (`F18.project-skill`).** With the committed `qa-f18-skill` fixture, run `control-openhands browser goto /skills`, `control-openhands browser reload` and `control-openhands browser count 'testid=skill-card-qa-f18-skill'`: `0` (the catalog lists the Agent Server's own skills, not a workspace's). Then `control-openhands conversation start --workspace qa-f18-repo --prompt "qa-f18-ping" --wait --timeout 240` (note `<repo-skill-id>`; its `workspace` is the fixture's path) and, in the chat it leaves open, `control-openhands browser text 'testid=generic-event-message-title'` (`Skill Ready`), `control-openhands browser click 'role=button[name="Expand"]'` and `control-openhands browser count 'role=button[name="qa-f18-skill"]'` (`1`, under `Triggered Skill Knowledge:`); `control-openhands browser screenshot --feature F18.project-skill --name skill-ready`. With an LLM the agent also obeys the skill, and this is the moment to read it, while the chat is still open: `control-openhands browser text 'testid=agent-message >> nth=-1'` ends with `QA_SKILL_OK`; without a key the conversation ends in `error` right after the events below and that reply check is blocked (prerequisite: `DEEPSEEK_API_KEY`). Agent side, `control-openhands conversation events <repo-skill-id> --grep qa-f18-skill --from-start` matches the `SystemPromptEvent` (its `<available_skills>` lists `<name>qa-f18-skill</name>`) and the user `MessageEvent` (`skills: ["qa-f18-skill"]`, with excerpts showing `"activated_skills":["qa-f18-skill"]` and the `…/qa-f18-repo/.agents/skills/qa-f18-skill/SKILL.md` path). New Worktree: run `control-openhands workspace open qa-f18-repo --mode new_worktree` (it picks the mode in the preview bar's selector and prints `mode` `new_worktree` and `preview` `qa-f18-repo` / `New Worktree`; `control-openhands browser text 'testid=home-git-control-bar-preview'` reads the same two lines), then `control-openhands conversation start --stay --prompt "qa-f18-ping" --wait --timeout 240` (note `<worktree-id>`): its `workspace` is `/tmp/conversation-worktrees/<worktree-id>/qa-f18-repo`, a worktree of the fixture on branch `openhands/<worktree-id>` (read-only check: `git -C /tmp/conversation-worktrees/<worktree-id>/qa-f18-repo log --oneline` lists `Add qa-f18-skill skill` above `Initial fixture commit`), `control-openhands browser text 'testid=generic-event-message-title'` is `Skill Ready` again (and the same reply check applies here, with a key), and `control-openhands conversation events <worktree-id> --grep qa-f18-skill --from-start` matches the same events with the worktree's `SKILL.md` path (a `ConversationStateUpdateEvent` carrying the agent context matches in both conversations too). Restore the mode: `control-openhands workspace open qa-f18-repo --mode local_repo` (`mode` `local_repo`, `preview` `qa-f18-repo` / `Local Repo`).
- **Deleted personal skill (`F18.skill-deleted`).** Run `control-openhands fixture skill --name qa-gone --trigger qa-farewell`, `control-openhands browser goto /skills`, `control-openhands browser reload`, `control-openhands browser count 'testid=skill-card-qa-gone'` (`1`; `control-openhands browser attr 'testid=skill-source-qa-gone' title` is the run's `…/private/home/.agents/skills/qa-gone/SKILL.md` path and `control-openhands browser text 'testid=skills-result-summary'` counts one result more than before) and `control-openhands browser screenshot --feature F18.skill-deleted --name present`. Prove it loads: `control-openhands conversation start --prompt "qa-farewell" --wait --timeout 240` (note `<gone-a>`), `control-openhands browser text 'testid=generic-event-message-title'` (`Skill Ready`) and `control-openhands conversation events <gone-a> --grep qa-gone --from-start`: the `SystemPromptEvent` and the user `MessageEvent` match, the latter with `skills: ["qa-gone"]`. Delete the folder (outside the UI; it is inside the run): `rm -rf "$OH_VERIFY_RUN/private/home/.agents/skills/qa-gone"`. Then `control-openhands browser goto /skills`, `control-openhands browser reload`, `control-openhands browser count 'testid=skill-card-qa-gone'` (`0`; the summary is back to its earlier count), `control-openhands conversation start --prompt "qa-farewell" --wait --timeout 240` (note `<gone-b>`), `control-openhands browser count 'text=Skill Ready'` (`0`; `control-openhands browser screenshot --feature F18.skill-deleted --name absent`) and `control-openhands conversation events <gone-b> --grep qa-gone --from-start`: `count` is `0`, and `control-openhands conversation events <gone-b> --kinds MessageEvent --from-start` shows the user message without a `skills` row. No model is needed: the skill set is fixed before the first model call.
- **Save failure (`F18.toggle-error`).** Run `control-openhands browser goto /skills`, wait for `testid=skill-toggle-add-javadoc` and note its `aria-checked` (`true` when this follows the toggle bullet, which left `add-javadoc` on). Then `control-openhands service stop agent-server`, `control-openhands browser click 'testid=skill-toggle-add-javadoc' --timeout 5000` (the card flips at once), wait about 2 s (the `PATCH /api/settings` is tried three times before the error shows; `browser network` lists three `502`s) and `control-openhands browser toasts --history`: `HTTP request failed (502 Bad Gateway): "Bad Gateway: connect ECONNREFUSED 127.0.0.1:<agent-server port>"`. `control-openhands browser screenshot --feature F18.toggle-error --name toast`. Run `control-openhands restart --timeout 240`, `control-openhands browser goto /skills`: `aria-checked` on `testid=skill-toggle-add-javadoc` is back to the value noted before the click and `enabled_skills` is unchanged. Clear the expected 502 noise with `control-openhands browser errors --clear`.
- **Detail modal and switch (`F18.detail-modal`).** With `add-javadoc` on, run `control-openhands browser click 'testid=skill-card-add-javadoc'`, `control-openhands browser testids 'testid=skill-detail-modal'` (name, source, `skill-modal-enable-row-add-javadoc`, description, pills incl. license `MIT`, `skill-modal-field-content-add-javadoc`, `skill-detail-close`, `skill-detail-use-skill-add-javadoc`) and `control-openhands browser enabled 'testid=skill-detail-use-skill-add-javadoc'` (`true`). Switch off with `control-openhands browser click 'testid=skill-modal-enable-row-add-javadoc >> text=Enabled'`; `control-openhands browser eval "document.querySelector('[data-testid=skill-modal-toggle-add-javadoc]').checked"` is `false`, the row reads `Disabled`, `enabled` on Use skill is `false` and the card toggle behind reads `aria-checked` `false`. `control-openhands browser screenshot --feature F18.detail-modal --name disabled`. Close, reload: the card stays off and `enabled_skills` no longer lists `add-javadoc`.
@@ -102,5 +102,5 @@ Preconditions:
- The Add skill example, its Copy button and the add-skill **Use skill** message share one constant. Since #18035 it is `.../skills/code-review`; before, it pointed at `skills/codereview`, which is 404 upstream (the skill was renamed).
- Skill changes apply to new conversations only; an open conversation keeps the skills it started with.
- `conversation events --grep` searches whole events, the user's message text included: a trigger that contains the skill name (`qa-gone-ping` for `qa-gone`) matches the user `MessageEvent` even when the skill is not loaded. Give fixture skills a trigger that does not contain their name, or grep for `<name>qa-gone</name>`.
-- `fixture skill --repo` writes the project `SKILL.md` but does not commit it; a New Worktree conversation checks out the repo's commits, so commit the skill first. Workspace skills are loaded per conversation and never appear on `/skills`.
+- `fixture skill --repo` writes the project `SKILL.md` and records it in the repo only with `--commit` (`committed.sha`; a re-run reports `unchanged`); a New Worktree conversation checks out the repo's commits, so pass `--commit`. Workspace skills are loaded per conversation and never appear on `/skills`.
- Without an LLM key the skill set is still observable: the `SystemPromptEvent` (available skills), the user `MessageEvent` (`activated_skills`) and the chat's **Skill Ready** row (`generic-event-message-title`; Expand lists the skills under `Triggered Skill Knowledge:`) all exist before the first model call, after which the conversation ends in `error`.
diff --git a/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md b/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md
index c0dc6da989..789395d535 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F25-backends-and-cloud.md
@@ -77,7 +77,7 @@ Preconditions:
- **Add the second backend (`F25.add-agent-server`).** Run `control-openhands browser goto /conversations/<id>`, `browser click 'testid=backend-selector'`, `browser click 'testid=add-backend-menu-item'`, `browser click 'testid=add-backend-option-agent-server'`, fill `add-backend-name` with `QA_Second` and `add-backend-host` with `<second-url>`, then `control-openhands browser fill 'testid=add-backend-api-key' --value-file "$OH_VERIFY_RUN_2/private/session-key"` and `control-openhands browser click 'testid=add-backend-submit' --expect-url '/conversations(\?|$)'`. The URL is `/conversations`, `browser count 'testid=add-backend-modal'` is `0`, `browser snapshot 'testid=backend-selector'` shows `combobox "QA_Second"`, and `browser count 'testid=conversation-card'` is `0`. Before anything reloads the page, `control-openhands browser toasts --history` lists only `Loading...` and the new backend's `Your LLM isn't set up yet, so conversations won't run. ...` (the second stack has no LLM profile; no error toast), and `control-openhands browser network --external --filter 'ids='` lists no request: the new backend is never asked for the first stack's conversation id. (`--external` leaves out this stack's own `GET /api/conversations?ids=<id>` from the `goto /conversations/<id>` above, which the request log keeps across page loads; `<second-url>` is another origin, so a request to it is listed.) The new backend asks its own telemetry consent ("This preference is saved for the local backend “QA_Second”"): run `control-openhands onboard --skip` (it leaves the browser on `/`). After `control-openhands browser reload` the selector still reads `QA_Second`.
- **Switch with the overlay (`F25.switch-backend`).** From `/` run `browser click 'testid=backend-selector'` and `control-openhands browser click 'testid=backend-selector >> role=option[name="Connected Local"]' --observe 'testid=environment-switch-overlay' --observe-ms 2500`. The observation shows `Switching to Local`, then `<absent>` about one second later; the selector reads `Local` and `browser count 'testid=conversation-card'` is `1`. Then `control-openhands browser click 'testid=conversation-card' --expect-url '/conversations/[0-9a-f-]+'`, open the selector and `control-openhands browser click 'testid=backend-selector >> role=option[name="Connected QA_Second"]' --expect-url '/conversations(\?|$)'`: the URL is `/conversations`, the selector reads `QA_Second` and the card count is `0`.
- **Pinned URL (`F25.backend-pinned-url`).** With `QA_Second` active run `control-openhands browser goto '/conversations/<id>?backend=default-local'` and `control-openhands browser wait 'testid=chat-interface'`: the selector reads `Local` and the conversation opens. `control-openhands browser goto '/conversations?backend=qa-unknown-id'` keeps `Local` (card count `1`). The sidebar card links themselves end in `?backend=default-local` (`browser snapshot`).
-- **Per-tab backend (`F25.per-tab-backend`).** With `Local` active and `QA_Second` registered, run `control-openhands browser goto /conversations` and `control-openhands browser eval "JSON.parse(sessionStorage.getItem('openhands-active-backend')).backendId"` (`default-local`); note QA_Second's id with `control-openhands browser eval "JSON.parse(localStorage.getItem('openhands-backends')).find(b=>b.name==='QA_Second').id"` (`<second-id>`, a generated UUID). Open a second tab from the sidebar: `control-openhands browser click 'testid=sidebar-conversations-link' --modifiers Control`, then `control-openhands browser tabs` lists two pages at `/conversations` (the **New Chat** link carries no `?backend=`). `control-openhands browser tab 1`, `control-openhands browser wait 'testid=backend-selector'`: `browser snapshot 'testid=backend-selector'` reads `combobox "Local"` and `control-openhands browser eval "sessionStorage.getItem('openhands-active-backend')"` is `null` (a new tab inherits nothing and starts from the localStorage fallback). Switch this tab: `browser click 'testid=backend-selector'`, `control-openhands browser click 'testid=backend-selector >> role=option[name="Connected QA_Second"]'`, `control-openhands browser wait 'testid=environment-switch-overlay' --state detached --timeout 10000`; the selector reads `QA_Second`, `browser count 'testid=conversation-card'` is `0` and `control-openhands browser eval "JSON.parse(localStorage.getItem('openhands-active-backend')).backendId"` is `<second-id>`. Back in `control-openhands browser tab 0` nothing moved: the selector still reads `Local`, the card count is `1`, the sessionStorage eval is still `default-local` while the localStorage eval is `<second-id>` (`browser screenshot --feature F25.per-tab-backend --name first-tab-unchanged`). A plain new tab starts from the last choice made in any tab: from tab 0 run `control-openhands browser click 'testid=sidebar-conversations-link' --modifiers Control`, `control-openhands browser tab 2`, `browser wait 'testid=backend-selector'`: the selector reads `QA_Second`, the card count is `0` and its sessionStorage item is `null` (`--name plain-new-tab-last-choice`). A conversation row opens on its owner instead: `control-openhands browser tab 0`, `control-openhands browser click 'testid=conversation-card' --modifiers Control`, `control-openhands browser wait-tab '/conversations/<id>' --timeout 20000` prints `index` `3` and the URL `/conversations/<id>?backend=default-local`; `control-openhands browser tab 3`, `control-openhands browser wait 'testid=chat-interface' --timeout 30000`, `browser url` still ends in `/conversations/<id>?backend=default-local` (no bounce to `/conversations`), the selector reads `Local` and `browser toasts --history` lists only `Loading...` (no `This conversation does not exist…`); `browser screenshot --feature F25.per-tab-backend --name new-tab-on-owner`. Close the extra tabs highest first: `control-openhands browser close-tab 3`, `control-openhands browser close-tab 2`, `control-openhands browser close-tab 1`, `control-openhands browser tab 0`; `browser tabs` lists one page and the selector reads `Local`. Opening the pinned link also recorded `default-local` as the last choice (the localStorage eval in tab 3 reads `default-local`), so run the plain-new-tab check before the row check.
+- **Per-tab backend (`F25.per-tab-backend`).** With `Local` active and `QA_Second` registered, run `control-openhands browser goto /conversations` and `control-openhands browser eval "JSON.parse(sessionStorage.getItem('openhands-active-backend')).backendId"` (`default-local`); note QA_Second's id with `control-openhands browser eval "JSON.parse(localStorage.getItem('openhands-backends')).find(b=>b.name==='QA_Second').id"` (`<second-id>`, a generated UUID). Open a plain second tab, as a user opening the app again: `control-openhands browser tab new /conversations` prints `index` `1` and makes it the daemon's active tab (`control-openhands browser tabs` lists two pages at `/conversations` with `active` `1`); `control-openhands browser wait-tab '/conversations$' --new --timeout 5000` then prints `index` `0`, the tab you came from, because `--new` leaves out the tab the daemon is on and that is now the new one (run from `browser tab 0` it prints `index` `1`, the second tab). `control-openhands browser tab 1`, `control-openhands browser wait 'testid=backend-selector'`: `browser snapshot 'testid=backend-selector'` reads `combobox "Local"` and `control-openhands browser eval "sessionStorage.getItem('openhands-active-backend')"` is `null` (a new tab inherits nothing and starts from the localStorage fallback). Switch this tab: `browser click 'testid=backend-selector'`, `control-openhands browser click 'testid=backend-selector >> role=option[name="Connected QA_Second"]'`, `control-openhands browser wait 'testid=environment-switch-overlay' --state detached --timeout 10000`; the selector reads `QA_Second`, `browser count 'testid=conversation-card'` is `0` and `control-openhands browser eval "JSON.parse(localStorage.getItem('openhands-active-backend')).backendId"` is `<second-id>`. Back in `control-openhands browser tab 0` nothing moved: the selector still reads `Local`, the card count is `1`, the sessionStorage eval is still `default-local` while the localStorage eval is `<second-id>` (`browser screenshot --feature F25.per-tab-backend --name first-tab-unchanged`). A plain new tab starts from the last choice made in any tab: from tab 0 run `control-openhands browser tab new /conversations` (`index` `2`, now active), `browser wait 'testid=backend-selector'`: the selector reads `QA_Second`, the card count is `0`, its sessionStorage item is `null` and the localStorage eval is `<second-id>` (`--name plain-new-tab-last-choice`). A conversation row opens on its owner instead: `control-openhands browser tab 0`, `control-openhands browser click 'testid=conversation-card' --modifiers Control` (add `>> nth=0` when the run holds more conversations than the precondition's one: the click is strict), `control-openhands browser wait-tab '/conversations/<id>' --timeout 20000` prints `index` `3` and the URL `/conversations/<id>?backend=default-local`; `control-openhands browser tab 3`, `control-openhands browser wait 'testid=chat-interface' --timeout 30000`, `browser url` still ends in `/conversations/<id>?backend=default-local` (no bounce to `/conversations`), the selector reads `Local` and `browser toasts --history` lists only `Loading...` (no `This conversation does not exist…`); `browser screenshot --feature F25.per-tab-backend --name new-tab-on-owner`. Close the extra tabs highest first: `control-openhands browser close-tab 3`, `control-openhands browser close-tab 2`, `control-openhands browser close-tab 1`, `control-openhands browser tab 0`; `browser tabs` lists one page and the selector reads `Local`. Opening the pinned link also recorded `default-local` as the last choice (the localStorage eval in tab 3 reads `default-local`), so run the plain-new-tab check before the row check.
- **Manage list and closing (`F25.manage-backends`).** Run `browser click 'testid=backend-selector'`, `control-openhands browser click 'testid=manage-backends-menu-item'` and `control-openhands browser snapshot 'testid=manage-backends-modal'`: heading `Manage backends`, two rows `Connected Local v1.50.1 <this run's URL> Connected Local` and `Connected QA_Second v1.50.1 <second-url> Connected Local`, each with `Edit` and `Remove`, then `Add Backend` and `Done`. `browser text 'testid=manage-backends-status-QA_Second'` is `Connected` and `browser text 'testid=manage-backends-version-QA_Second'` is `v1.50.1` (whatever `doctor` reports). Screenshot with `--feature F25.manage-backends --name list`. Close it four ways, reopening between: `browser press Escape`, `control-openhands browser mouse-click 20 500` (backdrop), `browser click 'testid=close-manage-backends-modal'`, `browser click 'testid=manage-backends-done'`; each time `browser count 'testid=manage-backends-modal'` is `0`.
- **Select from Manage (`F25.manage-select`).** With `Local` active, `control-openhands browser click 'testid=conversation-card' --expect-url '/conversations/[0-9a-f-]+'`, open Manage Backends, then `control-openhands browser click 'testid=manage-backends-row-QA_Second >> role=button >> nth=0' --expect-url '/conversations(\?|$)'`. Like the selector, the app leaves the detail page for `/conversations` (BM-002): `browser count 'testid=manage-backends-modal'` is `0`, the selector reads `QA_Second`, `browser count 'testid=chat-interface'` and `browser count 'testid=conversation-card'` are `0`, and `browser screenshot --feature F25.manage-select --name after-select` shows QA_Second's Home with its empty conversation list.
- **Edit validation and errors (`F25.edit-backend`).** Open Manage Backends, `control-openhands browser click 'testid=manage-backends-edit-QA_Second'`, then `browser value 'testid=edit-backend-host'` (`<second-url>`), `browser attr 'testid=edit-backend-api-key' type` (`password`) and `browser text 'testid=edit-backend-status'` (`Connected`, `·`, `Local`, `v1.50.1` on separate lines). Fill `edit-backend-name` with an empty string and `edit-backend-host` with `not a host`, then `browser focus 'testid=edit-backend-api-key'` and `browser snapshot 'testid=edit-backend-form'`: alerts `Name is required` and `Enter a valid URL (e.g. http://localhost:8080)`; `browser enabled 'testid=edit-backend-submit'` is `false`.
@@ -103,7 +103,8 @@ Preconditions:
- Manage-row test ids use the backend name (`manage-backends-row-QA_Second`), so they change after a rename and are not unique when two backends share a name; the Cloud **Log back in** id uses the backend id instead (`manage-backends-login-<id>-login-button`).
- Selector options are named `<status> <name>` (`Connected Local`, `Disconnected QA_Renamed`): select them with `role=option[name="Connected <name>"]`.
- After a navigating option click, `--expect-url` must allow `?backend=...`: end regexes with `(\?|$)`.
-- `browser wait-tab <regex>` matches any open page, including the current one: for a second tab at the same URL (`/conversations` from **New Chat**) read `browser tabs` and switch with `browser tab <i>`; `wait-tab` is only reliable when the new tab's URL is unique (`/conversations/<id>`). Close extra tabs highest index first, or the indexes shift under you.
+- `browser wait-tab <regex>` matches any open page, including the current one, unless `--new` leaves out the tab the daemon is on: for a second tab at the same URL (`/conversations` from **New Chat**) use `wait-tab '/conversations$' --new`, or read `browser tabs` and switch with `browser tab <i>`. `browser tab new /conversations` opens a plain second tab (no opener, empty sessionStorage), the state a user reaches by opening the app again. Close extra tabs highest index first, or the indexes shift under you.
+- `browser tab new` switches the daemon to the tab it opened, so a `wait-tab <regex> --new` run right after it reports the tab you came from (`index` `0` with two tabs); `browser tab 0` first when you want the new tab's index from `wait-tab`. A `tab new` and a `click --modifiers Control` on **New Chat** reach the same state (selector from the localStorage fallback, sessionStorage item `null`).
- A tab opened with `click --modifiers Control` starts with an empty sessionStorage, so it boots from the localStorage fallback (the backend last chosen in any tab) unless its URL carries `?backend=`. Opening a `?backend=` link writes that backend to localStorage too: a per-tab check that relies on "last choice" must run before opening pinned links.
- The Add Backend Agent-server form has no inline "required" messages; it only disables **Connect**. The messages exist in the Edit form.
- Footer clicks from the collapsed popover or the phone drawer open the modals a moment later: `browser wait` for them instead of `count`.
@@ -114,7 +115,7 @@ Preconditions:
- `/oauth/device/verify` is a Cloud page that also ships in Canvas: on a local stack its POST target does not exist, so Authorize always ends in `Error`. The "Authentication Required" state is unreachable (`useIsAuthed` always resolves `true`).
- `/shared/conversations/<id>` on a local backend also raises a raw toast `HTTP request failed (404 Not Found): {"detail":"Not Found"}` next to `Conversation not found` (#17953).
- Known failure (repro candidate, not an exemption): `F25.edit-escape` closes the Manage modal underneath and drops the Edit draft (Cancel and X close only Edit, `F25.edit-cancel`) (#17953).
-- The add bullet's `network --external --filter 'ids='` check guards an earlier race: on a backend's first activation from `/conversations/<id>`, about 1 attempt in 5 asked the new backend for the old conversation id. It did not happen in 15 first activations at 4eff80237: each time `QA_Second` was removed, its consent unset with `control-openhands api PATCH /api/settings --run "$OH_VERIFY_RUN_2" --write --data '{"misc_settings_diff":{"app_preferences":{"user_consents_to_analytics":null}}}'` (arrange only) and the backend added again from `/conversations/<id>`. A backend that lacks an id answers `[null]`, which now reads as "not found" (only the `This conversation does not exist…` toast), not as incompatible data. No merged change was shown to fix the race itself (#18009 only changed how a `[null]` answer reads; #18024 only moved the redirect into a shared hook, still called after `addBackend`), so a hit (an `ids=` request to `<second-url>`) is a bug to file. At 95115e84f6dd it hit on 1 of 2 first activations from `/conversations/<id>` (one `GET <second-url>/api/conversations?ids=<id>` answered `200`, with no `This conversation does not exist…` toast after it). The hit followed a failed Connect in the same modal (an empty key, `Invalid API key`) before the successful one; the clean retry, which connected once, had none, so a repro should try both sequences. Record the Add bullet as `fail` when the request appears, even though the redirect and the selector look right.
+- The add bullet's `network --external --filter 'ids='` check guards an earlier race: on a backend's first activation from `/conversations/<id>`, about 1 attempt in 5 asked the new backend for the old conversation id. It did not happen in 15 first activations at 4eff80237: each time `QA_Second` was removed, its consent unset with `control-openhands api PATCH /api/settings --run "$OH_VERIFY_RUN_2" --write --data '{"misc_settings_diff":{"app_preferences":{"user_consents_to_analytics":null}}}'` (arrange only) and the backend added again from `/conversations/<id>`. A backend that lacks an id answers `[null]`, which now reads as "not found" (only the `This conversation does not exist…` toast), not as incompatible data. No merged change was shown to fix the race itself (#18009 only changed how a `[null]` answer reads; #18024 only moved the redirect into a shared hook, still called after `addBackend`), so a hit (an `ids=` request to `<second-url>`) is a bug to file. At 95115e84f6dd it hit on 1 of 2 first activations from `/conversations/<id>` (one `GET <second-url>/api/conversations?ids=<id>` answered `200`, with no `This conversation does not exist…` toast after it). The hit followed a failed Connect in the same modal (an empty key, `Invalid API key`) before the successful one; the clean retry, which connected once, had none, so a repro should try both sequences. On 2026-10-08 at d2c89252d it did not reproduce in 17 first activations (8 clean, 9 failed-then-clean, some under CPU load and some human-paced): every `ids=` capture was empty, and no merged change touched the activation logic since the hit, so it stays a watch item rather than a filed defect. Record the Add bullet as `fail` when the request appears, even though the redirect and the selector look right.
- Toasts are not page or HTTP errors, so `browser errors --app-only` misses them: read `browser toasts --history` after every add or switch, before anything reloads the page (the history starts with each page load).
- `F25.locked-cloud` needs `scripts/static-server.mjs --lock-to-cloud <url>`, which neither `bin/agent-canvas.mjs` nor `control-openhands launch` can pass today; even with it, reconnecting needs a Cloud account.
- The Cloud tab title truncates to `OpenHan…` at 390 px when the Agent-server tab is selected; the layout still fits.
diff --git a/.agents/skills/verify-openhands/references/feature-map/F26-runtime-variants.md b/.agents/skills/verify-openhands/references/feature-map/F26-runtime-variants.md
index 2c45ab69f4..956eac87d6 100644
--- a/.agents/skills/verify-openhands/references/feature-map/F26-runtime-variants.md
+++ b/.agents/skills/verify-openhands/references/feature-map/F26-runtime-variants.md
@@ -26,13 +26,13 @@ Source: `bin/agent-canvas.mjs`, `scripts/dev-with-automation.mjs`, `scripts/dev-
- `F26.session-key-persist`: in local mode without `LOCAL_BACKEND_API_KEY` the launcher generates a session key, saves it under `$HOME/.openhands/agent-canvas/api-key.txt` and injects the same key again on the next start.
- `F26.session-key-pinned`: `LOCAL_BACKEND_API_KEY=<key>` in local mode injects exactly that key into the page and the API accepts only it (the saved generated key gets 401).
- `F26.frontend-only`: `--frontend-only` serves the SPA; `/server_info`, `/api/*`, `/sockets/*` and `/api/automation/*` answer 503, and a browser new to that origin opens on the **Add a backend** onboarding step without an error toast.
-- `F26.frontend-only-returning`: on a frontend-only origin, a browser that already stores a backend for that origin (the `default-local` entry a full launcher on the same port seeded, or one added there earlier) gets the recovery gate instead of onboarding: `agent-server-onboarding-screen` with Manage backends in recovery mode and the `Local` row `Disconnected` with the 503 detail (the gate itself is F25's recovery-gate row); the failing probes raise generic `An error occurred` toasts there.
+- `F26.frontend-only-returning`: on a frontend-only origin, a browser that already stores a backend for that origin (the `default-local` entry a full launcher on the same port seeded, or one added there earlier) gets the recovery gate instead of onboarding: `agent-server-onboarding-screen` with Manage backends in recovery mode and the `Local` row `Disconnected` with the 503 detail (the gate itself is F25's recovery-gate row); the failing probes raise generic `An error occurred` toasts there (Known failure, reproduced 2026-10-08: #18160).
- `F26.backend-only`: `--backend-only` serves the APIs (key-protected) and answers 503 `No backend configured for this route` for `/` and static assets.
- `F26.cross-connect`: a frontend-only UI connects to a separate backend-only instance through **Add a backend**; the shell then shows that backend as Connected and all API traffic goes to it.
- `F26.remote-backend`: from a normal Canvas, backend selector → **Add Backend** → **Agent-server** → **Remote** shows the self-hosting guidance and connects to another instance (stand-in for a self-hosted VM, `docs/SELF_HOSTING.md`).
- `F26.seeded-local-backend`: the first load of a launcher-served UI seeds one backend `Local` (id `default-local`) with the page origin and the injected key.
- `F26.host-bind-lan`: `--host 0.0.0.0` warns, listens on the machine's LAN address, and serves an index.html that carries `__AGENT_CANVAS_AUTH_REQUIRED__` and neither `__AGENT_CANVAS_SESSION_API_KEY__` nor the key itself (the loopback launcher's page carries the key marker); the UI behaves like `--public` (Add a backend with Next disabled; Skip leads to the API-key screen).
-- `F26.host-bind-lan-optin`: the opt-in the launcher's warning recommends (`--allow-lan-session-key`) should restore key injection on a LAN bind. Fails today (flag ignored).
+- `F26.host-bind-lan-optin`: the opt-in the launcher's warning recommends (`--allow-lan-session-key`) should restore key injection on a LAN bind. Known failure (reproduced 2026-10-08): the npm launcher ignores the flag and the page still carries only `__AGENT_CANVAS_AUTH_REQUIRED__`; #17949.
- `F26.host-bind-env`: `OH_BIND_HOST=0.0.0.0` (the environment form of `--host`) prints the same two "not loopback" warnings and does not inject the session key, even with `LOCAL_BACKEND_API_KEY` set.
- `F26.runtime-services`: `/server_info.runtime_services` lists the agent-server, ingress, frontend and automation URLs as the agent sees them, and a new conversation's system prompt carries a matching `<RUNTIME_SERVICES>` block.
- `F26.lib-build`: `npm run build:lib` produces `dist/` where every `package.json` `exports` target exists and the main entry exports `AgentServerUIProviders`, `AgentServerUIRoot`, `CloudOrganizationBoundary` and the telemetry helpers.
@@ -102,7 +102,7 @@ Preconditions:
- The browser daemon refuses other origins unless you pass `--allow-external` to `browser goto`. Each port is its own origin, so a partial-stack page starts at first run again (onboarding and a consent dialog), independent of your run's onboarding.
- In a frontend-only UI the **Add a backend** step's Next is enabled with an empty key, while on a LAN or `--public` stack it is disabled until a key is typed: the host the step probes differs (503 vs. auth-required).
- A partial-stack origin keeps its stored backend in the browser profile across launches, so a second pass lands straight in the shell. `control-openhands browser reset` brings back the first run on every origin; then `control-openhands browser goto /` and `control-openhands onboard --skip` restore your own run's baseline.
-- Which screen a frontend-only origin shows depends on the browser, not the launcher: a profile new to the origin gets **Add a backend** (first run owns the initial backend), while a profile that stores a backend for that origin (the `default-local` entry a full launcher on the same port seeded, or any backend added there earlier) gets the recovery gate of `F25.recovery-gate` as soon as that backend answers 503 (`F26.frontend-only-returning`). The no-toast check belongs to the first-run state only: on the gate, `browser toasts --history` lists generic `An error occurred` status toasts raised by the failing 503 probes (two within 12 s here), with no hint of which request failed.
+- Which screen a frontend-only origin shows depends on the browser, not the launcher: a profile new to the origin gets **Add a backend** (first run owns the initial backend), while a profile that stores a backend for that origin (the `default-local` entry a full launcher on the same port seeded, or any backend added there earlier) gets the recovery gate of `F25.recovery-gate` as soon as that backend answers 503 (`F26.frontend-only-returning`). The no-toast check belongs to the first-run state only: on the gate, `browser toasts --history` lists generic `An error occurred` status toasts raised by the failing 503 probes (two within 12 s here), with no hint of which request failed. Known failure (reproduced 2026-10-08): both toasts come from the free-models hydrator's `GET /api/llm/models/verified` 503, which no `meta.disableToast` guards on that screen (nor does `backend-version.tsx`); #18160.
- Stopping a backend-only instance while the frontend-only page that uses it stays open is the same backend-down state as `F25.recovery-gate` after a reload; keep the returning-user bullet above as the frontend-only-specific check (it reproduces the `default-local` case).
- The launcher serves the bundled VS Code editor. #17660 made that opt-in (`OH_CANVAS_ENABLE_VSCODE=true`) and #18048 reverted it, so only a checkout between the two needs the variable (`launch --vscode` sets it). A launcher that serves it reserves `/vscode/`: a frontend-only stack answers `503` there and logs `[static] /vscode -> 503 (rejected)`; a stack with an agent-server lists `/vscode → http://127.0.0.1:<agent-server port + 1000>` in its ingress banner and hands the agent-server that editor port (19961 for the hand-started launchers here, 19000 for the desktop app), which the launcher's own port check does not cover. On a checkout between the two without the variable, `/vscode/` is an ordinary SPA URL (`200`). Here the agent-server has no editor binary (`VSCode server binary not found, VSCode will be disabled` in the launcher log, `/api/vscode/status` `{"running":false,"enabled":true}`), so the editor port stays free even then.
- The port-in-use error is printed twice, the second time with a Node stack trace, and suggests `PORT=<other>` rather than `--port` (#17949). The `--public` key error's example says `npm run dev -- --public` instead of the npx command.
@@ -113,5 +113,5 @@ Preconditions:
- A browser origin keeps the backends it stored on an earlier pass: after the LAN pass on 18960, a later loopback launch on 18960 shows the stale `QA_LAN` backend (red, old key) instead of onboarding, although the page injects a valid key. Assert key-injection bullets through the `window` globals, or `browser reset` first.
- Electron's splash shows each raw service-log line (`agent-server: {"asctime": ...`) as its status text during boot; the named phases only appear between them.
- `build:lib` from a copy whose `node_modules` is a symlink emits bundled dependencies under `dist/<absolute node_modules path>/...`; that path is an artifact of the copy, not of the product.
-- **Bug candidate (`F26.host-bind-lan-optin`):** `scripts/bind-host.mjs` tells npm users to pass `--allow-lan-session-key`, but neither `bin/agent-canvas.mjs` nor `scripts/dev-with-automation.mjs` parses or forwards it (only `scripts/static-server.mjs` and the Docker entrypoint do), and unknown flags are silently ignored (#17949).
+- **Bug candidate (`F26.host-bind-lan-optin`):** `scripts/bind-host.mjs` tells npm users to pass `--allow-lan-session-key`, but neither `bin/agent-canvas.mjs` nor `scripts/dev-with-automation.mjs` parses or forwards it (only `scripts/static-server.mjs` and the Docker entrypoint do), and unknown flags are silently ignored (#17949, whose first item is exactly this; reproduced again on 2026-10-08 at d2c89252d).
- Known issue #17946: the npm launcher never creates its `TMUX_TMPDIR`, so hand-started instances share one tmux server and a restart of one resets the others' terminals.
diff --git a/.agents/skills/verify-openhands/scripts/browser-daemon.mjs b/.agents/skills/verify-openhands/scripts/browser-daemon.mjs
index d37c544506..f72e6c6d17 100755
--- a/.agents/skills/verify-openhands/scripts/browser-daemon.mjs
+++ b/.agents/skills/verify-openhands/scripts/browser-daemon.mjs
@@ -21,6 +21,7 @@ import { createRequire } from "node:module";
import { basename, dirname, extname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { redactStorage } from "./lib/redact-storage.mjs";
+import { SECRET_KEY, SECRET_PATH, redactBody } from "./lib/network-bodies.mjs";
import { buildLocator, toCss } from "./lib/selectors.mjs";
const here = dirname(fileURLToPath(import.meta.url));
@@ -172,8 +173,7 @@ function redactQuery(search) {
if (!search) return "";
const params = new URLSearchParams(search);
for (const key of [...params.keys()]) {
- if (/key|token|secret|auth|pass|session|sig/i.test(key))
- params.set(key, "<redacted>");
+ if (SECRET_KEY.test(key)) params.set(key, "<redacted>");
}
const text = params.toString();
return text ? `?${text.slice(0, 200)}` : "";
@@ -234,6 +234,19 @@ function watch(page) {
return;
}
if (!origin.startsWith("http") && !origin.startsWith("ws")) return;
+ // The body of an app-origin write, redacted (see lib/network-bodies.mjs);
+ // `network --bodies` shows it, so a recipe can prove what the page sent.
+ let body;
+ if (
+ origin === baseUrl.origin &&
+ /^(POST|PUT|PATCH|DELETE)$/.test(request.method())
+ ) {
+ try {
+ body = redactBody(request.postData(), { all: SECRET_PATH.test(path) });
+ } catch {
+ body = undefined;
+ }
+ }
const entry = {
ts: new Date().toISOString(),
origin,
@@ -242,6 +255,7 @@ function watch(page) {
method: request.method(),
type: request.resourceType(),
app: origin === baseUrl.origin,
+ body,
};
requestEntries.set(request, entry);
requests.push(entry);
@@ -297,6 +311,172 @@ context.on("page", (page) => {
record("page-opened", page, { url: page.url() });
});
+// Transient states (labels such as "Saving...", a loading row) of the
+// elements an `--observe` selector names, while an action's effects play
+// out: an in-page MutationObserver when the selector is plain CSS/testid,
+// else polling every 20 ms. `startObserver` before the action,
+// `finishObserver` after it.
+async function startObserver(observe) {
+ if (!observe) return undefined;
+ let observer;
+ let poller;
+ const css = toCss(observe);
+ if (css) {
+ observer = await activePage
+ .evaluateHandle((sel) => {
+ document.querySelectorAll(sel);
+ const log = [];
+ const snap = () => {
+ const els = [...document.querySelectorAll(sel)];
+ // Text plus disabled/busy markers, so pending states show up.
+ const entry = els.length
+ ? els.map(
+ (e) =>
+ (e.innerText || e.value || "").trim().slice(0, 80) +
+ (e.disabled || e.getAttribute("aria-disabled") === "true"
+ ? " [disabled]"
+ : "") +
+ (e.getAttribute("aria-busy") === "true" ? " [busy]" : ""),
+ )
+ : ["<absent>"];
+ const key = JSON.stringify(entry);
+ if (log[log.length - 1]?.key !== key) {
+ log.push({ key, t: Math.round(performance.now()) });
+ }
+ };
+ snap();
+ const mo = new MutationObserver(snap);
+ mo.observe(document.body, {
+ subtree: true,
+ childList: true,
+ characterData: true,
+ attributes: true,
+ });
+ return { log, mo };
+ }, css)
+ .catch(() => undefined);
+ }
+ if (!observer) {
+ const log = [];
+ const t0 = Date.now();
+ poller = { log, running: true };
+ poller.done = (async () => {
+ while (poller.running) {
+ let entry;
+ try {
+ const loc = locate(observe);
+ entry = (await loc.count())
+ ? (await loc.allInnerTexts()).map((s) => s.trim().slice(0, 80))
+ : ["<absent>"];
+ } catch {
+ entry = ["<unreadable>"];
+ }
+ const key = JSON.stringify(entry);
+ if (log[log.length - 1]?.key !== key)
+ log.push({ key, t: Date.now() - t0 });
+ await new Promise((r) => setTimeout(r, 20));
+ }
+ })();
+ }
+ return { observer, poller };
+}
+
+// The action failed: stop watching without a report, so the poller does not
+// outlive the request and the page's MutationObserver is disconnected.
+async function abandonObserver(watching) {
+ if (!watching) return;
+ const { observer, poller } = watching;
+ if (observer)
+ await observer.evaluate(({ mo }) => mo.disconnect()).catch(() => {});
+ if (poller) {
+ poller.running = false;
+ await poller.done.catch(() => {});
+ }
+}
+
+async function finishObserver(watching, observeMs) {
+ if (!watching) return {};
+ const { observer, poller } = watching;
+ await activePage.waitForTimeout(Number(observeMs ?? 3000));
+ let observed;
+ if (observer) {
+ observed = await observer.evaluate(({ log, mo }) => {
+ mo.disconnect();
+ const start = log[0]?.t ?? 0;
+ return log.map((l) => ({ ms: l.t - start, state: JSON.parse(l.key) }));
+ });
+ } else {
+ poller.running = false;
+ await poller.done;
+ observed = poller.log.map((l) => ({
+ ms: l.t,
+ state: JSON.parse(l.key),
+ }));
+ }
+ return { observed, observedBy: observer ? "mutation" : "poll-20ms" };
+}
+
+// One scroll, as `browser scroll` asked for it: a horizontal rail, the
+// nearest scrollable container of an element, an element into view, or the
+// wheel at the pointer.
+async function scrollOnce({ selector, by, x, timeout }) {
+ if (selector && x !== undefined) {
+ // Horizontal rails: scroll the nearest horizontally scrollable box.
+ return locate(selector)
+ .first()
+ .evaluate((el, dx) => {
+ let node = el;
+ while (
+ node &&
+ !(
+ node.scrollWidth > node.clientWidth &&
+ /auto|scroll/.test(getComputedStyle(node).overflowX)
+ )
+ ) {
+ node = node.parentElement;
+ }
+ const target = node || document.scrollingElement;
+ target.scrollBy(dx, 0);
+ return {
+ scrolled: target === document.scrollingElement ? "page" : "container",
+ scrollLeft: Math.round(target.scrollLeft),
+ scrollWidth: target.scrollWidth,
+ };
+ }, Number(x));
+ }
+ if (selector && by !== undefined) {
+ // Scroll the element's nearest scrollable container (settings and
+ // panels scroll inside a container, not the window).
+ return locate(selector)
+ .first()
+ .evaluate((el, dy) => {
+ let node = el;
+ while (
+ node &&
+ !(
+ node.scrollHeight > node.clientHeight &&
+ /auto|scroll/.test(getComputedStyle(node).overflowY)
+ )
+ ) {
+ node = node.parentElement;
+ }
+ const target = node || document.scrollingElement;
+ target.scrollBy(0, dy);
+ return {
+ scrolled: target === document.scrollingElement ? "page" : "container",
+ scrollTop: Math.round(target.scrollTop),
+ scrollHeight: target.scrollHeight,
+ };
+ }, Number(by));
+ }
+ if (selector) {
+ await locate(selector).scrollIntoViewIfNeeded({ timeout });
+ return { scrolled: "into-view" };
+ }
+ await activePage.mouse.wheel(0, Number(by ?? 600));
+ return { scrolled: "wheel at mouse position" };
+}
+
function locate(selector) {
return buildLocator(activePage, selector);
}
@@ -445,114 +625,38 @@ const handlers = {
observeMs,
}) {
const before = activePage.url();
- // Record transient states (labels such as "Saving...", skeletons) of the
- // observed elements while the click's effects play out: an in-page
- // MutationObserver when the selector is plain CSS/testid, else polling.
- let observer;
- let poller;
- const css = observe ? toCss(observe) : null;
- if (css) {
- observer = await activePage
- .evaluateHandle((sel) => {
- document.querySelectorAll(sel);
- const log = [];
- const snap = () => {
- const els = [...document.querySelectorAll(sel)];
- // Text plus disabled/busy markers, so pending states show up.
- const entry = els.length
- ? els.map(
- (e) =>
- (e.innerText || e.value || "").trim().slice(0, 80) +
- (e.disabled || e.getAttribute("aria-disabled") === "true"
- ? " [disabled]"
- : "") +
- (e.getAttribute("aria-busy") === "true" ? " [busy]" : ""),
- )
- : ["<absent>"];
- const key = JSON.stringify(entry);
- if (log[log.length - 1]?.key !== key) {
- log.push({ key, t: Math.round(performance.now()) });
- }
- };
- snap();
- const mo = new MutationObserver(snap);
- mo.observe(document.body, {
- subtree: true,
- childList: true,
- characterData: true,
- attributes: true,
- });
- return { log, mo };
- }, css)
- .catch(() => undefined);
- }
- if (observe && !observer) {
- const log = [];
- const t0 = Date.now();
- poller = { log, running: true };
- poller.done = (async () => {
- while (poller.running) {
- let entry;
- try {
- const loc = locate(observe);
- entry = (await loc.count())
- ? (await loc.allInnerTexts()).map((s) => s.trim().slice(0, 80))
- : ["<absent>"];
- } catch {
- entry = ["<unreadable>"];
- }
- const key = JSON.stringify(entry);
- if (log[log.length - 1]?.key !== key)
- log.push({ key, t: Date.now() - t0 });
- await new Promise((r) => setTimeout(r, 20));
- }
- })();
- }
- if (hoverFirst) {
- // Hover-driven controls re-render on pointerenter and swallow a click
- // that moves and presses at once.
- await locate(selector).hover({ timeout });
- await activePage.waitForTimeout(Number(hoverFirst) || 150);
- }
- await locate(selector).click({
- timeout,
- force,
- button,
- modifiers,
- position,
- });
- if (expectUrl) {
- await activePage.waitForURL(new RegExp(expectUrl), { timeout });
- }
- if (expectNewUrl) {
- const re = new RegExp(expectNewUrl);
- await activePage.waitForURL(
- (u) => u.toString() !== before && re.test(u.toString()),
- { timeout },
- );
- }
- let observed;
- if (observer || poller) {
- await activePage.waitForTimeout(Number(observeMs ?? 3000));
- }
- if (observer) {
- observed = await observer.evaluate(({ log, mo }) => {
- mo.disconnect();
- const start = log[0]?.t ?? 0;
- return log.map((l) => ({ ms: l.t - start, state: JSON.parse(l.key) }));
+ const watching = await startObserver(observe);
+ try {
+ if (hoverFirst) {
+ // Hover-driven controls re-render on pointerenter and swallow a click
+ // that moves and presses at once.
+ await locate(selector).hover({ timeout });
+ await activePage.waitForTimeout(Number(hoverFirst) || 150);
+ }
+ await locate(selector).click({
+ timeout,
+ force,
+ button,
+ modifiers,
+ position,
});
- } else if (poller) {
- poller.running = false;
- await poller.done;
- observed = poller.log.map((l) => ({
- ms: l.t,
- state: JSON.parse(l.key),
- }));
+ if (expectUrl) {
+ await activePage.waitForURL(new RegExp(expectUrl), { timeout });
+ }
+ if (expectNewUrl) {
+ const re = new RegExp(expectNewUrl);
+ await activePage.waitForURL(
+ (u) => u.toString() !== before && re.test(u.toString()),
+ { timeout },
+ );
+ }
+ } catch (error) {
+ await abandonObserver(watching);
+ throw error;
}
return {
url: activePage.url(),
- observed,
- observedBy: observe ? (observer ? "mutation" : "poll-20ms") : undefined,
+ ...(await finishObserver(watching, observeMs)),
};
},
async dblclick({ selector, timeout, modifiers }) {
@@ -625,64 +729,18 @@ const handlers = {
await locate(selector).setInputFiles(files, { timeout });
return { files };
},
- async scroll({ selector, by, x, timeout }) {
- if (selector && x !== undefined) {
- // Horizontal rails: scroll the nearest horizontally scrollable box.
- return locate(selector)
- .first()
- .evaluate((el, dx) => {
- let node = el;
- while (
- node &&
- !(
- node.scrollWidth > node.clientWidth &&
- /auto|scroll/.test(getComputedStyle(node).overflowX)
- )
- ) {
- node = node.parentElement;
- }
- const target = node || document.scrollingElement;
- target.scrollBy(dx, 0);
- return {
- scrolled:
- target === document.scrollingElement ? "page" : "container",
- scrollLeft: Math.round(target.scrollLeft),
- scrollWidth: target.scrollWidth,
- };
- }, Number(x));
- }
- if (selector && by !== undefined) {
- // Scroll the element's nearest scrollable container (settings and
- // panels scroll inside a container, not the window).
- return locate(selector)
- .first()
- .evaluate((el, dy) => {
- let node = el;
- while (
- node &&
- !(
- node.scrollHeight > node.clientHeight &&
- /auto|scroll/.test(getComputedStyle(node).overflowY)
- )
- ) {
- node = node.parentElement;
- }
- const target = node || document.scrollingElement;
- target.scrollBy(0, dy);
- return {
- scrolled:
- target === document.scrollingElement ? "page" : "container",
- scrollTop: Math.round(target.scrollTop),
- scrollHeight: target.scrollHeight,
- };
- }, Number(by));
- }
- if (selector) {
- await locate(selector).scrollIntoViewIfNeeded({ timeout });
- return { scrolled: "into-view" };
+ async scroll({ selector, by, x, timeout, observe, observeMs }) {
+ // `--observe SEL` records what SEL shows while the scroll's effects
+ // play out (a loading row, a fetched page), as `click --observe` does.
+ const watching = await startObserver(observe);
+ let result;
+ try {
+ result = await scrollOnce({ selector, by, x, timeout });
+ } catch (error) {
+ await abandonObserver(watching);
+ throw error;
}
- await activePage.mouse.wheel(0, Number(by ?? 600));
- return { scrolled: "wheel at mouse position" };
+ return { ...result, ...(await finishObserver(watching, observeMs)) };
},
async wait({ selector, state, timeout }) {
await locate(selector)
@@ -901,13 +959,16 @@ const handlers = {
}, expression);
return { value };
},
- async "wait-tab"({ pattern, timeout }) {
- // window.open pages appear a moment after the click.
+ async "wait-tab"({ pattern, timeout, excludeActive }) {
+ // window.open pages appear a moment after the click. With
+ // `--new` the page the daemon is on does not count, so a second tab at
+ // the current URL can be waited for.
const re = new RegExp(pattern);
+ const skip = excludeActive ? activePage : null;
const deadline = Date.now() + (timeout ?? 10_000);
while (Date.now() < deadline) {
const pages = context.pages();
- const index = pages.findIndex((p) => re.test(p.url()));
+ const index = pages.findIndex((p) => p !== skip && re.test(p.url()));
if (index >= 0) return { index, url: pages[index].url() };
await new Promise((r) => setTimeout(r, 100));
}
@@ -916,6 +977,31 @@ const handlers = {
`No tab matching ${pattern} within the timeout. Open tabs: ${open.join(" | ")} (a pop-up that stays about:blank could not load its URL)`,
);
},
+ async "new-tab"({ target, allowExternal }) {
+ // A plain new tab, as a user opening the app in a second tab: no
+ // opener, no sessionStorage, the localStorage of the same profile.
+ // Resolve the target first: a refused URL must not leave a blank tab
+ // open and active.
+ const url = target ? assertAppUrl(target, allowExternal) : undefined;
+ const previous = activePage;
+ const page = await context.newPage();
+ activePage = page;
+ if (url) {
+ try {
+ await page.goto(url, { waitUntil: "domcontentloaded" });
+ } catch (error) {
+ // A navigation that fails (the stack is down) closes the tab it
+ // opened and leaves the daemon on the tab it was on.
+ activePage = previous;
+ await page.close().catch(() => {});
+ throw error;
+ }
+ await page
+ .waitForLoadState("networkidle", { timeout: 10_000 })
+ .catch(() => {});
+ }
+ return { index: context.pages().indexOf(page), url: page.url() };
+ },
async tabs() {
return {
active: context.pages().indexOf(activePage),
@@ -1017,7 +1103,7 @@ const handlers = {
if (keysOnly !== false) return { area, keys: Object.keys(data).sort() };
return { area, storage: redactStorage(data) };
},
- async network({ clear, external, last, filter }) {
+ async network({ clear, external, last, filter, bodies }) {
const re = filter ? new RegExp(filter) : null;
const list = requests.filter(
(r) =>
@@ -1029,7 +1115,9 @@ const handlers = {
const result = {
total: list.length,
byOrigin,
- recent: list.slice(-Number(last ?? 15)),
+ recent: list
+ .slice(-Number(last ?? 15))
+ .map(({ body, ...rest }) => (bodies ? { ...rest, body } : rest)),
};
if (clear) requests.length = 0;
return result;
diff --git a/.agents/skills/verify-openhands/scripts/control-openhands.mjs b/.agents/skills/verify-openhands/scripts/control-openhands.mjs
index 6fda00aa16..c4d4658ecf 100755
--- a/.agents/skills/verify-openhands/scripts/control-openhands.mjs
+++ b/.agents/skills/verify-openhands/scripts/control-openhands.mjs
@@ -42,6 +42,11 @@ import {
} from "./lib/testids.mjs";
import { tmuxPathFor } from "./lib/tmux-path.mjs";
import { browserCallLimit } from "./lib/call-limit.mjs";
+import {
+ PAGE_LIMIT,
+ collectEvents,
+ countImages,
+} from "./lib/events-paging.mjs";
const here = dirname(fileURLToPath(import.meta.url));
const skillDir = resolve(here, "..");
@@ -1837,7 +1842,14 @@ function eventText(event) {
}
// The Open Workspace folder browser has no path field: walk it to PATH.
-async function openWorkspace(run, name, { stay } = {}) {
+const WORKSPACE_MODES = ["local_repo", "new_worktree"];
+
+async function openWorkspace(run, name, { stay, mode } = {}) {
+ if (mode !== undefined && !WORKSPACE_MODES.includes(String(mode)))
+ usage(
+ `Unknown workspace mode ${mode}`,
+ "control-openhands workspace open qa-repo --mode new_worktree",
+ );
// A bare name resolves inside <run>/workspace, where fixtures live.
const inRun = join(run.dir, "workspace", name);
const path = !existsSync(name) && existsSync(inRun) ? inRun : name;
@@ -1863,7 +1875,28 @@ async function openWorkspace(run, name, { stay } = {}) {
selector: "testid=workspace-launch-button",
timeout: 30_000,
});
- return { workspace: want, steps: walked.steps };
+ // The mode selector (Local Repo / New Worktree) sits in the preview bar
+ // the launch click leaves behind.
+ let preview;
+ if (mode !== undefined) {
+ await browserCall(run, "click", {
+ selector: "testid=workspace-mode-selector",
+ timeout: 30_000,
+ });
+ await browserCall(run, "click", {
+ selector: `testid=workspace-mode-selector-option-${mode}`,
+ });
+ preview = (
+ await browserCall(run, "text", {
+ selector: "testid=home-git-control-bar-preview",
+ })
+ ).text;
+ }
+ return {
+ workspace: want,
+ steps: walked.steps,
+ ...(mode !== undefined ? { mode: String(mode), preview } : {}),
+ };
}
async function cmdWorkspace({ positional, flags }) {
@@ -1871,10 +1904,13 @@ async function cmdWorkspace({ positional, flags }) {
const [sub, path] = positional;
if (sub !== "open" || !path)
usage(
- "Usage: control-openhands workspace open PATH [--stay]",
+ "Usage: control-openhands workspace open PATH [--stay] [--mode local_repo|new_worktree]",
"control-openhands workspace open qa-repo # a name resolves in <run>/workspace",
);
- out({ ok: true, ...(await openWorkspace(run, path, { stay: flags.stay })) });
+ out({
+ ok: true,
+ ...(await openWorkspace(run, path, { stay: flags.stay, mode: flags.mode })),
+ });
}
async function cmdConversation({ positional, flags }) {
@@ -1892,6 +1928,7 @@ async function cmdConversation({ positional, flags }) {
if (flags.workspace && flags.workspace !== true)
picked = await openWorkspace(run, String(flags.workspace), {
stay: flags.stay,
+ mode: flags.mode,
});
else if (!flags["stay"]) await browserCall(run, "goto", { target: "/" });
// Home and conversation pages share the composer: a contenteditable
@@ -1961,19 +1998,6 @@ async function cmdConversation({ positional, flags }) {
if (sub === "events") {
if (!id) usage("conversation events <id> [--last N]");
const last = intFlag(flags.last, 25);
- const res = await http(
- run,
- "GET",
- `/api/conversations/${encodeURIComponent(id)}/events/search?limit=100&sort_order=${flags["from-start"] ? "TIMESTAMP" : "TIMESTAMP_DESC"}`,
- );
- if (!res.ok)
- throw new CliError(
- `events: HTTP ${res.status} ${res.text.slice(0, 200)}`,
- );
- const fetched = res.json?.items ?? [];
- const items = flags["from-start"]
- ? fetched.slice(0, last)
- : fetched.slice(0, last).reverse();
const grep =
flags.grep && flags.grep !== true
? String(flags.grep).toLowerCase()
@@ -1982,48 +2006,80 @@ async function cmdConversation({ positional, flags }) {
flags.kinds && flags.kinds !== true
? String(flags.kinds).split(",")
: null;
- const shown = items
- .filter((e) => !kinds || kinds.includes(e.kind))
- .map((e) => {
- const text = eventText(e);
- const max = flags.full ? 4000 : 160;
- const row = {
- kind: e.kind,
- source: e.source,
- tool: e.tool_name ?? e.action?.kind,
- text: text.slice(0, max),
- truncated: text.length > max || undefined,
- skills: e.activated_skills?.length ? e.activated_skills : undefined,
- tools: Array.isArray(e.tools)
- ? e.tools.map((tool) => tool.title || tool.name || tool.kind)
- : undefined,
- ts: e.timestamp,
- };
- if (grep) {
- // Search the whole event (system prompt, tool args, extended
- // content), not only the summarized text.
- const raw = JSON.stringify(e);
- const lower = raw.toLowerCase();
- const excerpts = [];
- let at = lower.indexOf(grep);
- let matches = 0;
- while (at >= 0) {
- matches += 1;
- if (excerpts.length < 3)
- excerpts.push(
- raw.slice(Math.max(0, at - 60), at + grep.length + 60),
- );
- at = lower.indexOf(grep, at + grep.length);
- }
- row.matches = matches;
- row.excerpts = excerpts.length ? excerpts : undefined;
+ // --kinds and --grep filter before --last counts: `--kinds MessageEvent
+ // --last 3` is the three newest messages. The server pages at 100
+ // events; pages are read until `last` matching rows are in hand
+ // (lib/events-paging.mjs), so a grep reaches past the newest page.
+ const keep = (e) =>
+ (!kinds || kinds.includes(e.kind)) &&
+ (!grep || JSON.stringify(e).toLowerCase().includes(grep));
+ const order = flags["from-start"] ? "TIMESTAMP" : "TIMESTAMP_DESC";
+ const {
+ items: fetched,
+ more,
+ pages,
+ } = await collectEvents(
+ async (pageId) => {
+ const res = await http(
+ run,
+ "GET",
+ `/api/conversations/${encodeURIComponent(id)}/events/search?limit=${PAGE_LIMIT}&sort_order=${order}${pageId ? `&page_id=${encodeURIComponent(pageId)}` : ""}`,
+ );
+ if (!res.ok)
+ throw new CliError(
+ `events: HTTP ${res.status} ${res.text.slice(0, 200)}`,
+ );
+ return res.json ?? {};
+ },
+ last,
+ keep,
+ );
+ const selected = fetched.filter(keep).slice(0, last);
+ const items = flags["from-start"] ? selected : selected.reverse();
+ const shown = items.map((e) => {
+ const text = eventText(e);
+ const max = flags.full ? 4000 : 160;
+ const row = {
+ kind: e.kind,
+ source: e.source,
+ tool: e.tool_name ?? e.action?.kind,
+ text: text.slice(0, max),
+ truncated: text.length > max || undefined,
+ skills: e.activated_skills?.length ? e.activated_skills : undefined,
+ images:
+ countImages(e.llm_message?.content ?? e.message?.content) ||
+ undefined,
+ tools: Array.isArray(e.tools)
+ ? e.tools.map((tool) => tool.title || tool.name || tool.kind)
+ : undefined,
+ ts: e.timestamp,
+ };
+ if (grep) {
+ // Search the whole event (system prompt, tool args, extended
+ // content), not only the summarized text.
+ const raw = JSON.stringify(e);
+ const lower = raw.toLowerCase();
+ const excerpts = [];
+ let at = lower.indexOf(grep);
+ let matches = 0;
+ while (at >= 0) {
+ matches += 1;
+ if (excerpts.length < 3)
+ excerpts.push(
+ raw.slice(Math.max(0, at - 60), at + grep.length + 60),
+ );
+ at = lower.indexOf(grep, at + grep.length);
}
- return row;
- })
- .filter((row) => !grep || row.matches > 0);
+ row.matches = matches;
+ row.excerpts = excerpts.length ? excerpts : undefined;
+ }
+ return row;
+ });
out({
ok: true,
total: fetched.length,
+ pages,
+ more,
count: shown.length,
events: shown,
});
@@ -2081,7 +2137,12 @@ async function cmdConversation({ positional, flags }) {
value: String(prompt),
});
await browserCall(run, "click", { selector: "testid=submit-button" });
- const result = { ok: true, id, sent: String(prompt).length };
+ const result = {
+ ok: true,
+ id,
+ prompt: String(prompt).slice(0, 160),
+ chars: String(prompt).length,
+ };
if (flags.wait)
Object.assign(
result,
@@ -2362,10 +2423,78 @@ async function cmdFixture({ positional, flags }) {
path,
`---\nname: ${skillName}\ndescription: QA fixture skill created by control-openhands.\n${trigger ? `triggers:\n- ${trigger}\n` : ""}---\n\n${body}\n`,
);
+ // --commit records the project skill in the fixture repo, which a New
+ // Worktree conversation checks out from its commits.
+ let committed;
+ if (flags.commit) {
+ if (!flags.repo)
+ usage(
+ "fixture skill --commit needs --repo NAME (a personal skill has no repo)",
+ "control-openhands fixture skill --repo qa-repo --name qa-ping --commit",
+ );
+ const gitEnv = {
+ ...process.env,
+ GIT_AUTHOR_NAME: "QA Fixture",
+ GIT_AUTHOR_EMAIL: "[email protected]",
+ GIT_COMMITTER_NAME: "QA Fixture",
+ GIT_COMMITTER_EMAIL: "[email protected]",
+ };
+ const message = `Add ${skillName} skill`;
+ const head = () =>
+ execFileSync("git", ["rev-parse", "HEAD"], { cwd: root })
+ .toString()
+ .trim();
+ try {
+ execFileSync(
+ "git",
+ ["add", "-A", "--", `.agents/skills/${skillName}`],
+ {
+ cwd: root,
+ env: gitEnv,
+ },
+ );
+ const pending = execFileSync(
+ "git",
+ ["status", "--porcelain", "--", `.agents/skills/${skillName}`],
+ { cwd: root, env: gitEnv },
+ )
+ .toString()
+ .trim();
+ if (pending) {
+ // Only the skill's path: whatever else is staged in the fixture
+ // repo (F08 stages files there) stays staged.
+ execFileSync(
+ "git",
+ [
+ "commit",
+ "-q",
+ "-m",
+ message,
+ "--",
+ `.agents/skills/${skillName}`,
+ ],
+ { cwd: root, env: gitEnv },
+ );
+ committed = { sha: head(), message };
+ } else {
+ // A re-run of the recipe: the skill is already in the history.
+ committed = { sha: head(), unchanged: true };
+ }
+ } catch (error) {
+ const reason =
+ error.stderr?.toString().trim().split("\n")[0] ||
+ String(error.message).split("\n")[0];
+ throw new CliError(`Could not commit the skill in ${root}: ${reason}`, {
+ code: 1,
+ hint: "The repo must be a git checkout (control-openhands fixture git-repo --name NAME).",
+ });
+ }
+ }
out({
ok: true,
path,
scope: flags.repo ? "project" : "user",
+ committed,
hint: "Reload the page: the skills list is cached.",
});
return;
@@ -2643,6 +2772,7 @@ async function cmdBrowser({ positional, flags }) {
result = await browserCall(run, "network", {
clear: Boolean(flags.clear),
external: Boolean(flags.external),
+ bodies: Boolean(flags.bodies),
last: flags.last,
filter:
flags.filter && flags.filter !== true ? flags.filter : undefined,
@@ -2712,6 +2842,8 @@ async function cmdBrowser({ positional, flags }) {
by: flags.by,
x: flags.x,
timeout,
+ observe: flags.observe,
+ observeMs: flags["observe-ms"],
});
break;
case "wait":
@@ -2815,6 +2947,7 @@ async function cmdBrowser({ positional, flags }) {
result = await browserCall(run, "wait-tab", {
pattern: rest[0],
timeout,
+ excludeActive: Boolean(flags.new),
});
break;
case "events":
@@ -2828,8 +2961,14 @@ async function cmdBrowser({ positional, flags }) {
result = await browserCall(run, "eval", { expression: rest[0] });
break;
case "tab":
- need(1, "control-openhands browser tab 1");
- result = await browserCall(run, "tab", { index: rest[0] });
+ need(1, "control-openhands browser tab 1 | tab new [/path]");
+ result =
+ rest[0] === "new"
+ ? await browserCall(run, "new-tab", {
+ target: rest[1],
+ allowExternal: Boolean(flags["allow-external"]),
+ })
+ : await browserCall(run, "tab", { index: rest[0] });
break;
case "close-tab":
need(1, "control-openhands browser close-tab 1");
@@ -3905,10 +4044,11 @@ Answers the telemetry consent form (analytics off by default) and then either
skips the onboarding modal (--skip) or walks it: choose agent → keep current LLM
settings → close at say-hello. Skipping is not proof that onboarding works.
`,
- conversation: `control-openhands conversation start --prompt TEXT [--wait] [--until STATES] [--timeout SEC] [--stay] [--workspace PATH]
+ conversation: `control-openhands conversation start --prompt TEXT [--wait] [--until STATES] [--timeout SEC] [--stay] [--workspace PATH [--mode local_repo|new_worktree]]
control-openhands conversation wait ID [--until finished,idle] [--timeout SEC] [--fresh]
(--fresh after sending a message: ignore the previous run's terminal status)
control-openhands conversation send ID --prompt TEXT [--wait] follow-up message through the composer
+ (prints the prompt it typed and its length in chars, then the wait's status with --wait)
control-openhands conversation pause ID arrange an interrupted conversation (API, as local Stop Runtime; not UI proof)
control-openhands conversation status ID
control-openhands conversation list
@@ -3916,13 +4056,18 @@ control-openhands conversation events ID [--last N] [--kinds MessageEvent,Action
[--grep TEXT] [--from-start]
(texts are cut at 160 chars with truncated:true; --full keeps up to 4000;
--grep searches whole events, e.g. the SystemPromptEvent with --from-start;
- rows show activated skills and, for the system prompt, the tool names)
+ rows show activated skills, image attachments (images: N) and, for the
+ system prompt, the tool names; --kinds and --grep filter before --last
+ counts (--kinds MessageEvent --last 3 is the three newest messages); the
+ server pages at 100 events and the verb reads pages until --last matching
+ rows are in hand: total is the number of events read, more:true says further
+ pages exist (older, or newer with --from-start))
'start' types into the home composer (testid=chat-input), presses
testid=submit-button and returns the new /conversations/<id>. --stay uses the
current page's composer instead of navigating home first. --workspace PATH
first picks that folder through Open Workspace (see 'workspace open'), so the
-conversation runs in it. 'wait' polls the
+conversation runs in it; --mode picks Local Repo or New Worktree there. 'wait' polls the
conversation's execution_status until one of --until (default: any terminal).
Examples:
@@ -3938,16 +4083,19 @@ control-openhands fixture folder [--name qa-folder]
control-openhands fixture image [--name qa-image] [--width 160 --height 96] # PNG under evidence/_fixtures
control-openhands fixture file [--name qa-note.txt] [--content TEXT]
control-openhands fixture tarball [--name qa-tarball] # evidence/_fixtures/qa-tarball.tar.gz (main.py prints pong)
-control-openhands fixture skill [--name qa-hello] [--repo qa-repo] [--trigger qa-ping] [--body TEXT]
- # SKILL.md in the run's private ~/.agents/skills, or in a fixture repo's .agents/skills
+control-openhands fixture skill [--name qa-hello] [--repo qa-repo] [--trigger qa-ping] [--body TEXT] [--commit]
+ # SKILL.md in the run's private ~/.agents/skills, or in a fixture repo's .agents/skills;
+ # --commit records it in the repo (a New Worktree conversation checks out commits only)
`,
- workspace: `control-openhands workspace open PATH|NAME [--stay]
+ workspace: `control-openhands workspace open PATH|NAME [--stay] [--mode local_repo|new_worktree]
NAME (no slash) resolves inside <run>/workspace, where 'fixture' creates repos.
Drives Home > Open Workspace > workspace dropdown > + Add Workspace, walks the
folder browser (folder-browser-up / folder-browser-entry-<name>) to PATH,
-clicks Use and Launch. The composer then carries the workspace chip; follow
+clicks Use and Launch, then with --mode picks Local Repo or New Worktree in the
+preview bar's mode selector (printed back as mode and preview). The composer then
+carries the workspace chip; follow
with 'conversation start --stay', or use 'conversation start --workspace PATH'.
Example:
@@ -3978,6 +4126,7 @@ Verbs
fill|type <sel> [<value> | --value-file F | --value-env VAR] (prefer the file/env forms for keys)
press <Key> [--selector S] e.g. Escape, Enter, Control+k, Meta+k
select <sel> <value> | upload <sel> <file...> | scroll [<sel>] [--by PX] [--x PX]
+ [--observe SEL [--observe-ms 3000]] (scroll: record what SEL shows while the effects play out, e.g. a loading row)
upload-via <trigger-sel> <file...> click a button/menu item and answer the real file chooser
drop-files <sel> <file...> [--stage enter|over] files dragged in from the desktop
paste <sel> [--text T] [--file F]... a paste event carrying text and/or files
@@ -3997,13 +4146,18 @@ Verbs
(--clear prints the list, then empties it: run it before the action)
events [--kinds pageerror,dialog,download] [--last N]
eval <js expression> read-only inspection; never mutate app state with it
- tabs | tab <i> | close-tab <i> | dialogs [--policy accept|dismiss]
- wait-tab <url-regex> [--timeout MS] wait for a pop-up (window.open) whose URL matches; prints its index
+ tabs | tab <i> | tab new [/path] [--allow-external] | close-tab <i> | dialogs [--policy accept|dismiss]
+ (tab new: a plain second tab, no opener and no sessionStorage, as a user opening the app again)
+ wait-tab <url-regex> [--timeout MS] [--new] wait for a pop-up (window.open) whose URL matches; prints its index
+ (--new ignores the tab the daemon is on, for a second tab at the current URL)
downloads [--last N] [--inspect] [--contains TEXT] saved files; --inspect adds a text head or zip entry names
storage [--session] [--values] localStorage (or sessionStorage) keys; values only on request
(keys, tokens and secrets inside values are redacted)
media [--clear] media playback recorded since load (sound features)
- network [--external] [--filter REGEX] [--clear] [--last N] requests with status and redacted query (rows under "recent")
+ network [--external] [--filter REGEX] [--clear] [--last N] [--bodies] requests with status and redacted query (rows under "recent")
+ (--bodies adds each app-origin write's body, JSON with credential values and env/header maps
+ replaced by their length, URL userinfo and secret-named query values redacted in any string;
+ the settings API's ********** placeholder is kept as is)
(privacy/telemetry checks; --clear as for errors)
toasts [--history [--clear]] toasts on screen now (with links); --history adds every
status/alert text seen since this page loaded
diff --git a/.agents/skills/verify-openhands/scripts/control-openhands.test.mjs b/.agents/skills/verify-openhands/scripts/control-openhands.test.mjs
index d6c2bee6c3..eb042cbb92 100755
--- a/.agents/skills/verify-openhands/scripts/control-openhands.test.mjs
+++ b/.agents/skills/verify-openhands/scripts/control-openhands.test.mjs
@@ -36,6 +36,8 @@ import { routePattern } from "./lib/route-pattern.mjs";
import { resolveTestids } from "./lib/testids.mjs";
import { tmuxPathFor } from "./lib/tmux-path.mjs";
import { browserCallLimit } from "./lib/call-limit.mjs";
+import { MAX_PAGES, collectEvents, countImages } from "./lib/events-paging.mjs";
+import { redactBody, redactUrl } from "./lib/network-bodies.mjs";
import { buildLocator, parseRole, toCss } from "./lib/selectors.mjs";
const here = dirname(fileURLToPath(import.meta.url));
@@ -1081,3 +1083,352 @@ test("map baseline reads the index line, and map affected starts from it by defa
});
assert.match(help.stdout, /map baseline \[--set TARGET \[--force\]\]/);
});
+
+test("request bodies are shown with credentials and env maps redacted", () => {
+ // A stored secret sent behind its placeholder must stay recognizable as
+ // the placeholder; a real value shows only its length.
+ const body = redactBody(
+ JSON.stringify({
+ name: "qa_vault",
+ command: "/bin/sh",
+ env: { QA_VAULT_TOKEN: "qa-vault-secret-000", QA_NODE: "**********" },
+ api_key: "sk-abcdef",
+ headers: { Authorization: "Bearer x" },
+ nested: { session_api_key: "k", plain: "kept" },
+ list: [{ token: "t" }],
+ }),
+ );
+ const parsed = JSON.parse(body);
+ assert.equal(parsed.name, "qa_vault");
+ assert.equal(parsed.command, "/bin/sh");
+ assert.equal(parsed.env.QA_VAULT_TOKEN, "<redacted 19 chars>");
+ assert.equal(parsed.env.QA_NODE, "**********");
+ assert.equal(parsed.api_key, "<redacted 9 chars>");
+ assert.equal(parsed.headers.Authorization, "<redacted 8 chars>");
+ assert.equal(parsed.nested.session_api_key, "<redacted 1 chars>");
+ assert.equal(parsed.nested.plain, "kept");
+ assert.equal(parsed.list[0].token, "<redacted 1 chars>");
+ // Form bodies redact by key; anything else is described, never shown.
+ assert.equal(redactBody("a=1&api_key=zzz"), "a=1&api_key=%3Credacted%3E");
+ assert.equal(redactBody("--boundary\r\nraw"), "<non-JSON body, 15 chars>");
+ // Secrets inside arrays, under a credential-named key, or at the top level
+ // of a credential endpoint's payload never come back in clear.
+ assert.deepEqual(
+ JSON.parse(
+ redactBody(
+ JSON.stringify({
+ env: ["TOKEN=abc123"],
+ api_keys: ["sk-live-1"],
+ credentials: { value: "p4ss", nested: ["x"] },
+ values: ["kept"],
+ }),
+ ),
+ ),
+ {
+ env: ["<redacted 12 chars>"],
+ api_keys: ["<redacted 9 chars>"],
+ credentials: {
+ value: "<redacted 4 chars>",
+ nested: ["<redacted 1 chars>"],
+ },
+ values: ["kept"],
+ },
+ );
+ assert.equal(
+ redactBody(JSON.stringify("hunter2"), { all: true }),
+ '"<redacted 7 chars>"',
+ );
+ assert.equal(
+ redactBody(JSON.stringify(["hunter2"]), { all: true }),
+ '["<redacted 7 chars>"]',
+ );
+ assert.equal(
+ redactBody("grant_type=x&code=SECRET", { all: true }),
+ "grant_type=%3Credacted%3E&code=%3Credacted%3E",
+ );
+ // A credential endpoint redacts every string, whatever the field is called.
+ assert.deepEqual(
+ JSON.parse(
+ redactBody(JSON.stringify({ name: "X", value: "v" }), { all: true }),
+ ),
+ { name: "<redacted 1 chars>", value: "<redacted 1 chars>" },
+ );
+ assert.equal(redactBody(""), undefined);
+ assert.equal(redactBody(null), undefined);
+ assert.match(
+ redactBody(JSON.stringify({ t: "x".repeat(5000) }), { limit: 50 }),
+ /…$/,
+ );
+});
+
+test("credentials carried by a URL are redacted whatever key holds the URL", () => {
+ // The MCP editor sends a remote server's URL as typed, under `server.url`
+ // (POST /api/v1/mcp/test) or `url` (a settings save): a key or a basic-auth
+ // pair the user put in the URL must not come back in clear. The rest of
+ // the URL is kept as written, so the row still proves the endpoint sent.
+ const probe = JSON.parse(
+ redactBody(
+ JSON.stringify({
+ server: {
+ type: "http",
+ url: "https://example.invalid/mcp?api_key=DUMMY_URL_API_KEY",
+ headers: { "X-Api-Key": "dummy-header-key" },
+ },
+ name: "qa-remote",
+ timeout: 30,
+ }),
+ ),
+ );
+ assert.equal(
+ probe.server.url,
+ "https://example.invalid/mcp?api_key=<redacted 17 chars>",
+ );
+ assert.equal(probe.server.headers["X-Api-Key"], "<redacted 16 chars>");
+ assert.equal(probe.name, "qa-remote");
+ const save = JSON.parse(
+ redactBody(
+ JSON.stringify({
+ name: "qa-sse",
+ type: "sse",
+ url: "https://qa:[email protected]/sse?v=2&Token=t0k#frag",
+ description: "docs at https://docs.example.invalid/sse?page=1",
+ }),
+ ),
+ );
+ assert.equal(
+ save.url,
+ "https://<redacted 2 chars>:<redacted 9 chars>@example.invalid/sse?v=2&Token=<redacted 3 chars>#frag",
+ );
+ assert.equal(
+ save.description,
+ "docs at https://docs.example.invalid/sse?page=1",
+ );
+ // A URL inside prose (a prompt naming a server) is treated the same; the
+ // settings API's placeholder stays recognizable inside a URL too.
+ assert.equal(
+ JSON.parse(
+ redactBody(JSON.stringify({ content: "use https://u:p@h/x now" })),
+ ).content,
+ "use https://<redacted 1 chars>:<redacted 1 chars>@h/x now",
+ );
+ assert.equal(
+ redactUrl("https://user:**********@example.invalid/mcp"),
+ "https://<redacted 4 chars>:**********@example.invalid/mcp",
+ );
+ assert.equal(
+ redactUrl("https://[email protected]/mcp?secret%5Fid=s&q=kept"),
+ "https://<redacted 6 chars>@example.invalid/mcp?secret%5Fid=<redacted 1 chars>&q=kept",
+ );
+ // An unencoded `@` in a password belongs to the password: the userinfo
+ // ends at the last `@` before the path, as `new URL()` reads it.
+ assert.equal(
+ redactUrl("https://user:p@[email protected]/mcp"),
+ "https://<redacted 4 chars>:<redacted 8 chars>@example.invalid/mcp",
+ );
+ assert.equal(
+ redactUrl("https://host/path?email=a@b&token=t&next=https://u:pw@other/"),
+ "https://host/path?email=a@b&token=<redacted 1 chars>&next=https://<redacted 1 chars>:<redacted 2 chars>@other/",
+ );
+ assert.equal(
+ redactUrl("http://example.invalid/mcp"),
+ "http://example.invalid/mcp",
+ );
+ assert.equal(redactUrl("a:b@c mailto:x@y"), "a:b@c mailto:x@y");
+ // A form body's URL values go through the same redaction.
+ assert.equal(
+ new URLSearchParams(
+ redactBody("name=x&url=https%3A%2F%2Fu%3Ap%40h%2Fmcp%3Fkey%3Dk"),
+ ).get("url"),
+ "https://<redacted 1 chars>:<redacted 1 chars>@h/mcp?key=<redacted 1 chars>",
+ );
+});
+
+test("conversation events reads pages until the rows asked for are in hand", async () => {
+ const pages = {
+ undefined: { items: [1, 2, 3], next_page_id: "p2" },
+ p2: { items: [4, 5], next_page_id: "p3" },
+ p3: { items: [6], next_page_id: null },
+ };
+ const calls = [];
+ const fetchPage = async (id) => {
+ calls.push(id);
+ return pages[id];
+ };
+ // Enough rows after one page: no second request.
+ assert.deepEqual(await collectEvents(fetchPage, 3), {
+ items: [1, 2, 3],
+ more: true,
+ pages: 1,
+ });
+ calls.length = 0;
+ // More rows than one page holds: follow next_page_id, stop at the end.
+ assert.deepEqual(await collectEvents(fetchPage, 500), {
+ items: [1, 2, 3, 4, 5, 6],
+ more: false,
+ pages: 3,
+ });
+ assert.deepEqual(calls, [undefined, "p2", "p3"]);
+ // A page without items or a missing body ends the walk cleanly.
+ assert.deepEqual(await collectEvents(async () => undefined, 10), {
+ items: [],
+ more: false,
+ pages: 1,
+ });
+ // A filter counts only the rows that pass it, so a kind that is rare keeps
+ // the walk going; a server that never ends paging stops at MAX_PAGES.
+ const mixed = async (id) => ({
+ items: [{ kind: "State" }, { kind: "State" }, { kind: "Message" }],
+ next_page_id:
+ id === "p3" ? null : `p${(Number(String(id).slice(1)) || 1) + 1}`,
+ });
+ const filtered = await collectEvents(mixed, 3, (e) => e.kind === "Message");
+ assert.equal(filtered.pages, 3);
+ assert.equal(filtered.items.filter((e) => e.kind === "Message").length, 3);
+ const endless = await collectEvents(
+ async () => ({ items: [{ kind: "x" }], next_page_id: "again" }),
+ 1000,
+ );
+ assert.equal(endless.pages, MAX_PAGES);
+ assert.equal(endless.more, true);
+});
+
+test("image attachments are counted from a message's content blocks", () => {
+ assert.equal(countImages("plain text"), 0);
+ assert.equal(countImages(undefined), 0);
+ assert.equal(
+ countImages([
+ { type: "text", text: " " },
+ { type: "image", image_urls: ["data:image/png;base64,AAAA", "data:x"] },
+ { type: "image" },
+ ]),
+ 3,
+ );
+});
+
+test("help documents the observe, bodies, tab, mode and commit additions", () => {
+ const browser = spawnSync(process.execPath, [cli, "help", "browser"], {
+ encoding: "utf8",
+ }).stdout;
+ assert.match(
+ browser,
+ /scroll \[<sel>\] \[--by PX\] \[--x PX\]\n\s+\[--observe SEL/,
+ );
+ assert.match(browser, /network .*\[--bodies\]/);
+ assert.match(browser, /tab new \[\/path\]/);
+ assert.match(browser, /wait-tab <url-regex> \[--timeout MS\] \[--new\]/);
+ const conversation = spawnSync(
+ process.execPath,
+ [cli, "help", "conversation"],
+ { encoding: "utf8" },
+ ).stdout;
+ assert.match(conversation, /images: N/);
+ assert.match(conversation, /more:true/);
+ assert.match(conversation, /prints the prompt it typed/);
+ const fixture = spawnSync(process.execPath, [cli, "help", "fixture"], {
+ encoding: "utf8",
+ }).stdout;
+ assert.match(fixture, /fixture skill .*\[--commit\]/);
+ const workspace = spawnSync(process.execPath, [cli, "help", "workspace"], {
+ encoding: "utf8",
+ }).stdout;
+ assert.match(
+ workspace,
+ /workspace open PATH\|NAME \[--stay\] \[--mode local_repo\|new_worktree\]/,
+ );
+});
+
+test("fixture skill --commit records the project skill once and reports a re-run", () => {
+ // A stopped run directory is enough for fixtures: they only need run.json.
+ const dir = mkdtempSync(join(tmpdir(), "cov-run-"));
+ mkdirSync(join(dir, "private"));
+ writeFileSync(join(dir, "private", "session-key"), "x".repeat(64));
+ writeFileSync(
+ join(dir, "run.json"),
+ JSON.stringify({
+ baseUrl: "http://127.0.0.1:9",
+ ports: { ingress: 9 },
+ launcherPgid: 0,
+ }),
+ );
+ const env = { OH_VERIFY_RUN: dir };
+ assert.equal(run(["fixture", "git-repo", "--name", "qa-t"], env).status, 0);
+ const first = run(
+ [
+ "fixture",
+ "skill",
+ "--repo",
+ "qa-t",
+ "--name",
+ "qa-t-skill",
+ "--trigger",
+ "qa-t-ping",
+ "--commit",
+ ],
+ env,
+ );
+ assert.equal(first.status, 0, first.stdout);
+ assert.equal(first.json.scope, "project");
+ assert.match(first.json.committed.sha, /^[0-9a-f]{40}$/);
+ assert.equal(first.json.committed.message, "Add qa-t-skill skill");
+ const log = spawnSync(
+ "git",
+ ["-C", join(dir, "workspace", "qa-t"), "log", "--format=%s"],
+ {
+ encoding: "utf8",
+ },
+ )
+ .stdout.trim()
+ .split("\n");
+ assert.deepEqual(log, ["Add qa-t-skill skill", "Initial fixture commit"]);
+ // The same command again changes nothing and says so.
+ const again = run(
+ [
+ "fixture",
+ "skill",
+ "--repo",
+ "qa-t",
+ "--name",
+ "qa-t-skill",
+ "--trigger",
+ "qa-t-ping",
+ "--commit",
+ ],
+ env,
+ );
+ assert.equal(again.status, 0, again.stdout);
+ assert.equal(again.json.committed.sha, first.json.committed.sha);
+ assert.equal(again.json.committed.unchanged, true);
+ // Only the skill's path is committed: a file staged beforehand stays staged.
+ const repo = join(dir, "workspace", "qa-t");
+ writeFileSync(join(repo, "other.txt"), "staged elsewhere\n");
+ spawnSync("git", ["-C", repo, "add", "other.txt"]);
+ const third = run(
+ ["fixture", "skill", "--repo", "qa-t", "--name", "qa-v", "--commit"],
+ env,
+ );
+ assert.equal(third.status, 0, third.stdout);
+ const files = spawnSync(
+ "git",
+ ["-C", repo, "show", "--name-only", "--format=", "HEAD"],
+ { encoding: "utf8" },
+ ).stdout.trim();
+ assert.equal(files, ".agents/skills/qa-v/SKILL.md");
+ const staged = spawnSync(
+ "git",
+ ["-C", repo, "diff", "--cached", "--name-only"],
+ {
+ encoding: "utf8",
+ },
+ ).stdout.trim();
+ assert.equal(staged, "other.txt");
+ // Without --commit nothing is recorded; a personal skill cannot be committed.
+ const plain = run(
+ ["fixture", "skill", "--repo", "qa-t", "--name", "qa-u"],
+ env,
+ );
+ assert.equal(plain.status, 0);
+ assert.equal(plain.json.committed, undefined);
+ const personal = run(["fixture", "skill", "--name", "qa-p", "--commit"], env);
+ assert.equal(personal.status, 2);
+ assert.match(personal.json.error, /needs --repo/);
+});
diff --git a/.agents/skills/verify-openhands/scripts/lib/events-paging.mjs b/.agents/skills/verify-openhands/scripts/lib/events-paging.mjs
new file mode 100644
index 0000000000..875146be15
--- /dev/null
+++ b/.agents/skills/verify-openhands/scripts/lib/events-paging.mjs
@@ -0,0 +1,39 @@
+// Paging for `conversation events`.
+//
+// The Agent Server's events/search answers at most 100 events per page and
+// rejects a larger limit, so a conversation longer than that is read page by
+// page (`next_page_id`) until `want` rows that pass `keep` (a kind or grep
+// filter) are in hand or the pages run out. `fetchPage(pageId)` returns
+// one page `{ items, next_page_id }`; every event read is returned, the
+// caller filters and slices.
+
+export const PAGE_LIMIT = 100;
+export const MAX_PAGES = 200;
+
+export async function collectEvents(fetchPage, want, keep = () => true) {
+ const items = [];
+ let pageId;
+ let pages = 0;
+ let kept = 0;
+ do {
+ const page = (await fetchPage(pageId)) ?? {};
+ pages += 1;
+ const got = Array.isArray(page.items) ? page.items : [];
+ items.push(...got);
+ kept += got.filter(keep).length;
+ pageId = page.next_page_id ?? null;
+ } while (pageId && kept < want && pages < MAX_PAGES);
+ return { items, more: Boolean(pageId), pages };
+}
+
+// Image attachments in an LLM message's content blocks; `conversation events`
+// rows show only text, so an image-only message would otherwise read blank.
+export function countImages(content) {
+ if (!Array.isArray(content)) return 0;
+ let count = 0;
+ for (const block of content) {
+ if (!block || typeof block !== "object" || block.type !== "image") continue;
+ count += Array.isArray(block.image_urls) ? block.image_urls.length : 1;
+ }
+ return count;
+}
diff --git a/.agents/skills/verify-openhands/scripts/lib/network-bodies.mjs b/.agents/skills/verify-openhands/scripts/lib/network-bodies.mjs
new file mode 100644
index 0000000000..2bd507f8aa
--- /dev/null
+++ b/.agents/skills/verify-openhands/scripts/lib/network-bodies.mjs
@@ -0,0 +1,113 @@
+// Request bodies for `browser network --bodies`, with secrets taken out.
+//
+// The daemon keeps the body of every app-origin write request it sees, so a
+// recipe can prove what the page sent (an edited field, a stored secret
+// reused behind its placeholder) without a mock. Nothing secret survives the
+// redaction: everything under a key that names a credential or an `env` or
+// `headers` map (strings, nested objects, arrays) is replaced by its length;
+// the settings API's own `**********` placeholder is kept, so a recipe can
+// tell "the placeholder was sent" from "a real value was sent". A URL in any
+// other string (an MCP server's `url`, a prompt) keeps its host and path but
+// loses its userinfo and the values of its secret-named query parameters.
+
+// Matched as a substring, so a non-secret key such as `design` (sig),
+// `keyboard` (key) or `bypass` (pass) reads `<redacted N chars>` too; over-
+// redaction is the safe side. Shared with the daemon's query redaction.
+export const SECRET_KEY = /key|token|secret|auth|pass|session|sig|credential/i;
+const SECRET_MAP = /^(env|headers|environment)$/i;
+export const PLACEHOLDER = "**********";
+export const BODY_LIMIT = 2000;
+
+export function redactBodyValue(value) {
+ if (typeof value !== "string" || value === "" || value === PLACEHOLDER)
+ return value;
+ return `<redacted ${value.length} chars>`;
+}
+
+// A URL carries credentials of its own, under no key at all: the userinfo
+// of `https://user:pw@host/` and the values of `?api_key=…`-style query
+// parameters (the MCP editor sends a server's `url` as typed, so a key the
+// user put in the URL would otherwise come back in clear). Both are redacted
+// in place, the rest of the URL kept as written (no normalization), so the
+// row still proves which endpoint was sent. The userinfo ends at the last
+// `@` before the path, as the URL parser reads it, so an unencoded `@` in
+// a password is part of the password, not the start of the host.
+const URL_IN_TEXT = /\b[a-z][a-z0-9+.-]*:\/\/[^\s"'<>`]+/gi;
+const USERINFO = /^([a-z][a-z0-9+.-]*:\/\/)([^/?#]*)@/i;
+
+export function redactUrl(url) {
+ let out = url.replace(USERINFO, (m, scheme, userinfo) => {
+ const at = userinfo.indexOf(":");
+ const parts =
+ at < 0 ? [userinfo] : [userinfo.slice(0, at), userinfo.slice(at + 1)];
+ return `${scheme}${parts.map(redactBodyValue).join(":")}@`;
+ });
+ const q = out.indexOf("?");
+ if (q < 0) return out;
+ const hash = out.indexOf("#", q);
+ const query = hash < 0 ? out.slice(q + 1) : out.slice(q + 1, hash);
+ const pairs = query.split("&").map((pair) => {
+ const eq = pair.indexOf("=");
+ if (eq < 0) return pair;
+ const key = pair.slice(0, eq);
+ let name = key;
+ try {
+ name = decodeURIComponent(key);
+ } catch {
+ // keep the raw key
+ }
+ const value = pair.slice(eq + 1);
+ return `${key}=${SECRET_KEY.test(name) ? redactBodyValue(value) : redactUrlsIn(value)}`;
+ });
+ return `${out.slice(0, q + 1)}${pairs.join("&")}${hash < 0 ? "" : out.slice(hash)}`;
+}
+
+export function redactUrlsIn(text) {
+ return text.replace(URL_IN_TEXT, redactUrl);
+}
+
+// `secret` is inherited by the whole subtree: a string in an array under
+// `api_keys`, an object under `credentials`, every value of an `env` map.
+function redactNode(node, secret = false) {
+ if (typeof node === "string")
+ return secret ? redactBodyValue(node) : redactUrlsIn(node);
+ if (Array.isArray(node)) return node.map((v) => redactNode(v, secret));
+ if (node && typeof node === "object") {
+ const out = {};
+ for (const [key, value] of Object.entries(node))
+ out[key] = redactNode(
+ value,
+ secret || SECRET_KEY.test(key) || SECRET_MAP.test(key),
+ );
+ return out;
+ }
+ return node;
+}
+
+// Returns the body as the page sent it, JSON re-serialized after redaction,
+// cut at `limit` characters; a body that is not JSON is described, not shown.
+// `all` redacts every string value, for endpoints whose whole payload is a
+// credential (secrets, login, tokens) whatever the field names.
+export const SECRET_PATH = /secret|credential|api-key|apikey|auth|login|token/i;
+
+export function redactBody(text, { limit = BODY_LIMIT, all = false } = {}) {
+ if (text === undefined || text === null || text === "") return undefined;
+ const raw = String(text);
+ let shown;
+ try {
+ shown = JSON.stringify(redactNode(JSON.parse(raw), all));
+ } catch {
+ if (/^[^=&\s]+=[^&]*(&[^=&\s]+=[^&]*)*$/.test(raw)) {
+ const params = new URLSearchParams();
+ for (const [key, value] of new URLSearchParams(raw))
+ params.append(
+ key,
+ all || SECRET_KEY.test(key) ? "<redacted>" : redactUrlsIn(value),
+ );
+ shown = params.toString();
+ } else {
+ return `<non-JSON body, ${raw.length} chars>`;
+ }
+ }
+ return shown.length > limit ? `${shown.slice(0, limit)}…` : shown;
+}