Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .agents/skills/verify-agent-server/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: >
WebSocket API like an agent would", "drive the agent-server", "check an API
change against a real server", "create or update the agent-server feature
map", or "run the weekly API audit". Ships control-agent-server (launch,
doctor, api, ws, llm, conversations, fixtures, exec, evidence, map) and the
doctor, api, ws, llm, conversations, fixtures, exec, assert, evidence, map) and the
maintained map of every agent-facing feature.
triggers:
- /verify-agent-server
Expand Down Expand Up @@ -178,7 +178,10 @@ missing prerequisite; never substitute a mock and call it a pass.
with the same flags and fixtures:
`control-agent-server map run --file Fnn --only Fnn.x --fresh --repeat 2 --checkout <base worktree>`
must report the bullet `xfail` in both attempts, and the same command
without `--checkout` (the fix) `xpass` in both. Then drop the marker in the
without `--checkout` (the fix) `xpass` in both. `xfail` means the marked
command failed with the failure its `# bug: PREDICATE` documents (see
[the marker contract](references/mapping.md)); any other failure on the
baseline is a `fail`, so the proof cannot rest on an unrelated error. Then drop the marker in the
same PR. Baseline not reproducing twice means "inconclusive", never
"fixed". `--only` rejects unknown IDs and also runs each selected recipe's
transitive `Requires:` prerequisites in family order.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ Preconditions:
control-agent-server exec --run "$PREFIXED" --save F02.workspace-cookie-root-path/mint -- bash "$F02/jar.sh" POST /qa-f02-prefix/api/auth/workspace-session key 204
grep -q oh_workspace_session_key "$PREFIXED/fixtures/qa-f02-cookies.txt"
control-agent-server exec --run "$PREFIXED" -- bash "$F02/jar.sh" GET "/api/conversations/$PCID/workspace/qa-f02.html" nokey 200 'has:qa-f02-workspace-file'
control-agent-server exec --run "$PREFIXED" --save F02.workspace-cookie-root-path/file-with-cookie -- bash "$F02/jar.sh" GET "/qa-f02-prefix/api/conversations/$PCID/workspace/qa-f02.html" nokey 200 'has:qa-f02-workspace-file' # bug
control-agent-server exec --run "$PREFIXED" --save F02.workspace-cookie-root-path/file-with-cookie -- bash "$F02/jar.sh" GET "/qa-f02-prefix/api/conversations/$PCID/workspace/qa-f02.html" nokey 200 'has:qa-f02-workspace-file' # bug: exit_code eq 1 && stdout_tail contains status=401
control-agent-server stop --run "$PREFIXED"
```
The server advertises `servers: [{"url": "/qa-f02-prefix"}]` and serves
Expand All @@ -506,7 +506,7 @@ Preconditions:
control-agent-server api POST /api/auth/workspace-session --header 'Host: localhost:8000' --expect 204 \
--check-header set-cookie contains Secure --check-header set-cookie contains Partitioned
control-agent-server api POST /api/auth/workspace-session --header 'Host: [::1]:8000' --expect 204 --save F02.workspace-session-ipv6-loopback/ipv6-host \
--check-header set-cookie contains SameSite=none --check-header set-cookie contains Secure --check-header set-cookie contains Partitioned # bug
--check-header set-cookie contains SameSite=none --check-header set-cookie contains Secure --check-header set-cookie contains Partitioned # bug: status eq 204 && checks.0.actual contains SameSite=none && checks.1.actual not-contains Secure
```
`127.0.0.1` and `localhost` get `Secure; Partitioned`. Expected: the
`Host: [::1]:8000` mint gets them too, since `::1` is in the server's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ Preconditions:
--expect 200 --check-header access-control-allow-origin eq http://localhost:3000
control-agent-server api OPTIONS /api/settings --auth none --header 'Origin: https://qa-f03-other.example' --header 'Access-Control-Request-Method: GET' \
--expect 400 --check-header access-control-allow-origin missing
control-agent-server api OPTIONS /api/settings --auth none --header 'Origin: https://qa-f03.example' --header 'Access-Control-Request-Method: GET' --expect 200 --check-header access-control-allow-origin eq https://qa-f03.example --save F03.init-delivered-cors-origins/preflight # bug
control-agent-server api OPTIONS /api/settings --auth none --header 'Origin: https://qa-f03.example' --header 'Access-Control-Request-Method: GET' --expect 200 --check-header access-control-allow-origin eq https://qa-f03.example --save F03.init-delivered-cors-origins/preflight # bug: status eq 400 && response.body contains 'Disallowed CORS origin'
```
The localhost preflight is allowed (the always-on allowlist, positive
control) and an origin nobody delivered is refused with 400 (the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,11 @@ EOF
--json "{\"workspace\": {\"working_dir\": \"$W\"}, \"agent\": $STUB_AGENT, \"autotitle\": false, \"initial_message\": {\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"QA F04 run false.\"}], \"run\": false}}" \
--expect 201 --save F04.create-initial-message-run-false/start --field id)
control-agent-server conversation events "$NR" --kinds MessageEvent --contains 'QA F04 run false.' --expect-count 1
if control-agent-server conversation wait "$NR" --until running,finished,error,stuck --timeout 15; then false; fi # bug
control-agent-server api GET "/api/conversations/$NR" --check execution_status eq idle --save F04.create-initial-message-run-false/get
sleep 15; control-agent-server api GET "/api/conversations/$NR" --check execution_status eq idle --save F04.create-initial-message-run-false/get # bug: response.body.execution_status matches '^(running|finished)$'
control-agent-server conversation events "$NR" --kinds ActionEvent --expect-count 0
```
Expected: the message is recorded and the conversation stays `idle` until
a `run` (no agent action). Today the wait sees `finished` within a second:
a `run` (no agent action). Today it is `finished` within a second:
`start_conversation` sends the initial message with `run=False` and then
always calls `event_service.run()`, never reading `initial_message.run`
(whose default is `false`). The fix may instead remove the field from the
Expand Down Expand Up @@ -398,7 +397,7 @@ EOF
Requires: `F04.create-secrets`
```sh
control-agent-server api GET "/api/conversations/$SECID" --expect 200 \
--check secret_registry.secret_sources.QA_F04_TOKEN.kind eq StaticSecret --save F04.create-secrets-get/get # bug
--check secret_registry.secret_sources.QA_F04_TOKEN.kind eq StaticSecret --save F04.create-secrets-get/get # bug: status eq 200 && response.body.secret_registry.secret_sources exists && checks.0.actual eq null
```
Expected: the GET lists `QA_F04_TOKEN` like the create response did. Today
it returns `{"secret_sources": {}}`: start-time secrets are applied to the
Expand All @@ -411,7 +410,7 @@ EOF
```sh
control-agent-server api POST /api/conversations \
--json "{\"workspace\": {\"working_dir\": \"$W\"}, \"agent\": $OFFLINE_AGENT, \"autotitle\": false, \"secrets\": {\"QA_F04_PLAIN\": \"qa-f04-plain-value\"}}" \
--expect 201,422 --save F04.create-secrets-plain/start # bug
--expect 201,422 --save F04.create-secrets-plain/start # bug: status eq 500 && response.body.exception contains "'str' object has no attribute 'pop'"
```
Today the server answers 500 `"exception": "'str' object has no attribute
'pop'"`: `DiscriminatedUnionMixin` calls `.pop("kind")` on the string, an
Expand Down Expand Up @@ -512,7 +511,7 @@ EOF
limits a batch to 99 ids.
```sh
IDS100=$(python3 -c 'import uuid; print(",".join(str(uuid.uuid4()) for _ in range(100)))')
control-agent-server exec --expect-output QA_BATCH_OK --save F04.batch-get-limit/hundred -- python3 "$F/qa-f04-batch.py" "$IDS100" 400,422 # bug
control-agent-server exec --expect-output QA_BATCH_OK --save F04.batch-get-limit/hundred -- python3 "$F/qa-f04-batch.py" "$IDS100" 400,422 # bug: exit_code eq 1 && stdout_tail contains '"status": 500'
```
Expected: a 4xx that names the limit. Today it is 500 with an empty
`exception`: the limit is a bare `assert len(ids) < 100` in
Expand Down Expand Up @@ -612,7 +611,7 @@ EOF
Requires: `F04.create-parent`
```sh
control-agent-server api PATCH "/api/conversations/$CHILD" --json '{"title": "QA F04 child"}' --check success eq true
control-agent-server api PATCH "/api/conversations/$CHILD" --json '{"title": " "}' --expect 422 --save F04.patch-whitespace-title/patch # bug
control-agent-server api PATCH "/api/conversations/$CHILD" --json '{"title": " "}' --expect 422 --save F04.patch-whitespace-title/patch # bug: status eq 200 && response.body.success eq true
control-agent-server api GET "/api/conversations/$CHILD" --check title eq 'QA F04 child'
```
Expected: 422 (like an empty title) and the title kept. Today `min_length=1`
Expand All @@ -623,7 +622,7 @@ EOF
```sh
control-agent-server api GET /openapi.json --check 'paths./api/conversations/{conversation_id}.patch.responses.404' exists --quiet
control-agent-server api GET "/api/conversations/$NOPE" --expect 404
control-agent-server api PATCH "/api/conversations/$NOPE" --json '{"title": "QA nobody"}' --expect 404 --save F04.patch-unknown-id/unknown # bug
control-agent-server api PATCH "/api/conversations/$NOPE" --json '{"title": "QA nobody"}' --expect 404 --save F04.patch-unknown-id/unknown # bug: status eq 200 && response.body.success eq false
```
Expected: 404, as declared. Today it is 200 `{"success": false}`: the
handler turns a `False` from `update_conversation` into a successful
Expand Down Expand Up @@ -675,8 +674,8 @@ EOF
control-agent-server api GET /openapi.json --check 'paths./api/conversations/{conversation_id}.delete.responses.404' exists --quiet
control-agent-server api GET "/api/conversations/$DEL" --expect 404
control-agent-server api GET "/api/conversations/$NOPE" --expect 404
control-agent-server api DELETE "/api/conversations/$NOPE" --expect 404 --save F04.delete-unknown-id/unknown # bug
control-agent-server api DELETE "/api/conversations/$DEL" --expect 404 --save F04.delete-unknown-id/repeat # bug
control-agent-server api DELETE "/api/conversations/$NOPE" --expect 404 --save F04.delete-unknown-id/unknown # bug: status eq 400 && response.body.detail eq 'Bad Request'
control-agent-server api DELETE "/api/conversations/$DEL" --expect 404 --save F04.delete-unknown-id/repeat # bug: status eq 400 && response.body.detail eq 'Bad Request'
```
Expected: 404 for both, as declared. Today both are 400 with
`{"detail": "Bad Request"}`: the handler maps every `False` from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ control-agent-server api GET /api/conversations/count --query status=idle --chec
test "$AFTER" -ge 3
control-agent-server api GET "/api/conversations/$E" --check execution_status eq error --quiet --save F05.run-error-responsive/after
echo "slowest probe while the run failed: $SLOWEST ms"
test "$SLOWEST" -le 1500 # bug
control-agent-server assert --value "$SLOWEST" --check . le 1500 # bug: value ge 3000
```
Expected: every probe answers in about 100 ms. Today one of them waits
about 5 s: `_run_and_publish` logs the run failure with `logger.exception`
Expand All @@ -360,8 +360,8 @@ control-agent-server api GET /api/conversations/count --query status=idle --chec
--check 'paths./api/conversations/{conversation_id}/pause.post.responses.404' exists \
--check 'paths./api/conversations/{conversation_id}/interrupt.post.responses.404' exists
control-agent-server api GET "/api/conversations/$NOPE" --expect 404
control-agent-server api POST "/api/conversations/$NOPE/pause" --expect 404 --save F05.unknown-id-pause/pause # bug
control-agent-server api POST "/api/conversations/$NOPE/interrupt" --expect 404 --save F05.unknown-id-pause/interrupt # bug
control-agent-server api POST "/api/conversations/$NOPE/pause" --expect 404 --save F05.unknown-id-pause/pause # bug: status eq 400 && response.body.detail eq 'Bad Request'
control-agent-server api POST "/api/conversations/$NOPE/interrupt" --expect 404 --save F05.unknown-id-pause/interrupt # bug: status eq 400 && response.body.detail eq 'Bad Request'
```
The OpenAPI document and a GET of the same id (404) are the controls.
Expected: 404 for both. Today both return 400 `{"detail": "Bad Request"}`
Expand Down Expand Up @@ -424,8 +424,8 @@ control-agent-server api GET /api/conversations/count --query status=idle --chec
```sh
control-agent-server api GET /api/conversations/search --query status=paused --check items contains "$P"
control-agent-server api POST "/api/conversations/$P/run" --expect 409
control-agent-server api GET "/api/conversations/$P" --check execution_status eq paused --quiet --save F05.pause-running-get/get # bug
control-agent-server state cat "server/workspace/conversations/$(echo "$P" | tr -d -)/base_state.json" --check execution_status eq paused # bug
control-agent-server api GET "/api/conversations/$P" --check execution_status eq paused --quiet --save F05.pause-running-get/get # bug: status eq 200 && checks.0.actual eq running
control-agent-server state cat "server/workspace/conversations/$(echo "$P" | tr -d -)/base_state.json" --check execution_status eq paused # bug: checks.0.actual eq running
```
The status search (the live status says `paused`) and the 409 (the model
call is still in flight) are the controls that the mid-call pause holds.
Expand Down Expand Up @@ -716,7 +716,7 @@ control-agent-server api GET /api/conversations/count --query status=idle --chec
control-agent-server api GET "/api/conversations/$K/events/count" --query kind=$PAUSE_KIND --check . eq 2
control-agent-server restart --hard
control-agent-server api GET "/api/conversations/$K/events/count" --query kind=$PAUSE_KIND --check . eq 2
control-agent-server api GET "/api/conversations/$K" --check execution_status eq paused --quiet --save F05.pause-running-crash/get # bug
control-agent-server api GET "/api/conversations/$K" --check execution_status eq paused --quiet --save F05.pause-running-crash/get # bug: status eq 200 && checks.0.actual eq error
```
The stub's new request proves the model call was in flight when the pause
landed, and the second `PauseEvent` is still in the event log after the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ Preconditions:
--query kind=openhands.sdk.event.llm_convertible.message.MessageEvent \
--check items len-eq 2 --check items.0.kind eq MessageEvent --check items.1.kind eq MessageEvent
control-agent-server api GET "/api/conversations/$CID/events/search" --query kind=MessageEvent --expect 200 \
--check items len-eq 2 --save F06.search-kind-short/short-name # bug
control-agent-server api GET "/api/conversations/$CID/events/count" --query kind=MessageEvent --check . eq 2 # bug
--check items len-eq 2 --save F06.search-kind-short/short-name # bug: status eq 200 && response.body.items len-eq 0
control-agent-server api GET "/api/conversations/$CID/events/count" --query kind=MessageEvent --check . eq 2 # bug: status eq 200 && response.body eq 0
```
Correct behavior: the two messages. Today both return nothing (`items: []`
and `0`, with status 200): the service compares `kind` with
Expand Down Expand Up @@ -256,9 +256,9 @@ Preconditions:
control-agent-server api GET "/api/conversations/$CID/events" --json "[\"$E2\"]" --expect 200 \
--check . len-eq 1 --check 0.id eq "$E2"
control-agent-server api GET "/api/conversations/$CID/events/00000000-0000-4000-8000-0000000000e6" --expect 404 \
--save F06.unknown-event/get-one # bug
--save F06.unknown-event/get-one # bug: status eq 500 && response.body.exception contains 'Unknown event_id'
control-agent-server api GET "/api/conversations/$CID/events" --json "[\"$E2\", \"qa-missing-event\"]" --expect 200 \
--check . len-eq 2 --check 0.id eq "$E2" --check 1 missing --save F06.unknown-event/batch # bug
--check . len-eq 2 --check 0.id eq "$E2" --check 1 missing --save F06.unknown-event/batch # bug: status eq 500 && response.body.exception contains 'Unknown event_id'
```
Correct behavior: 404, and `[<event>, null]`. Today both are 500
`{"detail": "Internal Server Error", "exception": "'Unknown event_id: ...'"}`:
Expand Down Expand Up @@ -353,13 +353,13 @@ Preconditions:
control-agent-server api GET "/api/conversations/$CID/events/count" --check . eq 5
control-agent-server api POST "/api/conversations/$CID/events" \
--json '{"role":"assistant","content":[{"type":"text","text":"QA_F06_ASSISTANT"}]}' --expect 4xx \
--save F06.send-non-user-role/assistant # bug
--save F06.send-non-user-role/assistant # bug: status eq 500 && response.body.exception contains 'Only user messages are allowed'
control-agent-server api GET "/api/conversations/$CID/events/count" --check . eq 5
control-agent-server api POST "/api/conversations/$QA_ROLE/events" \
--json '{"role":"assistant","content":[{"type":"text","text":"QA_F06_ASSISTANT"}]}' --expect 4xx \
--save F06.send-non-user-role/assistant-empty-log # bug
--save F06.send-non-user-role/assistant-empty-log # bug: status eq 500 && response.body.exception contains 'Only user messages are allowed'
control-agent-server api GET "/api/conversations/$QA_ROLE/events/count" --check . eq 0 \
--save F06.send-non-user-role/empty-log-count # bug
--save F06.send-non-user-role/empty-log-count # bug: status eq 200 && response.body eq 1
```
Correct behavior: a 4xx client error and nothing appended. Today it is 500
`{"exception": "Only user messages are allowed to be sent to the agent."}`:
Expand Down Expand Up @@ -419,7 +419,7 @@ Preconditions:
control-agent-server api DELETE "/api/conversations/$QA_DEL" --expect 200 --save F06.ws-delete-close/delete
control-agent-server api GET "/api/conversations/$QA_DEL" --expect 404
control-agent-server ws listen "/sockets/events/$QA_DEL" --expect-close 4004 --duration 5
if control-agent-server ws stop f06-del --expect-open --save F06.ws-delete-close/socket; then false; fi # bug
control-agent-server ws stop f06-del --save F06.ws-delete-close/socket | control-agent-server assert --check close.code exists # bug: value.opened eq true && value.stopped eq stopped && value.close missing
```
Correct behavior: the server closes the open socket (with any close code)
while it deletes the conversation; `EventService.close()` awaits
Expand Down Expand Up @@ -555,11 +555,14 @@ Preconditions:
FROM_OBS=$(control-agent-server api GET "/api/conversations/$LIVE/events/search" --field items \
| jq -e --arg id "$OBS_ID" '[.[].id] | length - index($id)')
test "$FROM_OBS" -ge 2
control-agent-server api GET "/api/conversations/$LIVE/events/count" --query timestamp__gte="$OBS_T" \
--check . ge "$FROM_OBS" --save F06.search-timestamp-order/count-since-observation # bug
control-agent-server ws listen "/sockets/events/$LIVE" --query resend_mode=since --query after_timestamp="$OBS_T" \
--duration 3 --save F06.search-timestamp-order/replay-since-observation | jq -e --argjson n "$FROM_OBS" '.frames - 1 >= $n' # bug
control-agent-server api GET "/api/conversations/$LIVE/events/search" --field items | jq -e '[.[].timestamp] | . == sort' # bug
COUNT_SINCE=$(control-agent-server api GET "/api/conversations/$LIVE/events/count" --query timestamp__gte="$OBS_T" \
--save F06.search-timestamp-order/count-since-observation --field .)
control-agent-server assert --value="$((COUNT_SINCE - FROM_OBS))" --check . ge 0 # bug: value eq -1
SINCE=$(control-agent-server ws listen "/sockets/events/$LIVE" --query resend_mode=since --query after_timestamp="$OBS_T" \
--duration 3 --save F06.search-timestamp-order/replay-since-observation | jq .frames)
control-agent-server assert --value="$((SINCE - 1 - FROM_OBS))" --check . ge 0 # bug: value eq -1
control-agent-server api GET "/api/conversations/$LIVE/events/search" --field items \
| jq -c '[range(1; length) as $i | select(.[$i].timestamp < .[$i - 1].timestamp) | (.[$i].key // .[$i].kind)]' | control-agent-server assert --check . len-eq 0 # bug: value contains stats
```
Correct behavior: a cut at the first `ObservationEvent` keeps it and
everything listed after it (`FROM_OBS` events), over REST and over the
Expand Down
Loading
Loading