diff --git a/.agents/skills/verify-agent-server/SKILL.md b/.agents/skills/verify-agent-server/SKILL.md index bdd65bc5a90..6ae0f15b5bc 100644 --- a/.agents/skills/verify-agent-server/SKILL.md +++ b/.agents/skills/verify-agent-server/SKILL.md @@ -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 @@ -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 ` 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. diff --git a/.agents/skills/verify-agent-server/references/feature-map/F02-auth-and-sessions.md b/.agents/skills/verify-agent-server/references/feature-map/F02-auth-and-sessions.md index e5523b630b4..0645bf43f1f 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F02-auth-and-sessions.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F02-auth-and-sessions.md @@ -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 @@ -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 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F03-deferred-init.md b/.agents/skills/verify-agent-server/references/feature-map/F03-deferred-init.md index 37776b8bcbb..ad3b57200f5 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F03-deferred-init.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F03-deferred-init.md @@ -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 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F04-conversation-lifecycle.md b/.agents/skills/verify-agent-server/references/feature-map/F04-conversation-lifecycle.md index de7aae1c758..f15ec12a858 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F04-conversation-lifecycle.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F04-conversation-lifecycle.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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` @@ -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 @@ -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 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F05-run-pause-interrupt.md b/.agents/skills/verify-agent-server/references/feature-map/F05-run-pause-interrupt.md index 27e7b8d7f3a..fdf968ed244 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F05-run-pause-interrupt.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F05-run-pause-interrupt.md @@ -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` @@ -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"}` @@ -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. @@ -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 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F06-conversation-events.md b/.agents/skills/verify-agent-server/references/feature-map/F06-conversation-events.md index 187f9e7684b..999beb22416 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F06-conversation-events.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F06-conversation-events.md @@ -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 @@ -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 `[, null]`. Today both are 500 `{"detail": "Internal Server Error", "exception": "'Unknown event_id: ...'"}`: @@ -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."}`: @@ -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 @@ -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 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F07-session-socket.md b/.agents/skills/verify-agent-server/references/feature-map/F07-session-socket.md index 9e9634468db..b56e099f972 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F07-session-socket.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F07-session-socket.md @@ -323,7 +323,7 @@ Preconditions: control-agent-server state cat "evidence/F07.live-order/order-$ORD.json" --contains QA_F07_ORDER --check frames.6.direction ne received \ --check frames.1.frame.type eq sync --check frames.2.frame.type eq transient \ --check frames.3.frame.type eq durable --check frames.4.frame.type eq durable --check frames.5.frame.type eq durable - control-agent-server state cat "evidence/F07.live-order/order-$ORD.json" --check frames.3.frame.seq eq 0 --check frames.4.frame.seq eq 1 --check frames.5.frame.seq eq 2 # bug + control-agent-server state cat "evidence/F07.live-order/order-$ORD.json" --check frames.3.frame.seq eq 0 --check frames.4.frame.seq eq 1 --check frames.5.frame.seq eq 2 # bug: checks.0.actual eq 0 && checks.1.actual eq 2 && checks.2.actual eq 1 ``` The arrange steps and positive controls hold either way: the message is persisted, the capture holds `sync`, the snapshot and exactly three @@ -642,7 +642,7 @@ Preconditions: control-agent-server api DELETE "/api/conversations/$DEL" --expect 200 --save "F07.deleted-close/delete-$DEL" control-agent-server api GET "/api/conversations/$DEL" --expect 404 control-agent-server ws listen "/sockets/session/$DEL" --duration 5 --expect-close 4004 --expect-frames 0 - if control-agent-server ws stop "del-$DEL" --expect-open --save "F07.deleted-close/socket-$DEL"; then false; fi # bug + control-agent-server ws stop "del-$DEL" --save "F07.deleted-close/socket-$DEL" | 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 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F08-confirmation-security-secrets.md b/.agents/skills/verify-agent-server/references/feature-map/F08-confirmation-security-secrets.md index 9fb54052ca7..3f6c2bf389e 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F08-confirmation-security-secrets.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F08-confirmation-security-secrets.md @@ -438,7 +438,7 @@ KID=$(control-agent-server api POST /api/conversations \ control-agent-server api GET "/api/conversations/$KID" --check secret_registry.secret_sources.QA_F08_VISIBLE_SAVED.kind eq StaticSecret control-agent-server api POST "/api/conversations/$KID/secrets" --json '{"secrets": {"QA_F08_FRESH": "qa-f08-fresh-value"}}' --expect 200 control-agent-server api GET "/api/conversations/$KID" --check secret_registry.secret_sources.QA_F08_FRESH.kind eq StaticSecret \ - --save F08.secrets-visible/get # bug + --save F08.secrets-visible/get # bug: status eq 200 && checks.0.actual eq null && response.body.secret_registry.secret_sources.QA_F08_VISIBLE_SAVED.kind eq StaticSecret ``` Expected: GET lists `QA_F08_FRESH` as it lists the saved one. Today it does not: `LocalConversation.update_secrets` mutates @@ -471,9 +471,9 @@ KID=$(control-agent-server api POST /api/conversations \ ```sh control-agent-server api POST "/api/conversations/$KID/secrets" --json '{"secrets": {"QA_F08_STRING": "qa-f08-string-value"}}' --expect 200 control-agent-server api POST "/api/conversations/$KID/secrets" --json '{"secrets": {"QA_F08_NUMBER": 5}}' \ - --expect 422 --save F08.secrets-bad-value/number # bug - control-agent-server api POST "/api/conversations/$KID/secrets" --json '{"secrets": {"QA_F08_NULL": null}}' --expect 422 # bug - control-agent-server api POST "/api/conversations/$KID/secrets" --json '{"secrets": {"QA_F08_BOOL": true}}' --expect 422 # bug + --expect 422 --save F08.secrets-bad-value/number # bug: status eq 500 && response.body.exception contains "'int' object has no attribute 'pop'" + control-agent-server api POST "/api/conversations/$KID/secrets" --json '{"secrets": {"QA_F08_NULL": null}}' --expect 422 # bug: status eq 500 && response.body.exception contains "'NoneType' object has no attribute 'pop'" + control-agent-server api POST "/api/conversations/$KID/secrets" --json '{"secrets": {"QA_F08_BOOL": true}}' --expect 422 # bug: status eq 500 && response.body.exception contains "'bool' object has no attribute 'pop'" ``` Expected: 422 like any other invalid body. Today each is 500 `"exception": "'int' object has no attribute 'pop'"` (`'NoneType'` for @@ -684,7 +684,7 @@ KID=$(control-agent-server api POST /api/conversations \ control-agent-server api PATCH "/api/conversations/$UNS" --json '{"tags": {"qa": "f08-after-restart"}}' --expect 200 control-agent-server api GET "/api/conversations/$UNS" --check secret_registry.secret_sources.QA_F08_SAVED.kind eq StaticSecret control-agent-server api GET "/api/conversations/$UNS" --check secret_registry.secret_sources.QA_F08_UNSAVED.kind eq StaticSecret \ - --save F08.secrets-unsaved-restart/get # bug + --save F08.secrets-unsaved-restart/get # bug: status eq 200 && checks.0.actual eq null && response.body.secret_registry.secret_sources.QA_F08_SAVED.kind eq StaticSecret ``` Expected: both names after the restart. Today `QA_F08_SAVED` is there and `QA_F08_UNSAVED` is gone: the POST never reached `base_state.json` (see diff --git a/.agents/skills/verify-agent-server/references/feature-map/F09-model-switching-plugins.md b/.agents/skills/verify-agent-server/references/feature-map/F09-model-switching-plugins.md index 7defecdaee0..09c13bc3f8d 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F09-model-switching-plugins.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F09-model-switching-plugins.md @@ -280,7 +280,7 @@ Preconditions: control-agent-server api POST /api/profiles/qa-f09-edit --json '{"llm": {"model": "openai/qa-f09-edit-2", "api_key": "sk-qa-f09-edit", "base_url": "http://127.0.0.1:9/v1"}}' --expect 201 control-agent-server api GET /api/profiles/qa-f09-edit --quiet --check config.model eq openai/qa-f09-edit-2 control-agent-server api POST "/api/conversations/$EID/switch_profile" --json '{"profile_name": "qa-f09-edit"}' --expect 200 --save F09.switch-profile-edited/switch-again - control-agent-server api GET "/api/conversations/$EID" --quiet --check agent.llm.model eq openai/qa-f09-edit-2 --save F09.switch-profile-edited/get # bug + control-agent-server api GET "/api/conversations/$EID" --quiet --check agent.llm.model eq openai/qa-f09-edit-2 --save F09.switch-profile-edited/get # bug: status eq 200 && checks.0.actual eq openai/qa-f09-edit-1 ``` The first switch installs `openai/qa-f09-edit-1` and the profile then reads back as `openai/qa-f09-edit-2`. Expected: the second switch installs @@ -307,7 +307,7 @@ Preconditions: control-agent-server api GET "/api/conversations/$KID" --quiet --check agent.llm.usage_id eq default --check execution_status eq idle ST=$(control-agent-server api POST "/api/conversations/$KID/switch_llm" --json "{\"llm\": $PRO}" \ --expect 200,400,409,422 --save F09.switch-llm-registered-usage-id/switch | jq -r .status) - test "$ST" != 200 || control-agent-server api GET "/api/conversations/$KID" --quiet --check agent.llm.model eq deepseek/deepseek-v4-pro --save F09.switch-llm-registered-usage-id/get # bug + test "$ST" != 200 || control-agent-server api GET "/api/conversations/$KID" --quiet --check agent.llm.model eq deepseek/deepseek-v4-pro --save F09.switch-llm-registered-usage-id/get # bug: status eq 200 && checks.0.actual eq openai/qa-placeholder ``` The profile config carries `usage_id: default`, and the fresh conversation switches to `deepseek/deepseek-v4-pro`. Expected: the initialized one @@ -332,7 +332,7 @@ Preconditions: control-agent-server conversation send "$BID" --text 'Reply with the single word: ok' --wait --until finished,error --timeout 240 control-agent-server api GET "/api/conversations/$BID" --quiet --check execution_status eq finished --check agent.llm.usage_id eq qa-f09-early control-agent-server api GET "/api/conversations/$BID" --until-ok 20 --quiet \ - --check stats.usage_to_metrics.qa-f09-early.accumulated_token_usage.prompt_tokens gt 0 --save F09.switch-llm-before-first-run/stats # bug + --check stats.usage_to_metrics.qa-f09-early.accumulated_token_usage.prompt_tokens gt 0 --save F09.switch-llm-before-first-run/stats # bug: status eq 200 && checks.0.actual eq null ``` The run finishes, which only the switched model can do (the placeholder points at a closed port). Expected: its tokens are recorded under @@ -376,8 +376,8 @@ Preconditions: --expect 200 --save F09.switch-llm-mid-run-get/switch control-agent-server ws read qa-f09-midget --kinds ConversationStateUpdateEvent --contains '"usage_id": "qa-f09-midget"' --expect-min 1 --wait 10 --save F09.switch-llm-mid-run-get/frames control-agent-server api GET "/api/conversations/$GID" --quiet --check execution_status eq running - control-agent-server api GET "/api/conversations/$GID" --quiet --check agent.llm.usage_id eq qa-f09-midget --save F09.switch-llm-mid-run-get/get # bug - control-agent-server state cat "server/workspace/conversations/${GID//-/}/base_state.json" --max-chars 200 --check agent.llm.usage_id eq qa-f09-midget # bug + control-agent-server api GET "/api/conversations/$GID" --quiet --check agent.llm.usage_id eq qa-f09-midget --save F09.switch-llm-mid-run-get/get # bug: status eq 200 && checks.0.actual eq default + control-agent-server state cat "server/workspace/conversations/${GID//-/}/base_state.json" --max-chars 200 --check agent.llm.usage_id eq qa-f09-midget # bug: checks.0.actual eq default control-agent-server conversation wait "$GID" --until finished,error --timeout 240 control-agent-server api GET "/api/conversations/$GID" --quiet --check execution_status eq finished --check agent.llm.usage_id eq qa-f09-midget ``` @@ -430,8 +430,8 @@ Preconditions: ```sh AID2=$(control-agent-server conversation start --no-autotitle --body-json '{"agent_settings": {"agent_kind": "acp", "acp_server": "claude-code", "acp_model": "sonnet"}}' --print-id) control-agent-server api GET "/api/conversations/$AID2" --quiet --check agent.kind eq ACPAgent --check agent.acp_model eq sonnet --check execution_status eq idle - control-agent-server api POST "/api/conversations/$AID2/switch_acp_model" --json '{"model": " "}' --expect 400,422 --save F09.acp-model-blank/blank # bug - control-agent-server api GET "/api/conversations/$AID2" --quiet --check agent.acp_model eq sonnet --check current_model_id eq sonnet # bug + control-agent-server api POST "/api/conversations/$AID2/switch_acp_model" --json '{"model": " "}' --expect 400,422 --save F09.acp-model-blank/blank # bug: status eq 200 && response.body.success eq true + control-agent-server api GET "/api/conversations/$AID2" --quiet --check agent.acp_model eq sonnet --check current_model_id eq sonnet # bug: status eq 200 && checks.0.actual eq ' ' && checks.1.actual eq ' ' ``` Expected: refused, as `ACPAgent.set_acp_model` refuses an empty or whitespace-only model on a live session (`model must be a non-empty @@ -443,11 +443,11 @@ Preconditions: ```sh AID3=$(control-agent-server conversation start --no-autotitle --body-json '{"agent_settings": {"agent_kind": "acp", "acp_server": "claude-code", "acp_model": "sonnet"}}' --print-id) control-agent-server api GET "/api/conversations/$AID3" --quiet --check agent.llm.usage_id eq acp-managed --check agent.llm.model eq sonnet - control-agent-server api POST "/api/conversations/$AID3/switch_profile" --json '{"profile_name": "deepseek-pro"}' --expect 400,409,422 --save F09.switch-llm-acp-refused/switch-profile # bug + control-agent-server api POST "/api/conversations/$AID3/switch_profile" --json '{"profile_name": "deepseek-pro"}' --expect 400,409,422 --save F09.switch-llm-acp-refused/switch-profile # bug: status eq 200 && response.body.success eq true control-agent-server api POST "/api/conversations/$AID3/switch_llm" \ --json '{"llm": {"model": "openai/qa-f09-acp", "api_key": "sk-qa-f09-acp", "base_url": "http://127.0.0.1:9/v1", "usage_id": "qa-f09-acp"}}' \ - --expect 400,409,422 --save F09.switch-llm-acp-refused/switch-llm # bug - control-agent-server api GET "/api/conversations/$AID3" --quiet --check agent.llm.usage_id eq acp-managed --check agent.acp_model eq sonnet # bug + --expect 400,409,422 --save F09.switch-llm-acp-refused/switch-llm # bug: status eq 200 && response.body.success eq true + control-agent-server api GET "/api/conversations/$AID3" --quiet --check agent.llm.usage_id eq acp-managed --check agent.acp_model eq sonnet # bug: status eq 200 && checks.0.actual eq qa-f09-acp && checks.1.ok eq true ``` The ACP agent starts with `usage_id` `acp-managed` and the model name `sonnet`. Expected: both switches are refused with a 4xx (400 would mirror @@ -513,7 +513,7 @@ Preconditions: ```sh control-agent-server api GET "/api/conversations/$LID" --quiet --check supports_runtime_model_switch eq true \ --check available_models contains '"model_id": "sonnet"' --check available_models not-contains qa-f09-nope - control-agent-server api POST "/api/conversations/$LID/switch_acp_model" --json '{"model": "qa-f09-nope"}' --expect 400,422 --save F09.acp-model-live-unknown/switch # bug + control-agent-server api POST "/api/conversations/$LID/switch_acp_model" --json '{"model": "qa-f09-nope"}' --expect 400,422 --save F09.acp-model-live-unknown/switch # bug: status eq 500 && response.body.exception contains 'Internal error' ``` Expected: a client error, as `ACPAgent.set_acp_model` documents ("the ACP server rejects the model-switch call (e.g. ... an invalid model id)" is a @@ -603,7 +603,7 @@ Preconditions: ```sh grep -n 'async switchAcpModel(' clients/typescript/src/client/conversation-client.ts grep -n 'async switchAcpModel(' clients/typescript/src/conversation/remote-conversation.ts - if grep -n 'returns 409 before the first message' clients/typescript/src/client/conversation-client.ts clients/typescript/src/conversation/remote-conversation.ts; then false; fi # bug + control-agent-server assert --value "$(cat clients/typescript/src/client/conversation-client.ts clients/typescript/src/conversation/remote-conversation.ts | grep -c 'returns 409 before the first message')" --check . eq 0 # bug: value ge 1 ``` Expected: the docstrings of `ConversationClient.switchAcpModel` and `RemoteConversation.switchAcpModel` say what `F09.acp-model-deferred` and @@ -698,7 +698,7 @@ Preconditions: control-agent-server api POST "/api/conversations/$QID/load_plugin" --json '{"plugin_ref": "qa-f09-mkt-plugin@qa-f09-mkt"}' --expect 200 --save F09.load-plugin-twice/second-load control-agent-server api GET "/api/conversations/$QID" --query include_skills=true --quiet \ --check agent.agent_context.skills len-eq 2 --check agent.agent_context.skills contains qa-f09-mkt-plugin-skill --check hook_config.user_prompt_submit len-ge 1 - control-agent-server api GET "/api/conversations/$QID" --quiet --check hook_config.user_prompt_submit len-eq 1 --save F09.load-plugin-twice/get # bug + control-agent-server api GET "/api/conversations/$QID" --quiet --check hook_config.user_prompt_submit len-eq 1 --save F09.load-plugin-twice/get # bug: status eq 200 && checks.0.actual contains 'echo QA_PLUGIN_HOOK' ``` The second load is 200 and the skills are not duplicated (still two). Expected: one copy of the hook as well. Today `hook_config.user_prompt_submit` diff --git a/.agents/skills/verify-agent-server/references/feature-map/F10-fork-navigate-condense-ask.md b/.agents/skills/verify-agent-server/references/feature-map/F10-fork-navigate-condense-ask.md index a44806f9b42..1283172dbe2 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F10-fork-navigate-condense-ask.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F10-fork-navigate-condense-ask.md @@ -241,7 +241,7 @@ SIDE_AGENT="{\"llm\": {\"model\": \"openai/qa-stub\", \"api_key\": \"qa-stub-key TF=$(control-agent-server api POST "/api/conversations/$TS/fork" --json '{"title": "QA F10 tag fork"}' --expect 201 --quiet \ --check tags.title eq 'QA F10 tag fork' --save F10.fork-tags-consistent/fork --field id) TF_QA=$(control-agent-server api GET "/api/conversations/$TF" --field tags | python3 -c 'import json, sys; v = json.load(sys.stdin).get("qa"); print("null" if v is None else v)') - control-agent-server state cat meta.json --conversation "$TF" --check title eq 'QA F10 tag fork' --check tags.qa eq "$TF_QA" # bug + control-agent-server state cat meta.json --conversation "$TF" --check title eq 'QA F10 tag fork' --check tags.qa eq "$TF_QA" # bug: checks.0.ok eq true && checks.1.check eq 'tags.qa eq null' && checks.1.actual eq src ``` The source shows `qa=src` on GET and in `meta.json` (the two views can agree). Expected: the fork's GET and `meta.json` agree on `qa`, whichever @@ -260,7 +260,7 @@ SIDE_AGENT="{\"llm\": {\"model\": \"openai/qa-stub\", \"api_key\": \"qa-stub-key ```sh KF=$(control-agent-server api POST "/api/conversations/$S/fork" --expect 201 --field id) control-agent-server state cat base_state.json --conversation "$S" --max-chars 200 --check agent.llm.api_key exists --check agent.condenser.llm.api_key exists - control-agent-server state cat base_state.json --conversation "$KF" --max-chars 200 --check agent.llm.api_key exists --check agent.condenser.llm.api_key exists # bug + control-agent-server state cat base_state.json --conversation "$KF" --max-chars 200 --check agent.llm.api_key exists --check agent.condenser.llm.api_key exists # bug: content.agent.llm.model exists && checks.0.actual eq null && checks.1.actual eq null ``` Expected: both files hold the keys (encrypted with the server's cipher; `state cat` shows ``). Today the source's do and the @@ -277,7 +277,7 @@ SIDE_AGENT="{\"llm\": {\"model\": \"openai/qa-stub\", \"api_key\": \"qa-stub-key N_A_MSG=$(control-agent-server api GET "/api/conversations/$A/events/count" --query kind=$MSG --field .) AF=$(control-agent-server api POST "/api/conversations/$A/fork" --json '{"title": "QA F10 memory fork"}' --expect 201 --field id) control-agent-server conversation send "$AF" --text 'What is the project codename I told you? Answer with the codename only.' --wait --until finished,error --timeout 180 - control-agent-server conversation events "$AF" --kinds ConversationErrorEvent --contains LLMAuthenticationError --expect-count 0 --save F10.fork-run-memory/auth-errors # bug + control-agent-server conversation events "$AF" --kinds ConversationErrorEvent --contains LLMAuthenticationError --expect-count 0 --save F10.fork-run-memory/auth-errors # bug: matching ge 1 control-agent-server api GET "/api/conversations/$AF" --quiet --check execution_status eq finished --save F10.fork-run-memory/status control-agent-server api GET "/api/conversations/$AF/agent_final_response" --check response matches '(?i)pelican' --save F10.fork-run-memory/final control-agent-server api GET "/api/conversations/$A/events/count" --query kind=$MSG --check . eq "$N_A_MSG" @@ -365,7 +365,7 @@ SIDE_AGENT="{\"llm\": {\"model\": \"openai/qa-stub\", \"api_key\": \"qa-stub-key U1=$(control-agent-server api GET "/api/conversations/$AN/events/search" --query kind=$MSG --query source=user --check items len-eq 1 --field items.0.id) control-agent-server api GET "/api/conversations/$AN/agent_final_response" --check response matches '\S' control-agent-server api POST "/api/conversations/$AN/navigate" --json "{\"event_id\": \"$U1\"}" --expect 200 --quiet --check leaf_event_id eq "$U1" - control-agent-server api GET "/api/conversations/$AN/agent_final_response" --check response eq '' --save F10.navigate-final-response/after-navigate # bug + control-agent-server api GET "/api/conversations/$AN/agent_final_response" --check response eq '' --save F10.navigate-final-response/after-navigate # bug: status eq 200 && response.body.response matches '\S' ``` Expected: once HEAD is back on the user's message, the active branch has no agent answer, so `agent_final_response` is `""` (the agent's context, title @@ -415,8 +415,8 @@ SIDE_AGENT="{\"llm\": {\"model\": \"openai/qa-stub\", \"api_key\": \"qa-stub-key is the caller's configuration, not a server fault. ```sh control-agent-server api GET "/api/conversations/$NC" --quiet --check execution_status eq idle - control-agent-server api POST "/api/conversations/$NC/condense" --expect 4xx --save F10.condense-status/disabled # bug - control-agent-server api POST "/api/conversations/$NOOP/condense" --expect 4xx --save F10.condense-status/no-op # bug + control-agent-server api POST "/api/conversations/$NC/condense" --expect 4xx --save F10.condense-status/disabled # bug: status eq 500 && response.body.exception contains 'No condenser configured' + control-agent-server api POST "/api/conversations/$NOOP/condense" --expect 4xx --save F10.condense-status/no-op # bug: status eq 500 && response.body.exception contains 'NoOpCondenser does not handle condensation requests' ``` Expected: a 4xx (400, 409 or 422) carrying the cause. Today both answer 500 `{"detail": "Internal Server Error", "exception": "Cannot condense @@ -509,7 +509,7 @@ SIDE_AGENT="{\"llm\": {\"model\": \"openai/qa-stub\", \"api_key\": \"qa-stub-key ```sh control-agent-server api GET /openapi.json --auth none --quiet \ --check 'paths./api/conversations/{conversation_id}/ask_agent.post.responses.404' exists - control-agent-server api POST "/api/conversations/$NOPE/ask_agent" --json '{"question": "hi"}' --expect 404 --save F10.ask-agent-unknown/unknown # bug + control-agent-server api POST "/api/conversations/$NOPE/ask_agent" --json '{"question": "hi"}' --expect 404 --save F10.ask-agent-unknown/unknown # bug: status eq 500 && response.body.exception contains '500: Internal Server Error' ``` Expected: 404. Today it is 500 `{"detail": "Internal Server Error", "exception": "500: Internal Server Error"}`: diff --git a/.agents/skills/verify-agent-server/references/feature-map/F11-goals.md b/.agents/skills/verify-agent-server/references/feature-map/F11-goals.md index 1057420da2e..05047e0a309 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F11-goals.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F11-goals.md @@ -500,7 +500,7 @@ control-agent-server api GET /api/conversations/count --query status=idle --chec control-agent-server ws stop f11-j2 control-agent-server conversation events "$J2" --key goal --contains '"active": false, "status": "interrupted"' --expect-count 1 control-agent-server conversation events "$J2" --key goal --contains '"active": false, "status": "capped"' --expect-count 1 - control-agent-server conversation events "$J2" --key goal --show 50 --full --save F11.goal-cap-overrun/goal-events | jq -e '[.events[].value | select(.iteration > .max_iterations)] | length == 0' # bug + control-agent-server conversation events "$J2" --key goal --show 50 --full --save F11.goal-cap-overrun/goal-events | jq -e '[.events[].value | select(.iteration > .max_iterations)] | length == 0' # bug: events contains '"status": "capped", "iteration": 2, "max_iterations": 1' ``` The arrange steps and positive controls hold (the failed audit recorded one `interrupted` status, the resume was admitted and ended with one @@ -522,7 +522,7 @@ control-agent-server api GET /api/conversations/count --query status=idle --chec control-agent-server restart control-agent-server api GET "/api/conversations/$R" --quiet --check execution_status eq paused --save F11.goal-restart-active/after-restart control-agent-server conversation events "$R" --key goal --expect-min 1 - control-agent-server conversation events "$R" --key goal --show 1 --full --save F11.goal-restart-active/goal-events | jq -e '.events[-1].value.active == false and .events[-1].value.status == "interrupted"' # bug + control-agent-server conversation events "$R" --key goal --show 1 --full --save F11.goal-restart-active/goal-events | jq -e '.events[-1].value.active == false and .events[-1].value.status == "interrupted"' # bug: events.-1.value.active eq true && events.-1.value.status eq running ``` Before the restart the loop is active (`running` at iteration 0); after it the conversation is `paused` and the goal rows came back, and the diff --git a/.agents/skills/verify-agent-server/references/feature-map/F12-runtime-and-credentials.md b/.agents/skills/verify-agent-server/references/feature-map/F12-runtime-and-credentials.md index 3b1d30d11b7..b3a5939eae0 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F12-runtime-and-credentials.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F12-runtime-and-credentials.md @@ -357,8 +357,10 @@ control-agent-server api GET "/api/conversations/$R" --check execution_status eq OLD=$(control-agent-server ws stop f12-before --wait 5 --save F12.sandbox-pause-websocket/old-socket) OLD_SESSION=$(control-agent-server ws stop f12-before-session --wait 5 --save F12.sandbox-pause-websocket/old-session-socket) printf '%s\n%s\n' "$OLD" "$OLD_SESSION" | jq -c '{close, kinds}' - echo "$OLD" | jq -e '.close != null or ((.kinds.MessageEvent // 0) >= 1)' # bug - echo "$OLD_SESSION" | jq -e '.close != null or ((.kinds["durable:MessageEvent"] // 0) >= 1)' # bug + echo "$OLD" | jq -c '{opened, close, messages: (.kinds.MessageEvent // 0)} | .closed_or_streaming = (.close != null or .messages >= 1)' \ + | control-agent-server assert --check closed_or_streaming eq true # bug: value.opened eq true && value.close missing && value.messages eq 0 + echo "$OLD_SESSION" | jq -c '{opened, close, messages: (.kinds["durable:MessageEvent"] // 0)} | .closed_or_streaming = (.close != null or .messages >= 1)' \ + | control-agent-server assert --check closed_or_streaming eq true # bug: value.opened eq true && value.close missing && value.messages eq 0 ``` Correct behavior: a socket that was open before the pause is closed by the server (so the client reconnects) or keeps streaming. Today both stay @@ -490,8 +492,8 @@ control-agent-server api GET "/api/conversations/$R" --check execution_status eq --save F12.binding-native-cold/put control-agent-server api GET "/api/conversations/$N/events/count" --expect 200 control-agent-server api POST /api/conversations/prepare-for-sandbox-pause --expect 204 - control-agent-server api GET "/api/conversations/$N/events/count" --expect 200 --save F12.binding-native-cold/events-after-pause # bug - control-agent-server state cat meta.json --conversation "$N" --check required_runtime_credential_bindings len-eq 0 # bug + control-agent-server api GET "/api/conversations/$N/events/count" --expect 200 --save F12.binding-native-cold/events-after-pause # bug: status eq 409 && response.body contains credential_binding_activation_required + control-agent-server state cat meta.json --conversation "$N" --check required_runtime_credential_bindings len-eq 0 # bug: checks.0.actual contains CODEX_AUTH_JSON ``` Correct behavior: a regular conversation either refuses the binding (409, as it does when loaded) or ignores it, and stays readable after the next @@ -752,8 +754,8 @@ control-agent-server api GET "/api/conversations/$R" --check execution_status eq control-agent-server conversation send "$WC" --run "$K" --text 'QA_F12_SWITCH_2' control-agent-server sink read --name qa-f12-switch --expect-min 3 --wait 30 control-agent-server conversation wait "$WC" --run "$K" --until finished,error --timeout 60 - control-agent-server sink read --name qa-f12-keysrc-switch --expect-min 2 --expect-max 2 --save F12.managed-key-switch/key-fetch # bug - control-agent-server api GET "/api/conversations/$WC" --run "$K" --check execution_status eq finished # bug + control-agent-server sink read --name qa-f12-keysrc-switch --expect-min 2 --expect-max 2 --save F12.managed-key-switch/key-fetch # bug: requests eq 1 + control-agent-server api GET "/api/conversations/$WC" --run "$K" --check execution_status eq finished # bug: status eq 200 && checks.0.actual eq error control-agent-server stop --run "$K" ``` Correct behavior: the switched LLM sits on an allow-listed `base_url`, so diff --git a/.agents/skills/verify-agent-server/references/feature-map/F13-bash.md b/.agents/skills/verify-agent-server/references/feature-map/F13-bash.md index ea41668eab5..269cada7b70 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F13-bash.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F13-bash.md @@ -430,7 +430,7 @@ Preconditions: control-agent-server api GET /api/bash/bash_events/search --query kind__eq=BashCommand \ --query timestamp__gte="$GTE_UTC" --check items contains "$TZ_CMD" --save F13.timestamp-offset/utc control-agent-server api GET /api/bash/bash_events/search --query kind__eq=BashCommand \ - --query timestamp__gte="$GTE_PLUS2" --check items contains "$TZ_CMD" --save F13.timestamp-offset/plus-two # bug + --query timestamp__gte="$GTE_PLUS2" --check items contains "$TZ_CMD" --save F13.timestamp-offset/plus-two # bug: status eq 200 && checks.0.actual eq '[]' ``` Expected: both searches contain the command. Today the `Z` window does (the positive control) and the `+02:00` window, the `# bug` assertion, is @@ -474,7 +474,7 @@ Preconditions: --check next_page_id missing --quiet --save F13.order-gt-paging/limit-2 control-agent-server api GET /api/bash/bash_events/search --query command_id__eq="$BIG_CMD" \ --query order__gt=0 --query limit=1 --check items len-eq 1 --check items.0.order eq 1 \ - --quiet --save F13.order-gt-paging/limit-1 # bug + --quiet --save F13.order-gt-paging/limit-1 # bug: status eq 200 && checks.0.actual eq '[]' ``` With a page that holds both chunks, `order__gt=0` keeps only chunk 1 (the positive control: the filter works). Expected: the one-item page holds @@ -493,7 +493,7 @@ Preconditions: ```sh control-agent-server api POST /api/bash/execute_bash_command \ --json '{"command": "yes a | head -c 1100000; echo QA_F13_TAIL", "timeout": 60}' --expect 200 \ - --check exit_code eq 0 --check stdout len-eq 1100012 --quiet --save F13.execute-large-output/execute # bug + --check exit_code eq 0 --check stdout len-eq 1100012 --quiet --save F13.execute-large-output/execute # bug: status eq 200 && checks.0.ok eq true && response.headers.content-length lt 1100012 ``` Expected: `stdout` holds all 1,100,012 characters (`exit_code` 0 holds either way; the length check is the one that fails). Today the response is @@ -771,9 +771,9 @@ Preconditions: ```sh control-agent-server api GET "/api/conversations/$CID/bash/bash_events/search" --expect 200 control-agent-server api GET /api/conversations/not-a-uuid/bash/bash_events/search --expect 422 \ - --save F13.scoped-bad-id/search # bug + --save F13.scoped-bad-id/search # bug: status eq 500 && response.body.exception contains runtime_event_service control-agent-server api POST /api/conversations/not-a-uuid/bash/execute_bash_command \ - --json '{"command": "echo QA_F13_BADID"}' --expect 422 # bug + --json '{"command": "echo QA_F13_BADID"}' --expect 422 # bug: status eq 500 && response.body.exception contains runtime_event_service ``` The same search on a real conversation id answers 200 (the positive control). Expected: 422 for `not-a-uuid`. Today every scoped bash route answers 500 @@ -807,7 +807,7 @@ Preconditions: done control-agent-server logs --run "$EV" --grep 'Evicted idle' --expect-min 1 sleep 3 - pgrep -f "$EV_MARK" # bug + control-agent-server assert --value "$(pgrep -fc "$EV_MARK")" --check . ge 1 # bug: value eq 0 control-agent-server api POST "/api/conversations/$EV_CID/bash/bash_commands/$EV_CMD/stop" --run "$EV" --expect 200 control-agent-server api GET "/api/conversations/$EV_CID/bash/bash_events/search" --run "$EV" \ --query command_id__eq="$EV_CMD" --until-ok 15 --check items.-1.exit_code eq -15 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F14-files.md b/.agents/skills/verify-agent-server/references/feature-map/F14-files.md index 3f59336355f..4701feec954 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F14-files.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F14-files.md @@ -194,9 +194,9 @@ Preconditions: control-agent-server api POST /api/file/create_directory --query path="$F/v2.txt/child" --expect 400 \ --check detail eq 'Path exists and is not a directory' control-agent-server api POST /api/file/upload --query path="$F/xfer/is-a-dir" --file file="$F/v2.txt" \ - --expect 4xx --save F14.upload-onto-directory/upload # bug + --expect 4xx --save F14.upload-onto-directory/upload # bug: status eq 500 && response.body.exception contains 'Is a directory' control-agent-server api POST /api/file/upload --query path="$F/v2.txt/child" --file file="$F/v2.txt" \ - --expect 4xx --save F14.upload-onto-directory/parent-is-file # bug + --expect 4xx --save F14.upload-onto-directory/parent-is-file # bug: status eq 500 && response.body.exception contains 'File exists' ``` Expected: a 4xx such as 400 `Path exists and is not a directory`, as `create_directory` answers for the same collisions. Actual: @@ -253,8 +253,8 @@ Preconditions: control-agent-server exec --expect-output TS_UPLOAD_OK --save F14.upload-size/ts -- node "$F/ts_size.mjs" "$F" control-agent-server api POST /api/file/upload --query path="$F/size/rest.bin" --file file="$F/blob.bin" --expect 200 \ --check success eq true --save F14.upload-size/rest - test "$(cat "$F/sdk-size.txt")" = 70000 # bug - test "$(cat "$F/ts-size.txt")" = 70000 # bug + control-agent-server assert --value "$(cat "$F/sdk-size.txt")" --check . eq 70000 # bug: value eq None + control-agent-server assert --value "$(cat "$F/ts-size.txt")" --check . eq 70000 # bug: value eq undefined ``` Expected: both remote workspaces report `file_size` 70000, as `LocalWorkspace` does. Actual: every upload lands intact, but the server @@ -283,7 +283,7 @@ Preconditions: --expect 5xx --check exception contains 'File too large' --save F14.upload-atomic/failed-overwrite prlimit --pid "$B2_PID" --fsize=unlimited: control-agent-server doctor --run "$B2" - cmp "$F/v2.txt" "$AT/target.txt" # bug + control-agent-server assert --value "{\"same\": $(cmp -s "$F/v2.txt" "$AT/target.txt" && echo true || echo false), \"size\": $(wc -c < "$AT/target.txt")}" --check same eq true # bug: value.same eq false && value.size eq 500000 ``` Without the limit the 900 kB blob uploads intact (so the size alone is not the problem) and the small file is in place. Under the limit the overwrite @@ -399,7 +399,7 @@ Preconditions: test "$CASE_FIRST" = Foo -o "$CASE_FIRST" = foo control-agent-server api GET /api/file/search_subdirs --query path="$CASE_DIR" --query limit=1 --query page_id="$CASE_NEXT" \ --expect 200 --check items len-eq 1 --check items.0.name eq "$CASE_OTHER" --check next_page_id missing \ - --save F14.subdirs-case-pagination/page-2 # bug + --save F14.subdirs-case-pagination/page-2 # bug: status eq 200 && response.body.next_page_id eq foo && checks.1.ok eq false ``` Page one holds one twin and a cursor. Expected: page two holds exactly the other twin and no cursor. Actual: the cursor is `foo`, the lowercase name, @@ -593,7 +593,8 @@ Preconditions: --raw-out "$F/doc-parent.tgz" --save F14.archive-format-doc/tar tar tzf "$F/doc-parent.tgz" > "$F/doc-parent.list" grep -q 'proj/notes.txt$' "$F/doc-parent.list" - if printf '%s\n' "$DOC_FORMAT" | grep -q 'entire directory' && test -z "$(grep 'top.txt' "$F/doc-parent.list")"; then false; fi # bug + jq -n --arg doc "$DOC_FORMAT" --rawfile list "$F/doc-parent.list" '{doc_entire_directory: ($doc | contains("entire directory")), tar_has_top: ($list | contains("top.txt"))} | .agree = (.tar_has_top or (.doc_entire_directory | not))' \ + | control-agent-server assert --check agree eq true # bug: value.doc_entire_directory eq true && value.tar_has_top eq false ``` Expected: the description and the archive agree, either by documenting that a directory holding exactly one repository archives only that @@ -674,7 +675,8 @@ Preconditions: SH control-agent-server exec --env CID="$CID" --env CC="$CC" --save F14.trajectory-concurrent/burst -- sh "$CC/burst.sh" test -s "$CC/1-6.status" - for s in "$CC"/[1-5]-[1-6].status; do test "$(cat "$s")" = 200; test -s "${s%.status}.zip"; python3 -m zipfile -t "${s%.status}.zip" > /dev/null; done # bug + BROKEN=$(for s in "$CC"/[1-5]-[1-6].status; do n=$(basename "$s" .status); z="${s%.status}.zip"; c=$(cat "$s"); if [ "$c" != 200 ]; then echo "$n:$c"; elif ! test -s "$z"; then echo "$n:200-empty"; elif ! python3 -m zipfile -t "$z" > /dev/null 2>&1; then echo "$n:200-badzip"; fi; done) + control-agent-server assert --value="$BROKEN" --check . eq '' # bug: value matches ':(500|200-empty|200-badzip)' ``` A single download is a valid zip. Expected: every concurrent download is 200 with a valid zip, in all five rounds. Actual: every handler writes the @@ -846,9 +848,9 @@ Preconditions: BCID=$(control-agent-server conversation start --run "$B" --tools file_editor --no-autotitle --print-id) test -d "$BP/$(printf '%s' "$BCID" | tr -d -)" control-agent-server api GET "/api/conversations/$BCID" --run "$B" --expect 200 --check id eq "$BCID" - control-agent-server api GET "/api/file/download-trajectory/$BCID" --run "$B" --expect 200 --save F14.trajectory-init-path/global # bug + control-agent-server api GET "/api/file/download-trajectory/$BCID" --run "$B" --expect 200 --save F14.trajectory-init-path/global # bug: status eq 404 && response.body.detail eq 'Conversation not found' control-agent-server api GET "/api/conversations/$BCID/file/download-trajectory/$BCID" --run "$B" --expect 200 \ - --save F14.trajectory-init-path/scoped # bug + --save F14.trajectory-init-path/scoped # bug: status eq 404 && response.body.detail eq 'Conversation not found' ``` The conversation is persisted under the init-time path and `GET` finds it. Expected: both trajectory routes return the zip (each alone encodes the diff --git a/.agents/skills/verify-agent-server/references/feature-map/F15-git.md b/.agents/skills/verify-agent-server/references/feature-map/F15-git.md index 7947a2629fe..a8181a59ffb 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F15-git.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F15-git.md @@ -253,7 +253,7 @@ Preconditions: control-agent-server api GET /api/git/changes --query path="$F/ws/proj" --expect 200 --check . len-eq 2 \ --check 0.path eq README.md --check 1.path eq notes.txt control-agent-server api GET /api/git/changes --query path="$F/ws" --expect 200 --check . len-eq 2 \ - --check 0.path eq proj/README.md --check 1.path eq proj/notes.txt --save F15.changes-repo-below-path/ws # bug + --check 0.path eq proj/README.md --check 1.path eq proj/notes.txt --save F15.changes-repo-below-path/ws # bug: status eq 200 && response.body len-eq 0 ``` `$F/ws` itself is not a repository and the repository below it answers with its two changes (positive control). Expected: the repository's two @@ -277,11 +277,11 @@ Preconditions: rm "$F/names/untracked note.md" printf 'a2\n' > "$F/names/my notes.md" control-agent-server api GET /api/git/changes --query path="$F/names" --expect 200 --check . len-eq 1 \ - --check 0.status eq UPDATED --check 0.path eq 'my notes.md' --save F15.changes-special-names/space # bug + --check 0.status eq UPDATED --check 0.path eq 'my notes.md' --save F15.changes-special-names/space # bug: status eq 400 && response.body.detail contains 'Unexpected git diff output format' git -C "$F/names" checkout -q -- 'my notes.md' printf 'b2\n' > "$F/names/café.txt" control-agent-server api GET /api/git/changes --query path="$F/names" --expect 200 --check . len-eq 1 \ - --check 0.path eq café.txt --save F15.changes-special-names/non-ascii # bug + --check 0.path eq café.txt --save F15.changes-special-names/non-ascii # bug: status eq 200 && response.body.0.path contains 303/251 ``` The committed repository answers for an untracked name with a space (positive control: the route and the space in a name are fine on their @@ -306,12 +306,12 @@ Preconditions: --check 0.path eq README.md --check 1.path eq notes.txt --check 2.path eq src/app.py --check 3.path eq src/new.py control-agent-server api GET /api/git/changes --query path="$F/subdir/src" --expect 200 \ --raw-out "$F/subdir.json" --save F15.changes-subdir-paths/src - python3 - "$F/subdir.json" "$F/subdir/src" "$F/subdir" <<'PY' # bug + python3 - "$F/subdir.json" "$F/subdir/src" "$F/subdir" <<'PY' | control-agent-server assert --check paths len-ge 1 --check bases len-ge 1 # bug: value.paths eq '["README.md", "new.py", "src/app.py"]' && value.bases len-eq 0 import json, os, sys changes = json.load(open(sys.argv[1])) - paths = [c["path"] for c in changes if c["status"] != "DELETED"] + paths = sorted(c["path"] for c in changes if c["status"] != "DELETED") bases = [b for b in sys.argv[2:] if all(os.path.exists(os.path.join(b, p)) for p in paths)] - assert paths and bases, f"no single base resolves every path: {changes}" + print(json.dumps({"paths": paths, "bases": bases})) PY ``` The repository root lists all four changes on one base (positive @@ -423,7 +423,8 @@ Preconditions: for name in crlf lead trail; do control-agent-server api GET /api/git/diff --query path="$F/ws-files/$name.txt" --query ref=HEAD --expect 200 \ --check modified len-ge 1 --raw-out "$F/ws-$name.json" --save "F15.diff-whitespace/$name" - python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); assert d["original"] == d["modified"], d' "$F/ws-$name.json" # bug + jq '{original, modified, same: (.original == .modified), strip_only: (.original == (.modified | gsub("^\\s+|\\s+$"; "")))}' "$F/ws-$name.json" \ + | control-agent-server assert --check same eq true # bug: value.same eq false && value.strip_only eq true done ``` Expected: identical sides for every unchanged file (`changes` is `[]`). @@ -442,7 +443,7 @@ Preconditions: control-agent-server api GET /api/git/changes --query path="$F/deleted" --expect 200 \ --check 2.status eq DELETED --check 2.path eq src/util.py control-agent-server api GET /api/git/diff --query path="$F/deleted/src/util.py" --expect 200 \ - --check original eq "$(git -C "$REPO" show HEAD:src/util.py)" --check modified eq '' --save F15.diff-deleted-file/diff # bug + --check original eq "$(git -C "$REPO" show HEAD:src/util.py)" --check modified eq '' --save F15.diff-deleted-file/diff # bug: status eq 400 && response.body.detail contains 'File does not exist' ``` Expected: the base text as `original` and `""` as `modified`, as the commit-mode diff already does for deleted files. Actual: diff --git a/.agents/skills/verify-agent-server/references/feature-map/F16-workspace-serving-and-vscode.md b/.agents/skills/verify-agent-server/references/feature-map/F16-workspace-serving-and-vscode.md index d81120be3dd..6b9e8a28fae 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F16-workspace-serving-and-vscode.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F16-workspace-serving-and-vscode.md @@ -415,8 +415,8 @@ Preconditions: Read status and URL on the keyed run, where VS Code is not running. ```sh control-agent-server api GET /api/vscode/status --expect 200 --check enabled eq true --check running eq false - control-agent-server api GET /api/vscode/url --expect 200 --check . eq '{"url": null}' --save F16.vscode-url-not-running/global # bug - control-agent-server api GET "/api/conversations/$CID/vscode/url" --expect 200 --check . eq '{"url": null}' # bug + control-agent-server api GET /api/vscode/url --expect 200 --check . eq '{"url": null}' --save F16.vscode-url-not-running/global # bug: status eq 200 && response.body.url contains tkn= + control-agent-server api GET "/api/conversations/$CID/vscode/url" --expect 200 --check . eq '{"url": null}' # bug: status eq 200 && response.body.url contains tkn= ``` `running` is false, so the body should be exactly `{"url": null}` on both routes (each `# bug` line alone shows the defect), as the service intends @@ -440,7 +440,9 @@ Preconditions: ODD=$(control-agent-server conversation start --no-run --tools none --no-autotitle --workspace "$F/qa f16&x=1#frag" --print-id) OWS=$(control-agent-server api GET "/api/conversations/$ODD" --field workspace.working_dir) control-agent-server api GET "/api/conversations/$ODD/vscode/url" --expect 200 --save F16.vscode-folder-encoding/odd-folder - control-agent-server api GET "/api/conversations/$ODD/vscode/url" --expect 200 --field url | python3 -c "$ROUNDTRIP" "$OWS" # bug + control-agent-server api GET "/api/conversations/$ODD/vscode/url" --expect 200 --field url \ + | python3 -c 'import sys, json, urllib.parse as u; p = u.urlsplit(sys.stdin.read().strip()); print(json.dumps({"folder": u.parse_qs(p.query).get("folder"), "fragment": p.fragment}))' \ + | control-agent-server assert --check folder len-eq 1 --check folder.0 eq "$OWS" --check fragment eq '' # bug: value.fragment eq frag && value.folder.0 matches '/qa f16$' ``` The normal workspace round-trips. For the odd one the `folder` parameter should decode back to `.../qa f16&x=1#frag`; today the value is pasted @@ -501,7 +503,7 @@ Preconditions: control-agent-server api GET "/api/conversations/$Z/workspace/" --run "$DK" --auth none --expect 401 control-agent-server api POST /api/auth/workspace-session --run "$DK" --jar qa-f16-docker --expect 204 control-agent-server api GET "/api/conversations/$Z/workspace/" --run "$DK" --auth none --jar qa-f16-docker --expect 404 --save F16.docker-root-cookie/slash - control-agent-server api GET "/api/conversations/$Z/workspace" --run "$DK" --auth none --jar qa-f16-docker --expect 404 --save F16.docker-root-cookie/slashless # bug + control-agent-server api GET "/api/conversations/$Z/workspace" --run "$DK" --auth none --jar qa-f16-docker --expect 404 --save F16.docker-root-cookie/slashless # bug: status eq 401 control-agent-server stop --run "$DK" ``` With the header both forms reach the Docker routes (404); with nothing, diff --git a/.agents/skills/verify-agent-server/references/feature-map/F17-workspaces-registry.md b/.agents/skills/verify-agent-server/references/feature-map/F17-workspaces-registry.md index e5bbe5565f0..1cd9de19a5b 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F17-workspaces-registry.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F17-workspaces-registry.md @@ -177,7 +177,7 @@ Preconditions: control-agent-server api DELETE /api/workspaces/parents --query path=/qa-f17/never --expect 404 \ --check detail eq 'Workspace parent not found' control-agent-server api GET /api/workspaces --expect 200 --check workspaces len-eq 0 --check workspaceParents len-eq 0 - control-agent-server state ls home/.openhands/workspaces.json --expect-count 0 # bug + control-agent-server state ls home/.openhands/workspaces.json --expect-count 0 # bug: count eq 1 ``` Expected: both deletes are 404 and, like the read before them, leave no file. Today the first 404 creates `workspaces.json` with two empty lists @@ -266,17 +266,17 @@ Preconditions: test "$(stat -c '%i %y' "$WS")" = "$STAMP" control-agent-server api POST /api/workspaces --json-file "$F17/readd.json" --expect 200 --check workspaces len-eq 5 \ --check workspaces.0.name eq qa-f17-repo --save F17.noop-write-untouched/readd - test "$(stat -c '%i %y' "$WS")" = "$STAMP" # bug + control-agent-server assert --value "$(stat -c '%i %y' "$WS")" --check . eq "$STAMP" # bug: value matches '^[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} ' control-agent-server api DELETE /api/workspaces --query path=/qa-f17/never --expect 404 - test "$(stat -c '%i %y' "$WS")" = "$STAMP" # bug + control-agent-server assert --value "$(stat -c '%i %y' "$WS")" --check . eq "$STAMP" # bug: value matches '^[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} ' control-agent-server api DELETE /api/workspaces/parents --query path=/qa-f17/never --expect 404 - test "$(stat -c '%i %y' "$WS")" = "$STAMP" # bug + control-agent-server assert --value "$(stat -c '%i %y' "$WS")" --check . eq "$STAMP" # bug: value matches '^[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} ' ``` The read leaves the stamp, which shows the comparison can hold. Expected: the re-post (every path in `readd.json` is already saved: 200, still five entries, the repository keeps its name) and both 404 deletes leave it too. Today the re-post already replaces the file (a new inode from the - temp-file rename and a new mtime), so the first marked `test` fails; the + temp-file rename and a new mtime), so the first marked stamp check fails; the content stays the same, which is why only the stamp shows it. List left: `REPO`, `PLAIN`, `snake`, `null`, `dup`. - **Paths are opaque strings (`F17.paths-opaque`).** Register a relative path, @@ -644,11 +644,11 @@ Preconditions: --json '{"workspaces": [{"id": "/qa-f17/ro", "name": "qa-f17-ro", "path": "/qa-f17/ro"}]}' --save F17.noop-write-readonly/real-add control-agent-server state ls 'home/.openhands/workspaces.tmp*' --expect-count 0 control-agent-server api DELETE /api/workspaces --query path=/qa-f17/never --expect 404 \ - --check detail eq 'Workspace not found' --save F17.noop-write-readonly/delete-unknown # bug - control-agent-server api POST /api/workspaces --json-file "$F17/readd.json" --expect 200 --check workspaces len-eq 5 # bug - control-agent-server api DELETE /api/workspaces/parents --query path=/qa-f17/never --expect 404 # bug + --check detail eq 'Workspace not found' --save F17.noop-write-readonly/delete-unknown # bug: status eq 500 && response.body.exception contains 'Failed to update workspaces' + control-agent-server api POST /api/workspaces --json-file "$F17/readd.json" --expect 200 --check workspaces len-eq 5 # bug: status eq 500 && response.body.exception contains 'Failed to save workspaces' + control-agent-server api DELETE /api/workspaces/parents --query path=/qa-f17/never --expect 404 # bug: status eq 500 && response.body.exception contains 'Failed to update workspaces' control-agent-server api POST /api/workspaces/parents --json-file "$F17/plain-parent.json" --expect 200 \ - --check workspaceParents len-eq 2 # bug + --check workspaceParents len-eq 2 # bug: status eq 500 && response.body.exception contains 'Failed to save workspaces' chattr -i "$PDIR" trap - EXIT control-agent-server api GET /api/workspaces --expect 200 --check . eq "$BEFORE" --check . not-contains /qa-f17/ro diff --git a/.agents/skills/verify-agent-server/references/feature-map/F18-settings-and-secrets.md b/.agents/skills/verify-agent-server/references/feature-map/F18-settings-and-secrets.md index 888a0bec0e8..5689d77afd2 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F18-settings-and-secrets.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F18-settings-and-secrets.md @@ -733,7 +733,7 @@ Preconditions: --check detail contains 'not found' --save F18.dangling-pointers/activate-agent-profile control-agent-server api PATCH /api/settings --json '{"active_profile": "qa-f18-nope"}' --expect 404 --check detail eq "Profile 'qa-f18-nope' not found" control-agent-server api PATCH /api/settings --json '{"active_agent_profile_id": "00000000-0000-4000-8000-0000000000f1"}' \ - --expect 404,422 --save F18.dangling-pointers/agent-profile-id # bug + --expect 404,422 --save F18.dangling-pointers/agent-profile-id # bug: status eq 200 && response.body.active_agent_profile_id eq 00000000-0000-4000-8000-0000000000f1 ``` `POST /api/agent-profiles/{id}/activate` answers 404 `Agent profile with id ... not found`, and PATCH refuses an unknown `active_profile` with 404. @@ -752,7 +752,7 @@ Preconditions: control-agent-server api POST /api/meta-profiles/qa-f18-no-router/activate --expect 404 \ --check detail eq "Meta-profile 'qa-f18-no-router' not found" --save F18.dangling-pointers/activate-meta-profile control-agent-server api GET /api/settings --check active_meta_profile missing --check agent_settings.enable_classify_and_switch_llm_tool eq false - control-agent-server api PATCH /api/settings --json '{"active_meta_profile": "qa-f18-no-router"}' --expect 404,422 --save F18.dangling-pointers/meta-profile # bug + control-agent-server api PATCH /api/settings --json '{"active_meta_profile": "qa-f18-no-router"}' --expect 404,422 --save F18.dangling-pointers/meta-profile # bug: status eq 200 && response.body.active_meta_profile eq qa-f18-no-router ``` The activate route answers 404. Expected: PATCH refuses the name too. Today it answers 200, stores the pointer and turns on @@ -772,7 +772,7 @@ Preconditions: cp "$F18/qa-f18-broken.json" "$AP/qa-f18-broken.json" control-agent-server api GET /api/agent-profiles/qa-f18-broken --expect 400 \ --check detail contains 'Failed to load profile' --save F18.secret-scope-profile-errors/agent-profile-route - control-agent-server api GET /api/settings/secrets --query "agent_profile_id=$BROKEN" --expect 4xx --save F18.secret-scope-profile-errors/unloadable # bug + control-agent-server api GET /api/settings/secrets --query "agent_profile_id=$BROKEN" --expect 4xx --save F18.secret-scope-profile-errors/unloadable # bug: status eq 500 && response.body.exception contains 'Failed to load profile' ``` Scoping works while the profile is valid (one secret), and the agent-profile route reports the broken file as 400 `Failed to load profile @@ -797,7 +797,7 @@ Preconditions: control-agent-server api GET /api/agent-profiles/qa-f18-busy --timeout 60 --expect 503 \ --check exception eq '503: Profile store is busy. Please retry.' --save F18.secret-scope-profile-errors/agent-profile-busy control-agent-server api GET /api/settings/secrets --query agent_profile_id=00000000-0000-4000-8000-0000000000f1 --timeout 60 \ - --expect 503 --save F18.secret-scope-profile-errors/secrets-busy # bug + --expect 503 --save F18.secret-scope-profile-errors/secrets-busy # bug: status eq 500 && response.body.exception contains 'lock acquisition timed out' ``` After 30 seconds the agent-profile route answers 503 `Profile store is busy. Please retry.`. Expected: the scoped secrets list answers 503 as @@ -810,7 +810,7 @@ Preconditions: ```sh control-agent-server api GET /openapi.json --expect 200 --quiet --raw-out "$F18/openapi.json" CLAIMED=$(jq -r '.paths["/api/settings/secrets/{name}"].get.description // ""' "$F18/openapi.json" | sed -n 's/.* \([0-9][0-9][0-9]\) if name format is invalid.*/\1/p') - control-agent-server api GET /api/settings/secrets/1bad --expect "${CLAIMED:-422}" --save F18.secret-name-contract/invalid-name # bug + control-agent-server api GET /api/settings/secrets/1bad --expect "${CLAIMED:-422}" --save F18.secret-name-contract/invalid-name # bug: status eq 422 && response.body.detail contains 'Invalid secret name format' ``` Expected: the documented and the real status agree (either the docstring says 422 or the code answers 400). Today the description of `GET`, @@ -843,10 +843,10 @@ Preconditions: control-agent-server api PUT /api/settings/secrets --json '{"name": "QA_F18_ROTATED", "value": "qa-f18-rotated-value"}' --expect 200,409,500 --save F18.secret-key-rotation/put-under-new-key control-agent-server api PATCH /api/settings --json '{"misc_settings_diff": {"qa_f18_rotated": true}}' --expect 200,409 --save F18.secret-key-rotation/patch-under-new-key control-agent-server restart --restore-secret-key - control-agent-server state cat home/.openhands/secrets.json --check custom_secrets.QA_F18_TOKEN.secret matches '^gAAAAA' # bug - control-agent-server state cat home/.openhands/settings.json --check agent_settings.llm.api_key matches '^gAAAAA' # bug - control-agent-server api GET /api/settings/secrets/QA_F18_TOKEN --expect 200 --check . eq "$QA_F18_SECRET" --save F18.secret-key-rotation/after-rotating-back # bug - control-agent-server api GET /api/settings --header 'X-Expose-Secrets: plaintext' --check agent_settings.llm.api_key eq "$QA_F18_LLM_KEY" --save F18.secret-key-rotation/settings-after-rotating-back # bug + control-agent-server state cat home/.openhands/secrets.json --check custom_secrets.QA_F18_TOKEN.secret matches '^gAAAAA' # bug: content.custom_secrets.QA_F18_TOKEN exists && content.custom_secrets.QA_F18_TOKEN.secret eq null + control-agent-server state cat home/.openhands/settings.json --check agent_settings.llm.api_key matches '^gAAAAA' # bug: content.agent_settings.llm exists && content.agent_settings.llm.api_key eq null + control-agent-server api GET /api/settings/secrets/QA_F18_TOKEN --expect 200 --check . eq "$QA_F18_SECRET" --save F18.secret-key-rotation/after-rotating-back # bug: status eq 404 && response.body.detail eq 'Secret not found' + control-agent-server api GET /api/settings --header 'X-Expose-Secrets: plaintext' --check agent_settings.llm.api_key eq "$QA_F18_LLM_KEY" --save F18.secret-key-rotation/settings-after-rotating-back # bug: status eq 200 && checks.0.actual eq null ``` Under the new key every read degrades silently: the secret is 404 `Secret not found`, `llm_api_key_is_set` is `false`, and the log says `Failed to diff --git a/.agents/skills/verify-agent-server/references/feature-map/F19-mcp.md b/.agents/skills/verify-agent-server/references/feature-map/F19-mcp.md index 1a898ada2e0..2d0e572cb63 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F19-mcp.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F19-mcp.md @@ -306,7 +306,7 @@ Preconditions: removes the stored entry before failing, so later bullets are unaffected. ```sh control-agent-server api GET /api/settings --check agent_settings.mcp_config.qa-empty missing - control-agent-server api POST /api/settings/mcp/qa-empty --json '{}' --expect 422 --save F19.settings-empty-server/create || { control-agent-server api DELETE /api/settings/mcp/qa-empty --expect 200,404 >/dev/null; false; } # bug + control-agent-server api POST /api/settings/mcp/qa-empty --json '{}' --expect 422 --save F19.settings-empty-server/create || { control-agent-server api DELETE /api/settings/mcp/qa-empty --expect 200,404 >/dev/null; false; } # bug: request.method eq DELETE && status eq 200 control-agent-server api GET /api/settings --check agent_settings.mcp_config.qa-empty missing ``` Today the POST answers 201 with `qa-empty: {"enabled": true}` in the @@ -525,7 +525,7 @@ Preconditions: ```sh control-agent-server api GET "/api/mcp/oauth/status/$J" --check status eq succeeded --check callback_ready eq true RBODY=$(jq -nc --arg u "$CALLBACK" '{callback_url: $u}') - control-agent-server api POST "/api/mcp/oauth/callback/$J" --json "$RBODY" --expect 200,4xx --save F19.oauth-callback-replay/replay # bug + control-agent-server api POST "/api/mcp/oauth/callback/$J" --json "$RBODY" --expect 200,4xx --save F19.oauth-callback-replay/replay # bug: status eq 500 && response.body.exception contains 'All connection attempts failed' control-agent-server api GET "/api/mcp/oauth/status/$J" --check status eq succeeded ``` Today the `# bug` line gets 500 `All connection attempts failed`. The same @@ -545,8 +545,8 @@ Preconditions: control-agent-server api GET "/api/mcp/oauth/status/$JB" --check callback_ready eq true --until-ok 20 control-agent-server api POST "/api/mcp/oauth/callback/$JB" --json '{"callback_url":"http://localhost:1/callback?code=x"}' --expect 400 \ --check detail eq 'Unexpected OAuth callback URL' - control-agent-server api POST "/api/mcp/oauth/callback/$JB" --json '{"callback_url":"http://localhost:99999/callback?code=x"}' --expect 400 --save F19.oauth-callback-bad-port/port-99999 # bug - control-agent-server api POST "/api/mcp/oauth/callback/$JB" --json '{"callback_url":"http://localhost:abc/callback?code=x"}' --expect 400 --save F19.oauth-callback-bad-port/port-abc # bug + control-agent-server api POST "/api/mcp/oauth/callback/$JB" --json '{"callback_url":"http://localhost:99999/callback?code=x"}' --expect 400 --save F19.oauth-callback-bad-port/port-99999 # bug: status eq 500 && response.body.exception contains 'Port out of range' + control-agent-server api POST "/api/mcp/oauth/callback/$JB" --json '{"callback_url":"http://localhost:abc/callback?code=x"}' --expect 400 --save F19.oauth-callback-bad-port/port-abc # bug: status eq 500 && response.body.exception contains 'Port could not be cast to integer' control-agent-server api GET "/api/mcp/oauth/status/$JB" --check status eq authorizing ``` Today both `# bug` posts are 500 (`Port out of range 0-65535`, diff --git a/.agents/skills/verify-agent-server/references/feature-map/F20-llm-profiles.md b/.agents/skills/verify-agent-server/references/feature-map/F20-llm-profiles.md index 02eaeabdebe..29e0e460c1a 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F20-llm-profiles.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F20-llm-profiles.md @@ -436,11 +436,11 @@ Preconditions: wait "$SAVER" wait "$LOCKER" control-agent-server api GET /api/profiles/qa-busy --expect 404 - jq -e '.elapsed_ms <= 3000' "$F20/busy-alive.json" # bug + control-agent-server assert --json "$F20/busy-alive.json" --check elapsed_ms le 3000 # bug: value.status eq 200 && value.elapsed_ms ge 15000 ``` Expected `/alive` to answer within 3 seconds while the save waits, as it does with the lock free. Today it answers 200 only when the save gives up, - about 25 seconds later, so the `jq` bound marked `# bug` fails: every + about 25 seconds later, so the bound marked `# bug` fails: every profile route is an `async def` that calls the synchronous, file-locked `LLMProfileStore` on the event loop (`profiles_router.py`), so a 30-second lock wait freezes the whole server, liveness and readiness probes @@ -508,14 +508,14 @@ Preconditions: --json '{"llm": {"model": "deepseek/deepseek-flash", "api_key": "sk-qa-f20-invalid-key", "num_retries": 0}}' \ --check valid eq false --check error.message contains authentication_error --check error.message not-contains sk-qa-f20-invalid-key \ --save F20.validate-bad-key-type/deepseek-401 | tee "$F20/bad-key.json" - jq -e '.response.body.error.type == "LLMAuthenticationError"' "$F20/bad-key.json" # bug + control-agent-server assert --json "$F20/bad-key.json" --check response.body.error.type eq LLMAuthenticationError # bug: value.status eq 200 && value.response.body.error.type eq LLMBadRequestError ``` The call itself proves the case: `valid: false`, and the provider's error passed through in `error.message` is DeepSeek's typed `"type":"authentication_error"`. Expected `error.type` `LLMAuthenticationError` (what an OpenAI-compatible 401 gives in `F20.validate-provider-errors`). Today it is `LLMBadRequestError`, so the - `jq` check marked `# bug` fails: DeepSeek answers HTTP 401 with + check marked `# bug` fails: DeepSeek answers HTTP 401 with `Authentication Fails, Your api key: ... is invalid`, LiteLLM raises it as `BadRequestError`, and the SDK's auth heuristics (`AUTH_PATTERNS` in `openhands-sdk/openhands/sdk/llm/exceptions/classifier.py`) match neither @@ -583,11 +583,11 @@ Preconditions: --json '{"llm": {"model": "openai/qa-unreachable", "base_url": "http://127.0.0.1:9/v1", "api_key": "qa-key"}}' \ --check valid eq false --check error.type eq LLMServiceUnavailableError \ --save F20.validate-unreachable-bounded/default-retries | tee "$F20/unreachable.json" - jq -e '.elapsed_ms <= 30000' "$F20/unreachable.json" # bug + control-agent-server assert --json "$F20/unreachable.json" --check elapsed_ms le 30000 # bug: value.status eq 200 && value.elapsed_ms ge 90000 ``` The client waits long enough for the server's own answer, so the call proves the server is up and its verdict is right (`valid: false`, - `LLMServiceUnavailableError`); the `jq` bound marked `# bug` then checks + `LLMServiceUnavailableError`); the bound marked `# bug` then checks how long that took. Expected a verdict within 30 s. Today it takes about 120 s (`elapsed_ms` near 121000): `validate` calls the posted LLM unchanged, so a connection error is retried with the LLM's defaults @@ -607,10 +607,10 @@ Preconditions: control-agent-server restart --hard control-agent-server api GET /api/profiles --expect 200 --check active_profile eq deepseek-flash test "$RC" = 0 || jq -e '.exit == 3 and (.error // "" | startswith("ReadTimeout"))' "$F20/hang.json" - test "$RC" = 0 # bug + control-agent-server assert --json "$F20/hang.json" --check ok eq true # bug: value.exit eq 3 && value.error matches '^ReadTimeout' ``` Expected a verdict within 30 s (the CLI's `--timeout 30` is the bound). - Today the CLI gives up with a client `ReadTimeout`, so `test "$RC" = 0` + Today the CLI gives up with a client `ReadTimeout`, so the check of `hang.json` marked `# bug` fails. The lines before it make that failure mean the bug and nothing else: the stub logged the request (the server reached the provider; today it is still waiting on that first attempt), @@ -891,14 +891,14 @@ Preconditions: control-agent-server api DELETE /api/agent-profiles/qa-f20-alias-agent --expect 200 control-agent-server api DELETE /api/profiles/qa-alias --expect 200 control-agent-server api GET /api/profiles --check profiles not-contains '"name": "qa-alias"' - jq -e '.status == 409' "$F20/alias-delete.json" # bug - jq -e '.status == 200' "$F20/alias-after.json" # bug + control-agent-server assert --json "$F20/alias-delete.json" --check status eq 409 # bug: value.status eq 200 && value.response.body.message eq "Profile 'qa-alias.json' deleted" + control-agent-server assert --json "$F20/alias-after.json" --check status eq 200 # bug: value.status eq 404 && value.response.body.detail eq "Profile 'qa-alias' not found" ``` Expected the alias delete to be 409 like the plain one (positive control: `DELETE /api/profiles/qa-alias` is 409, and `GET .../qa-alias.json` reads the same profile), and `qa-alias` to survive it. The alias delete and the read after it accept either outcome and are recorded; cleanup runs; then - the first `jq` marked `# bug` checks the delete's status (the second, the + the first line marked `# bug` checks the delete's status (the second, the profile's survival, each alone encoding the bug). Today the alias delete answers 200 `Profile 'qa-alias.json' deleted` and `qa-alias` is gone while `qa-f20-alias-agent` still cites it: the store @@ -922,7 +922,7 @@ Preconditions: control-agent-server state cat home/.openhands/profiles/qa-rotate.json --check api_key matches '^gAAAAA' control-agent-server api GET /api/profiles/qa-rotate --header 'X-Expose-Secrets: plaintext' --expect 2xx,4xx --save F20.secret-key-rotation/detail control-agent-server api GET /api/profiles --expect 2xx,4xx --save F20.secret-key-rotation/list - control-agent-server api POST /api/profiles/qa-rotate/activate --expect 4xx --save F20.secret-key-rotation/activate # bug + control-agent-server api POST /api/profiles/qa-rotate/activate --expect 4xx --save F20.secret-key-rotation/activate # bug: status eq 200 && response.body.message contains 'activated and applied' control-agent-server api GET /api/settings --max-chars 200 --check active_profile eq deepseek-flash control-agent-server state cat home/.openhands/settings.json --max-chars 200 --check agent_settings.llm.api_key matches '^gAAAAA' ``` diff --git a/.agents/skills/verify-agent-server/references/feature-map/F21-agent-profiles.md b/.agents/skills/verify-agent-server/references/feature-map/F21-agent-profiles.md index 62b09e55b45..b12612ca715 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F21-agent-profiles.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F21-agent-profiles.md @@ -869,7 +869,7 @@ printf -- '---\nname: qa-f21-skill\ndescription: QA F21 user skill\n---\nQA_F21_ flock -w 5 9 (exec 9>&- >/dev/null 2>&1; control-agent-server api GET /api/agent-profiles/qa-f21-coder --timeout 90 --quiet) & sleep 5 - control-agent-server api GET /alive --auth none --expect 200 --timeout 60 --expect-max-ms 2000 --save F21.busy-blocks-server/alive # bug + control-agent-server api GET /alive --auth none --expect 200 --timeout 60 --expect-max-ms 2000 --save F21.busy-blocks-server/alive # bug: status eq 200 && elapsed_ms gt 2000 flock -u 9 wait ``` @@ -894,7 +894,9 @@ printf -- '---\nname: qa-f21-skill\ndescription: QA F21 user skill\n---\nQA_F21_ --json '{"profile": {"llm_profile_ref": "qa-f21-missing", "tools": [], "mcp_server_refs": []}}' \ --check valid eq false --check llm_profile_ref eq qa-f21-missing --check llm_profile_resolved eq false \ --check errors contains "LLM profile 'qa-f21-missing' not found" --save F21.dangling-llm-report/materialize - if grep -q dangling_llm_profile_ref "$SEEDSRC"; then jq -e '.dangling_llm_profile_ref == "qa-f21-missing"' "$RAW" >/dev/null; fi # bug + PROMISED=$(grep -c dangling_llm_profile_ref "$SEEDSRC" || true) + jq -c --argjson promised "${PROMISED:-0}" '{promised: ($promised > 0), reported: .dangling_llm_profile_ref} | .agree = ((.promised | not) or .reported == "qa-f21-missing")' "$RAW" \ + | control-agent-server assert --check agree eq true # bug: value.promised eq true && value.reported missing ``` Correct behavior: the two agree, either because materialize names the dangling reference in `dangling_llm_profile_ref` (as it names dangling @@ -939,7 +941,7 @@ printf -- '---\nname: qa-f21-skill\ndescription: QA F21 user skill\n---\nQA_F21_ "export const diagnostics: Shape = $DIAG;" > "$D/exported.ts" TSC="clients/typescript/node_modules/.bin/tsc --noEmit --strict --skipLibCheck --target es2020 --module esnext --moduleResolution bundler" $TSC "$D/contract.ts" - $TSC "$D/exported.ts" # bug + $TSC "$D/exported.ts" | control-agent-server assert --check . not-contains 'error TS' # bug: value matches 'TS2353.*disabled_skills.*Shape' && value matches 'TS2353.*acp_startup_timeout.*Shape' && value matches 'TS2353.*resolved_mcp_config_keys.*Shape' ``` Expected: both files type-check, so a TypeScript consumer (Agent Canvas's profile editor) can read every field the server sends under its @@ -965,9 +967,9 @@ printf -- '---\nname: qa-f21-skill\ndescription: QA F21 user skill\n---\nQA_F21_ control-agent-server api POST /api/agent-profiles/qa-f21-suffix.json --json '{"llm_profile_ref": "deepseek-pro"}' --expect 201 control-agent-server api GET /api/agent-profiles/qa-f21-suffix.json --check profile.llm_profile_ref eq deepseek-pro \ --save F21.json-suffix-identity/after-overwrite - control-agent-server api GET /api/agent-profiles/qa-f21-suffix.json --check profile.id eq "$J1" --check profile.revision eq 1 # bug + control-agent-server api GET /api/agent-profiles/qa-f21-suffix.json --check profile.id eq "$J1" --check profile.revision eq 1 # bug: status eq 200 && checks.0.ok eq false && response.body.profile.revision eq 0 control-agent-server api DELETE /api/agent-profiles/qa-f21-suffix.json --expect 200 - control-agent-server api GET /api/settings --check active_agent_profile_id missing # bug + control-agent-server api GET /api/settings --check active_agent_profile_id missing # bug: status eq 200 && response.body.active_agent_profile_id exists else control-agent-server api POST /api/agent-profiles/qa-f21-suffix.json --json '{"llm_profile_ref": "deepseek-flash"}' --expect 422 control-agent-server state ls 'home/.openhands/agent-profiles/qa-f21-suffix*' --expect-count 0 diff --git a/.agents/skills/verify-agent-server/references/feature-map/F22-meta-profiles.md b/.agents/skills/verify-agent-server/references/feature-map/F22-meta-profiles.md index 801f152ac9c..39560b1b2c8 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F22-meta-profiles.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F22-meta-profiles.md @@ -221,7 +221,7 @@ Preconditions: trap drop_empty EXIT control-agent-server api GET /api/meta-profiles/qa-empty --expect 404 control-agent-server api POST /api/meta-profiles/qa-empty --json '{"classifier_model": "deepseek-flash"}' --expect 422 \ - --save F22.empty-router/save # bug + --save F22.empty-router/save # bug: status eq 201 && response.body.name eq qa-empty control-agent-server api GET /api/meta-profiles/qa-empty --expect 404 control-agent-server api GET /api/meta-profiles --check meta_profiles len-eq 2 ``` @@ -472,7 +472,7 @@ Preconditions: | tee "$F22/acp-activate.json" control-agent-server api GET /api/meta-profiles --check active_meta_profile eq null --save F22.activate-acp/list control-agent-server api GET /api/settings --max-chars 200 --check active_meta_profile eq null --check agent_settings.agent_kind eq acp - jq -e '.status >= 400 and .status < 500' "$F22/acp-activate.json" # bug + control-agent-server assert --json "$F22/acp-activate.json" --check status ge 400 --check status lt 500 # bug: value.status eq 200 && value.response.body.message eq "Meta-profile 'qa-direct' activated" ``` Expected a 4xx: settings that cannot attach the routing tool should refuse the activation, the way `PersistedSettings` refuses to record it. Today the @@ -529,7 +529,7 @@ Preconditions: test "$(cat "$S")" = '{"agent_settings": ' restore_settings control-agent-server api GET /api/meta-profiles --check active_meta_profile eq qa-direct - jq -e '.status == 409' "$F22/corrupt-settings-activate.json" # bug + control-agent-server assert --json "$F22/corrupt-settings-activate.json" --check status eq 409 # bug: value.status eq 500 && value.response.body.exception contains 'Cannot load settings from' ``` Expected 409, as `POST /api/profiles/{name}/activate` answers for the same file (`Settings file is corrupted or encrypted with a different key`; the @@ -600,12 +600,12 @@ Preconditions: for i in $(seq 6); do sleep 2 control-agent-server api GET /alive --auth none --expect 200 --expect-max-ms 3000 --timeout 60 --quiet \ - --save F22.store-busy-responsive/alive || { SLOW=$i; break; } + --save F22.store-busy-responsive/alive | tee "$F22/alive-probe.json" || { SLOW=$i; break; } done wait "$SAVER" wait "$LOCKER" control-agent-server api GET /api/meta-profiles/qa-busy --expect 404 - test "$SLOW" = 0 # bug + control-agent-server assert --json "$F22/alive-probe.json" --check ok eq true # bug: value.status eq 200 && value.elapsed_ms ge 10000 ``` Expected every `/alive` probe to answer within 3 seconds while the save waits. Today the first probe that overlaps the save takes about 28 @@ -614,7 +614,8 @@ Preconditions: (`meta_profiles_router.py`), so a 30-second lock wait freezes the whole server, probes included (the same defect as `F20.store-busy-responsive`). `SLOW` is the number of the first slow probe; its exchange (with - `elapsed_ms`) is in the bullet's transcript. + `elapsed_ms`) is in the bullet's transcript and in `alive-probe.json`, + which the line marked `# bug` checks. - **Limit (`F22.limit`).** Fill the store to 50, then create and overwrite. ```sh N=$(control-agent-server api GET /api/meta-profiles --field meta_profiles | jq length) @@ -665,7 +666,7 @@ Preconditions: control-agent-server api POST /api/meta-profiles/qa-tilde/activate --run "$T" --expect 200 control-agent-server api GET /api/meta-profiles --run "$T" --check meta_profiles len-eq 1 --check active_meta_profile eq qa-tilde control-agent-server state ls 'home/qa-f22-tilde/settings.json' --run "$T" --expect-count 1 - control-agent-server state ls 'home/qa-f22-tilde/meta-profiles/qa-tilde.json' --run "$T" --expect-count 1 # bug + control-agent-server state ls 'home/qa-f22-tilde/meta-profiles/qa-tilde.json' --run "$T" --expect-count 1 # bug: count eq 0 ``` `settings.json` lands in `home/qa-f22-tilde/` (the settings store expands `~` through `get_user_persistence_dir`). Expected the meta-profile next to diff --git a/.agents/skills/verify-agent-server/references/feature-map/F23-llm-catalog-and-connections.md b/.agents/skills/verify-agent-server/references/feature-map/F23-llm-catalog-and-connections.md index 7f43efde025..d7793c41362 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F23-llm-catalog-and-connections.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F23-llm-catalog-and-connections.md @@ -208,14 +208,14 @@ Preconditions: - **No Bedrock ids under a provider (`F23.models-no-bedrock`), known bug.** The route says Bedrock models are excluded without AWS credentials. Both lists are first shown to hold the provider's own ids (positive controls), - then each is searched for Bedrock ids, which `debug` prints to stderr. + then each is searched for Bedrock ids, which the `assert` prints. ```sh control-agent-server api GET /api/llm/models --query provider=deepseek --quiet --check models contains deepseek/deepseek-flash \ --save F23.models-no-bedrock/deepseek control-agent-server api GET /api/llm/models --query provider=anthropic --quiet --check models len-ge 1 --save F23.models-no-bedrock/anthropic control-agent-server api GET /api/llm/models --query provider=anthropic --field models | jq -e 'any(.[]; startswith("claude-"))' - control-agent-server api GET /api/llm/models --query provider=deepseek --field models | jq -e 'map(select(test("^deepseek\\."))) | debug | length == 0' # bug - control-agent-server api GET /api/llm/models --query provider=anthropic --field models | jq -e 'map(select(test("^anthropic\\."))) | debug | length == 0' # bug + control-agent-server api GET /api/llm/models --query provider=deepseek --field models | jq -c 'map(select(test("^deepseek\\.")))' | control-agent-server assert --check . len-eq 0 # bug: value len-ge 1 && value contains deepseek. + control-agent-server api GET /api/llm/models --query provider=anthropic --field models | jq -c 'map(select(test("^anthropic\\.")))' | control-agent-server assert --check . len-eq 0 # bug: value len-ge 1 && value contains anthropic.claude- ``` Expected: no id in the Bedrock `vendor.model` form under either provider. Today `?provider=deepseek` lists `deepseek.r1-v1:0`, `deepseek.v3-v1:0` @@ -350,7 +350,7 @@ Preconditions: --expect 201,422 --save F23.conn-create-blank-key/placeholder | jq -r .status) control-agent-server api GET /api/llm/provider-connections --save F23.conn-create-blank-key/list echo "whitespace key: $S_SPACE, placeholder key: $S_MASK" - test "$S_SPACE $S_MASK" = '422 422' # bug + control-agent-server assert --value "$S_SPACE $S_MASK" --check . eq '422 422' # bug: value eq '201 201' control-agent-server api GET /api/llm/provider-connections --check . len-eq 2 --check . not-contains qa-f23-blank- ``` Expected: both are 422 like `""`, and nothing is created. Today both are @@ -461,7 +461,7 @@ Preconditions: control-agent-server api PATCH "/api/llm/provider-connections/$DEF" --json '{"api_key": "sk-qa-f23-default"}' --expect 200 --quiet > /dev/null done echo "applied keys: $APPLIED" - test "$APPLIED" = '[sk-qa-f23-default][sk-qa-f23-default][sk-qa-f23-default]' # bug + control-agent-server assert --value "$APPLIED" --check . eq '[sk-qa-f23-default][sk-qa-f23-default][sk-qa-f23-default]' # bug: value eq '[null][null][**********]' ``` Before any blank `PATCH`, activating the probe applies `sk-qa-f23-default` (positive control). @@ -515,7 +515,7 @@ Preconditions: | control-agent-server api POST /api/profiles/qa-f23-draft/validate --stdin --timeout 120 --expect 200 --check valid eq true control-agent-server api POST /api/profiles/qa-f23-draft/validate --timeout 120 --expect 200 \ --json "{\"llm\": {\"model\": \"deepseek/deepseek-flash\", \"provider_connection_id\": \"$CONN\", \"num_retries\": 0}}" \ - --save F23.validate-linked-draft/linked --check valid eq true --check error eq null # bug + --save F23.validate-linked-draft/linked --check valid eq true --check error eq null # bug: status eq 200 && response.body.valid eq false && response.body.error.type eq LLMAuthenticationError ``` Expected: both `valid: true`, since a linked draft runs on the connection's key once saved and activated. Today the linked draft is @@ -635,7 +635,7 @@ Preconditions: control-agent-server api GET /api/llm/provider-connections --timeout 60 --expect 200 --quiet --save F23.store-busy-responsive/list > /dev/null & LISTER=$! sleep 5 - control-agent-server api GET /alive --auth none --expect 200 --expect-max-ms 3000 --timeout 60 --save F23.store-busy-responsive/alive # bug + control-agent-server api GET /alive --auth none --expect 200 --expect-max-ms 3000 --timeout 60 --save F23.store-busy-responsive/alive # bug: status eq 200 && elapsed_ms gt 3000 wait "$LISTER" test $((SECONDS - T0)) -ge 10 wait "$LOCKER" diff --git a/.agents/skills/verify-agent-server/references/feature-map/F24-openai-subscription.md b/.agents/skills/verify-agent-server/references/feature-map/F24-openai-subscription.md index 5dbe5f5a4b6..6ad12091d85 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F24-openai-subscription.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F24-openai-subscription.md @@ -469,7 +469,7 @@ Preconditions: --check expires_at eq "$EXP5" bash "$F24/write-login.sh" "$OFF" -1000 >/dev/null control-agent-server api GET /api/llm/subscription/openai/status --run "$OFF" --expect 200 --check connected eq false \ - --save F24.status-offline/status # bug + --save F24.status-offline/status # bug: status eq 500 && response.body.exception contains 'All connection attempts failed' control-agent-server logs --run "$OFF" --grep 'Refreshing OpenAI access token' --expect-min 1 control-agent-server logs --run "$OFF" --grep 'Unhandled exception on GET' --expect-none ``` @@ -497,9 +497,9 @@ Preconditions: --expect 200 --check connected eq false bash "$F24/netgate.sh" down "$GP" control-agent-server api POST /api/llm/subscription/openai/device/start --run "$OUTAGE" --expect 502,503,504 \ - --save F24.device-start-offline/start # bug + --save F24.device-start-offline/start # bug: status eq 500 && response.body.exception contains 'All connection attempts failed' control-agent-server api POST /api/llm/subscription/openai/device/poll --run "$OUTAGE" --json "{\"device_code\": \"$DC4\"}" \ - --expect 502,503,504 --save F24.device-start-offline/poll # bug + --expect 502,503,504 --save F24.device-start-offline/poll # bug: status eq 500 && response.body.exception contains 'All connection attempts failed' control-agent-server logs --run "$OUTAGE" --grep 'Unhandled exception' --expect-none ``` Expected: a gateway status (502, 503 or 504) that tells the client OpenAI diff --git a/.agents/skills/verify-agent-server/references/feature-map/F25-skills.md b/.agents/skills/verify-agent-server/references/feature-map/F25-skills.md index 4b6aaec3f23..1147f1c3e05 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F25-skills.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F25-skills.md @@ -201,7 +201,7 @@ Preconditions: Requires: `F25.public-repo` ```sh - control-agent-server api GET /api/skills/marketplace --timeout 180 --expect 200 --check skills len-ge 1 --save F25.marketplace-public/catalog # bug + control-agent-server api GET /api/skills/marketplace --timeout 180 --expect 200 --check skills len-ge 1 --save F25.marketplace-public/catalog # bug: status eq 200 && response.body.skills len-eq 0 ``` The clone holds `.plugin/marketplace.json` with about 70 plugin entries whose sources are `./skills/`, so the catalog should list them. Today @@ -341,7 +341,7 @@ Preconditions: Install a SKILL.md whose YAML does not parse. ```sh control-agent-server api POST /api/skills/install --json '{"source": "'"$F/qa-f25-badyaml"'"}' --expect 422 \ - --save F25.install-bad-frontmatter/install # bug + --save F25.install-bad-frontmatter/install # bug: status eq 500 && response.body.exception contains 'while parsing' test ! -e "$I/qa-f25-badyaml" ``` An unparsable skill should be the documented 422 like the other invalid @@ -425,7 +425,7 @@ Preconditions: case "$DOC" in *"'$SRC'"*) control-agent-server api POST /api/skills/install --json '{"source": "'"$SRC"'"}' --timeout 240 --expect 200 \ - --check name eq github --save F25.install-documented-sources/documented # bug + --check name eq github --save F25.install-documented-sources/documented # bug: status eq 400 && response.body.detail contains 'Failed to fetch skill source' control-agent-server api DELETE /api/skills/installed/github --expect 200 ;; esac @@ -495,7 +495,7 @@ Preconditions: T2=$(control-agent-server api GET /api/skills/installed/qa-f25-src-skill --field installed_at) ls -d "$AGENT_SERVER_VERIFY_RUN"/home/.openhands/cache/extensions/qa-f25-src-*/.git control-agent-server api POST /api/skills/install --json '{"source": "file://'"$G"'", "repo_path": "skills/qa-f25-src-skill", "ref": "qa-f25-no-such-ref", "force": true}' \ - --expect 400 --save F25.install-unknown-ref/cached # bug + --expect 400 --save F25.install-unknown-ref/cached # bug: status eq 200 && response.body.name eq qa-f25-src-skill control-agent-server api GET /api/skills/installed/qa-f25-src-skill --expect 200 --check installed_at eq "$T2" ``` The first clone fails (`git clone --branch qa-f25-no-such-ref`), so the @@ -516,7 +516,7 @@ Preconditions: control-agent-server api POST /api/skills/install --json '{"source": "'"$F/tmp/qa-f25-gone"'"}' --expect 200 rm -rf "$F/tmp/qa-f25-gone" control-agent-server api POST /api/skills/install --json '{"source": "'"$F/tmp/qa-f25-gone"'"}' --expect 400 --check detail contains 'Failed to fetch' - control-agent-server api POST /api/skills/installed/qa-f25-gone/refresh --expect 400,422 --save F25.refresh-unfetchable/refresh # bug + control-agent-server api POST /api/skills/installed/qa-f25-gone/refresh --expect 400,422 --save F25.refresh-unfetchable/refresh # bug: status eq 500 && response.body.exception contains 'Local extension path does not exist' control-agent-server api GET /api/skills/installed/qa-f25-gone --expect 200 --check enabled eq true ``` The source cannot be fetched: installing from the vanished path again is @@ -591,7 +591,7 @@ Preconditions: trap 'git -C "$PUB" remote set-url origin "$E"' EXIT git -C "$PUB" remote set-url origin "$F/qa-f25-unreachable" if git -C "$PUB" fetch -q origin 2>/dev/null; then false; fi - control-agent-server api POST /api/skills/sync --expect 200 --check status eq error --save F25.sync-offline/sync # bug + control-agent-server api POST /api/skills/sync --expect 200 --check status eq error --save F25.sync-offline/sync # bug: status eq 200 && response.body.status eq success ``` The origin is unreachable (a plain `git fetch` fails before the sync), and the server's fetch fails too (the log shows `Failed to fetch updates`), so the forced @@ -814,7 +814,7 @@ Preconditions: test -f "$PUB/skills/qa-f25-pub-extra/SKILL.md" grep -q '"name": "qa-f25-pub-extra"' "$PUB/marketplaces/default.json" control-agent-server api GET /api/skills/marketplace --expect 200 --check skills contains '"name": "qa-f25-pub-extra"' \ - --save F25.marketplace-stale-cache/after-sync # bug + --save F25.marketplace-stale-cache/after-sync # bug: status eq 200 && response.body.skills contains '"name": "qa-f25-pub"' && response.body.skills not-contains qa-f25-pub-extra ``` The sync brings the new entry into the clone, so a refreshed catalog should list it. Today the catalog serves its module-level 5-minute cache: sync only diff --git a/.agents/skills/verify-agent-server/references/feature-map/F26-plugins.md b/.agents/skills/verify-agent-server/references/feature-map/F26-plugins.md index f765bbd6bd0..6005e216b6e 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F26-plugins.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F26-plugins.md @@ -301,7 +301,7 @@ Preconditions: --check resolved_ref eq "$H1" --save F26.install-repo-root-name/install --field name) control-agent-server api DELETE "/api/plugins/installed/$N" --expect 200 control-agent-server api GET "/api/plugins/installed/$N" --expect 404 - test "$N" = qa-f26-src # bug + control-agent-server assert --value "$N" --check . eq qa-f26-src # bug: value matches '^qa-f26-src-[0-9a-f]{16}$' ``` A manifest-less directory takes its directory's name, so the repository should install as `qa-f26-src`. Today it installs as @@ -387,7 +387,7 @@ Preconditions: case "$DOC" in *"'github:OpenHands/extensions/plugins/city-weather'"*) control-agent-server api POST /api/plugins/install --json '{"source": "github:OpenHands/extensions/plugins/city-weather"}' \ - --timeout 240 --expect 200 --check name eq city-weather --save F26.install-documented-source/documented # bug + --timeout 240 --expect 200 --check name eq city-weather --save F26.install-documented-source/documented # bug: status eq 400 && response.body.detail contains 'Failed to fetch plugin source' control-agent-server api DELETE /api/plugins/installed/city-weather --expect 200 ;; esac @@ -529,11 +529,11 @@ Preconditions: control-agent-server api GET /api/plugins/installed/qa-f26-adopted --expect 200 --check source eq local rm -rf "$F/tmp/qa-f26-gone" printf '{bad json' > "$F/tmp/qa-f26-broken/.plugin/plugin.json" - control-agent-server api POST /api/plugins/installed/qa-f26-gone/refresh --expect 400,422 --save F26.refresh-unfetchable/vanished # bug + control-agent-server api POST /api/plugins/installed/qa-f26-gone/refresh --expect 400,422 --save F26.refresh-unfetchable/vanished # bug: status eq 500 && response.body.exception contains 'Local extension path does not exist' control-agent-server api GET /api/plugins/installed/qa-f26-gone --expect 200 --check enabled eq true - control-agent-server api POST /api/plugins/installed/qa-f26-broken/refresh --expect 422 --save F26.refresh-unfetchable/invalid # bug + control-agent-server api POST /api/plugins/installed/qa-f26-broken/refresh --expect 422 --save F26.refresh-unfetchable/invalid # bug: status eq 500 && response.body.exception contains 'Invalid JSON' control-agent-server api GET /api/plugins/installed/qa-f26-broken --expect 200 --check version eq 0.1.0 - control-agent-server api POST /api/plugins/installed/qa-f26-adopted/refresh --expect 400,422 --save F26.refresh-unfetchable/local # bug + control-agent-server api POST /api/plugins/installed/qa-f26-adopted/refresh --expect 400,422 --save F26.refresh-unfetchable/local # bug: status eq 500 && response.body.exception contains 'Unable to parse extension source' control-agent-server api GET /api/plugins/installed/qa-f26-adopted --expect 200 --check source eq local ``` The install route answers an unfetchable source with 400 and an invalid @@ -646,9 +646,9 @@ Preconditions: control-agent-server ws read qa-f26-resume --kinds MessageEvent --contains '"text": "/qa-f26-inst:qa-hello"' --expect-min 1 --wait 30 control-agent-server ws read qa-f26-resume --kinds HookExecutionEvent --contains QA_F26_INST_HOOK --expect-none control-agent-server ws stop qa-f26-resume --kinds MessageEvent --contains '"activated_skills": ["qa-f26-inst:qa-hello"]' --expect-none \ - --save F26.conversation-resume-disabled/frames # bug + --save F26.conversation-resume-disabled/frames # bug: matching ge 1 control-agent-server api GET "/api/conversations/$CIDR" --query include_skills=true --expect 200 \ - --check agent.agent_context.skills not-contains qa-f26-inst --save F26.conversation-resume-disabled/conversation # bug + --check agent.agent_context.skills not-contains qa-f26-inst --save F26.conversation-resume-disabled/conversation # bug: status eq 200 && response.body.agent.agent_context.skills contains qa-f26-inst ``` The conversation loaded the plugin before it was disabled (its hook ran for the prompt). Ambient plugins are not pinned to a conversation; on diff --git a/.agents/skills/verify-agent-server/references/feature-map/F27-hooks-subagents-tools.md b/.agents/skills/verify-agent-server/references/feature-map/F27-hooks-subagents-tools.md index 3c54a75e331..f27939cc4a6 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F27-hooks-subagents-tools.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F27-hooks-subagents-tools.md @@ -449,7 +449,7 @@ Preconditions: --json '{"role": "user", "content": [{"type": "text", "text": "hi"}], "run": false}' --expect 2xx \ --save F27.subagents-bad-skill/send-control BCID=$(control-agent-server conversation start --workspace "$F/badskill" --no-run --tools terminal --no-autotitle --print-id) - control-agent-server api POST "/api/conversations/$BCID/events" --json '{"role": "user", "content": [{"type": "text", "text": "hi"}], "run": false}' --expect 2xx,4xx --save F27.subagents-bad-skill/send # bug + control-agent-server api POST "/api/conversations/$BCID/events" --json '{"role": "user", "content": [{"type": "text", "text": "hi"}], "run": false}' --expect 2xx,4xx --save F27.subagents-bad-skill/send # bug: status eq 500 && response.body.exception contains 'not found but was given to agent' ``` The same message to a conversation in a workspace without project agents is accepted (the control). A broken sub-agent definition should cost only @@ -741,9 +741,9 @@ Preconditions: W0=$(control-agent-server logs --grep 'Failed to import module' | jq -r .total_matching) control-agent-server restart --reset-config control-agent-server api GET "/api/conversations/$MCID" --expect 200 --check tool_module_qualnames.qa_f27_echo eq qa_f27_tools --quiet - control-agent-server api POST "/api/conversations/$MCID/events" --json '{"role": "user", "content": [{"type": "text", "text": "Reply with the single word ok."}], "run": false}' --expect 2xx,4xx --save F27.custom-tool-missing-on-resume/send # bug + control-agent-server api POST "/api/conversations/$MCID/events" --json '{"role": "user", "content": [{"type": "text", "text": "Reply with the single word ok."}], "run": false}' --expect 2xx,4xx --save F27.custom-tool-missing-on-resume/send # bug: status eq 500 && response.body.exception contains "Unknown kind 'QaF27EchoObservation'" control-agent-server logs --grep 'Failed to import module' --expect-min "$((W0 + 1))" - control-agent-server api GET "/api/conversations/$MCID/events/search" --expect 200 --check items len-ge 1 --quiet # bug + control-agent-server api GET "/api/conversations/$MCID/events/search" --expect 200 --check items len-ge 1 --quiet # bug: status eq 500 ``` `_prepare_persisted_runtime` logs `Failed to import module 'qa_f27_tools' ... Tool will not be available.` and promises to go on without the tool. @@ -761,7 +761,7 @@ Preconditions: --check tools contains '{"name": "browser_tool_set", "user_selectable": true, "usable": false' control-agent-server restart --env PLAYWRIGHT_BROWSERS_PATH="$PW" control-agent-server api GET /api/tools/catalog --expect 200 --quiet --check tools contains '{"name": "terminal", "user_selectable": true, "usable": true' - control-agent-server api GET /api/tools/catalog --expect 200 --quiet --check tools contains '{"name": "browser_tool_set", "user_selectable": true, "usable": true' --save F27.browser-playwright-path/catalog # bug + control-agent-server api GET /api/tools/catalog --expect 200 --check tools contains '{"name": "browser_tool_set", "user_selectable": true, "usable": true' --save F27.browser-playwright-path/catalog # bug: status eq 200 && response.body.tools contains '{"name": "browser_tool_set", "user_selectable": true, "usable": false' ``` The first check shows this server finds no Chromium on its own (no standard path, nothing in its private `~/.cache/ms-playwright`). Playwright @@ -830,7 +830,7 @@ Preconditions: Compare `/server_info` with the catalog on the same server. ```sh control-agent-server api GET /api/tools/catalog --expect 200 --quiet --check tools contains '{"name": "browser_tool_set", "user_selectable": true, "usable": false' - control-agent-server api GET /server_info --auth none --expect 200 --check usable_tools contains terminal --check usable_tools not-contains browser_tool_set --save F27.server-info-browser-disabled/server-info # bug + control-agent-server api GET /server_info --auth none --expect 200 --check usable_tools contains terminal --check usable_tools not-contains browser_tool_set --save F27.server-info-browser-disabled/server-info # bug: status eq 200 && response.body.usable_tools contains browser_tool_set ``` Conversations on this server never get the browser, and the catalog says so; `usable_tools` should agree. Today it still lists `browser_tool_set`: @@ -840,7 +840,7 @@ Preconditions: List the built-ins on the same server. ```sh control-agent-server api GET /api/tools/catalog --expect 200 --quiet --check tools contains '{"name": "browser_tool_set", "user_selectable": true, "usable": false' - control-agent-server api POST /api/sub-agents --json '{"load_user": false, "load_project": false}' --expect 200 --check agents contains '"name": "bash-runner"' --check agents not-contains '"name": "web-researcher"' --save F27.subagents-browser-disabled/builtins # bug + control-agent-server api POST /api/sub-agents --json '{"load_user": false, "load_project": false}' --expect 200 --check agents contains '"name": "bash-runner"' --check agents not-contains '"name": "web-researcher"' --save F27.subagents-browser-disabled/builtins # bug: status eq 200 && response.body.agents contains '"name": "web-researcher"' ``` `discover_builtin_agents(enable_browser=False)` drops `web-researcher`, whose only tool is `browser_tool_set`, but the route calls it with the diff --git a/.agents/skills/verify-agent-server/references/feature-map/F28-canvas-extensions.md b/.agents/skills/verify-agent-server/references/feature-map/F28-canvas-extensions.md index 53157141706..c7353949971 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F28-canvas-extensions.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F28-canvas-extensions.md @@ -912,7 +912,7 @@ Preconditions: test "$(sha256sum "$INST/qa-f28-notgz/backend/linux.tar.gz" | cut -d' ' -f1)" = \ "$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1]))["backend"]["artifacts"]["linux-amd64"]["sha256"])' "$INST/qa-f28-notgz/canvas-extension.json")" control-agent-server api POST /api/canvas-extensions/installed/qa-f28-notgz/backend/prepare --json "{\"revision\": \"$NREV\"}" \ - --expect 409 --save F28.prepare-corrupt-archive/prepare # bug + --expect 409 --save F28.prepare-corrupt-archive/prepare # bug: status eq 500 && response.body.exception contains 'not a gzip file' control-agent-server state ls 'home/.openhands/canvas-extensions/backends/approvals/qa-f28-notgz.json' --expect-count 0 control-agent-server state ls 'home/.openhands/canvas-extensions/backends/artifacts/qa-f28-notgz/**' --expect-count 0 ``` @@ -930,9 +930,9 @@ Preconditions: --expect 200 --check resolved_ref eq "$GV1" --quiet control-agent-server state ls 'home/.openhands/cache/extensions/qa-f28-git-*/canvas-extension.json' --expect-count 1 control-agent-server api POST /api/canvas-extensions/install --json "{\"source\": \"file://$GX\", \"ref\": \"qa-no-such-ref\", \"force\": true}" \ - --expect 400 --check detail contains 'Could not read canvas extension source' --save F28.install-ref-cached/unknown-ref # bug + --expect 400 --check detail contains 'Could not read canvas extension source' --save F28.install-ref-cached/unknown-ref # bug: status eq 200 && response.body.requested_ref eq qa-no-such-ref control-agent-server state cat home/.openhands/canvas-extensions/installed/.installed.json \ - --check extensions.qa-f28-git.requested_ref eq "$GV1" --check extensions.qa-f28-git.resolved_ref eq "$GV1" # bug + --check extensions.qa-f28-git.requested_ref eq "$GV1" --check extensions.qa-f28-git.resolved_ref eq "$GV1" # bug: content.extensions.qa-f28-git.requested_ref eq qa-no-such-ref control-agent-server api DELETE /api/canvas-extensions/installed/qa-f28-git --expect 200 --quiet ``` The pinned install leaves exactly one cached clone of the source. Expected: @@ -960,7 +960,7 @@ Preconditions: curl -fsS "http://127.0.0.1:$FPORT/fast" test "$(curl -fsS -m 3 "http://127.0.0.1:$FPORT/health")" = ok control-agent-server api GET /api/canvas-extensions/installed/qa-f28-flaky/backend --until-ok 5 --check state eq ready \ - --save F28.status-probe-latch/after-recovery # bug + --save F28.status-probe-latch/after-recovery # bug: status eq 200 && response.body.state eq unhealthy control-agent-server api POST /api/canvas-extensions/installed/qa-f28-flaky/backend/stop --expect 200 --check state eq stopped --quiet ``` Expected: once `/health` answers in time again (the direct `curl` shows it @@ -1020,7 +1020,7 @@ Preconditions: control-agent-server restart --hard control-agent-server api GET /api/canvas-extensions/installed/qa-orphan/backend --check state eq stopped \ --check pid eq null --save F28.hard-restart-orphan/status-after-crash - if pgrep -f "$BK/artifacts/qa-orphan/"; then false; fi # bug + control-agent-server assert --value "$(pgrep -f "$BK/artifacts/qa-orphan/" || true)" --check . eq '' # bug: value matches '^[0-9]+' ``` Expected: no backend process of the dead server remains once the server is back (reaped at startup, or tied to the server's lifetime). Actual: the diff --git a/.agents/skills/verify-agent-server/references/feature-map/F29-app-backend-bridge.md b/.agents/skills/verify-agent-server/references/feature-map/F29-app-backend-bridge.md index f7077ca1356..06cad84c2e1 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F29-app-backend-bridge.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F29-app-backend-bridge.md @@ -362,9 +362,9 @@ control-agent-server api POST /api/canvas-extensions/installed/qa-headers/backen --check app eq qa-backend control-agent-server api POST /app-backends/qa-backend/session --header 'Origin: http://localhost:3000' \ --header 'X-Forwarded-Proto: https' --expect 200 --check ingress_url eq "$S/app-backends/qa-backend/" \ - --save F29.session-forwarded-proto/session # bug + --save F29.session-forwarded-proto/session # bug: status eq 421 && response.body.detail contains 'must use the configured ingress origin' control-agent-server api GET /app-backends/qa-backend/echo --auth none --cookie "oh_app_backend_session=$FP" \ - --header 'X-Forwarded-Proto: https' --expect 200 --check app eq qa-backend --save F29.session-forwarded-proto/proxy # bug + --header 'X-Forwarded-Proto: https' --expect 200 --check app eq qa-backend --save F29.session-forwarded-proto/proxy # bug: status eq 421 && response.body.detail contains 'must use the configured ingress origin' ``` The same bootstrap and proxied GET without the header answer 200 first. Expected: 200 for both with the header too. Actual: 421 `Canvas App @@ -528,11 +528,11 @@ control-agent-server api POST /api/canvas-extensions/installed/qa-headers/backen --cookie "oh_app_backend_session=$RP" --expect 200 --check path eq / --check query.path eq echo control-agent-server api GET /app-backends/qa-backend --query path=echo --auth none \ --cookie "oh_app_backend_session=$RP" --expect 200 --check path eq / --check query.path eq echo \ - --save F29.proxy-root-path-query/get # bug + --save F29.proxy-root-path-query/get # bug: status eq 200 && response.body.path eq /echo control-agent-server api GET /app-backends/qa-backend --query 'path=..' --auth none \ - --cookie "oh_app_backend_session=$RP" --expect 200 --check path eq / --check query.path eq .. # bug + --cookie "oh_app_backend_session=$RP" --expect 200 --check path eq / --check query.path eq .. # bug: status eq 400 && response.body.detail eq 'Invalid backend path' control-agent-server ws listen /app-backends/qa-backend --query path=ws --auth none --header "Origin: $S" \ - --header "Cookie: oh_app_backend_session=$RP" --send qa-f29-root --duration 5 --expect-close 1011 --expect-frames 0 # bug + --header "Cookie: oh_app_backend_session=$RP" --send qa-f29-root --duration 5 --expect-close 1011 --expect-frames 0 # bug: first_frames.0.frame contains qa-f29-root ``` The controls first: the bare root with another query parameter, and the trailing-slash root with `?path=echo`, both reach `/` with the query @@ -577,11 +577,11 @@ control-agent-server api POST /api/canvas-extensions/installed/qa-headers/backen if grep -qi '"transfer-encoding"' <<<"$DIRECT_POST"; then false; fi control-agent-server api GET /app-backends/qa-headers/echo --auth none --cookie "oh_app_backend_session=$FR" --expect 200 \ --check method eq GET --check body eq '' --check headers.transfer-encoding missing \ - --save F29.proxy-request-framing/get # bug + --save F29.proxy-request-framing/get # bug: status eq 200 && response.body.headers.transfer-encoding eq chunked control-agent-server api POST /app-backends/qa-headers/echo --auth none --cookie "oh_app_backend_session=$FR" \ --header "Origin: $S" --json '{"qa": "body"}' --expect 200 --check body eq '{"qa":"body"}' \ --check headers.content-length eq 13 --check headers.transfer-encoding missing \ - --save F29.proxy-request-framing/post # bug + --save F29.proxy-request-framing/post # bug: status eq 200 && response.body.headers.transfer-encoding eq chunked ``` Directly, the backend sees no `Transfer-Encoding` on a GET and `Content-Length: 13` on the POST. Expected: the same through the bridge. @@ -623,7 +623,7 @@ control-agent-server api POST /api/canvas-extensions/installed/qa-headers/backen test -n "$RH" control-agent-server api GET /app-backends/qa-backend/echo --auth none --cookie "oh_app_backend_session=$RH" --expect 200 \ --check-header date matches '^[A-Z][a-z]{2}, [0-9]{2} [A-Z][a-z]{2} [0-9]{4} [0-9:]{8} GMT$' \ - --check-header server not-contains ', ' --all-headers --save F29.proxy-response-headers/echo # bug + --check-header server not-contains ', ' --all-headers --save F29.proxy-response-headers/echo # bug: status eq 200 && checks.0.actual contains 'GMT, ' && checks.1.actual contains aiohttp ``` The controls: a route the server answers itself carries one `Date` and `server: uvicorn`, and the backend answered directly sends one of each. @@ -713,7 +713,7 @@ control-agent-server api POST /api/canvas-extensions/installed/qa-headers/backen control-agent-server exec --expect-output 'subprotocol=qa.v1' --expect-output '"protocol": "qa.v1"' \ --save F29.ws-subprotocol/bridged -- "$PWD/.venv/bin/python" -c \ 'import sys; from websockets.sync.client import connect; ws = connect(sys.argv[1], subprotocols=["qa.v1"], origin=sys.argv[2], additional_headers={"Cookie": "oh_app_backend_session=" + sys.argv[3]}, proxy=None); print("subprotocol=" + str(ws.subprotocol)); ws.send("qa-f29-proto"); print(ws.recv(timeout=10)); ws.close()' \ - "ws://127.0.0.1:$P/app-backends/qa-headers/ws" "$S" "$SP" # bug + "ws://127.0.0.1:$P/app-backends/qa-headers/ws" "$S" "$SP" # bug: stdout_tail contains subprotocol=None && stdout_tail contains '"protocol": "none"' ``` The controls: directly, the backend negotiates `qa.v1`; through the bridge, the same client without a subprotocol gets its echo with a fresh @@ -837,7 +837,7 @@ control-agent-server api POST /api/canvas-extensions/installed/qa-headers/backen CRASH_PID=$(control-agent-server api GET /api/canvas-extensions/installed/qa-backend/backend --expect 200 --check state eq ready --field pid) kill -TERM "$CRASH_PID" control-agent-server api GET /app-backends/qa-backend/echo --auth none --cookie "oh_app_backend_session=$CC" --until-ok 15 \ - --expect 503 --check exception eq '503: Canvas App backend is not ready' --save F29.backend-crash-detected/crashed # bug + --expect 503 --check exception eq '503: Canvas App backend is not ready' --save F29.backend-crash-detected/crashed # bug: status eq 502 && response.body.exception contains 'Conversation container unreachable' control-agent-server api GET /api/canvas-extensions/installed/qa-backend/backend --expect 200 --check state ne ready control-agent-server api POST /api/canvas-extensions/installed/qa-backend/backend/start --json "{\"revision\": \"$REV\"}" \ --expect 200 --check state eq ready diff --git a/.agents/skills/verify-agent-server/references/feature-map/F30-openai-gateway.md b/.agents/skills/verify-agent-server/references/feature-map/F30-openai-gateway.md index d061d3fd09c..cf742c17957 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F30-openai-gateway.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F30-openai-gateway.md @@ -414,7 +414,7 @@ control-agent-server api GET /api/settings --check conversation_settings.confirm --check stats.usage_to_metrics.default.accumulated_token_usage.prompt_tokens eq 13 \ --check stats.usage_to_metrics.default.accumulated_token_usage.completion_tokens eq 7 --quiet control-agent-server state cat fixtures/qa-f30/usage-2.json --check usage.prompt_tokens eq 3 \ - --check usage.completion_tokens eq 2 --check usage.total_tokens eq 5 # bug + --check usage.completion_tokens eq 2 --check usage.total_tokens eq 5 # bug: content.usage.prompt_tokens eq 13 && content.usage.completion_tokens eq 7 && content.usage.total_tokens eq 20 ``` The stub got exactly two model calls, one per request, so the second request's own usage is the stub's 3/2/5: the conversation's stats hold one @@ -456,7 +456,7 @@ control-agent-server api GET /api/settings --check conversation_settings.confirm --check items.1.llm_message.content.0.text eq QA_F30_RACE_B --check items.2.llm_message.content.0.text eq QA_F30_RACE_C \ --save F30.chat-reuse-concurrent/agent-messages wait "$XPID" || { cat "$F30/race-x.out"; false; } - control-agent-server state cat fixtures/qa-f30/race-x.json --check choices.0.message.content eq QA_F30_RACE_B # bug + control-agent-server state cat fixtures/qa-f30/race-x.json --check choices.0.message.content eq QA_F30_RACE_B # bug: content.choices.0.message.content eq QA_F30_RACE_C ``` The conversation answers X with `QA_F30_RACE_B` and finishes, then reruns for Y and answers `QA_F30_RACE_C`; Y gets `QA_F30_RACE_C`, and X's request @@ -630,7 +630,7 @@ control-agent-server api GET /api/settings --check conversation_settings.confirm test ! -e "$AGENT_SERVER_VERIFY_RUN/server/workspace/project/qa_f30_reconf.txt" wait "$XPID" || { cat "$F30/reconf-2.json"; false; } control-agent-server state cat fixtures/qa-f30/reconf-2.json --check status eq 409 \ - --check response.body.detail eq 'Agent run ended with status: waiting_for_confirmation' --check elapsed_ms lt 30000 # bug + --check response.body.detail eq 'Agent run ended with status: waiting_for_confirmation' --check elapsed_ms lt 30000 # bug: content.status eq 504 && content.response.body.exception contains 'Agent run timed out' ``` The second turn's model call proposes the command and the conversation is `waiting_for_confirmation` within seconds (the command not run), while the @@ -698,7 +698,7 @@ control-agent-server api GET /api/settings --check conversation_settings.confirm --expect 429 --expect-max-ms 10000 --save F30.chat-reuse-run-limit-429/retry control-agent-server api GET "/api/conversations/$HOLD2" --check execution_status eq running --quiet control-agent-server api GET "/api/conversations/$CID/events/search" --query source=user --query body=QA_F30_429_REUSE \ - --check items len-eq 0 --save F30.chat-reuse-run-limit-429/user-messages # bug + --check items len-eq 0 --save F30.chat-reuse-run-limit-429/user-messages # bug: status eq 200 && response.body.items len-ge 1 && response.body.items.0.source eq user ``` Both tries are refused with 429 at once while the holder still runs, and the same `body` search finds an earlier user turn of `CID` (so an empty diff --git a/.agents/skills/verify-agent-server/references/feature-map/F31-persistence-and-limits.md b/.agents/skills/verify-agent-server/references/feature-map/F31-persistence-and-limits.md index b9861d49e39..6bb35771601 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F31-persistence-and-limits.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F31-persistence-and-limits.md @@ -365,8 +365,8 @@ Preconditions: control-agent-server restart --hard control-agent-server api GET "/api/conversations/$Y/events/count" --run "$B" --expect 200 control-agent-server state cat owner_lease.json --conversation "$Y" --check owner_pid eq "$PIDB" --check generation eq 2 - control-agent-server state cat meta.json --conversation "$Y" --check title eq 'QA F31 after B' # bug - control-agent-server api GET "/api/conversations/$Y" --run "$B" --check title eq 'QA F31 after B' --save F31.takeover-keeps-metadata/get-after-takeover # bug + control-agent-server state cat meta.json --conversation "$Y" --check title eq 'QA F31 after B' # bug: content.title eq 'QA F31 before B' + control-agent-server api GET "/api/conversations/$Y" --run "$B" --check title eq 'QA F31 after B' --save F31.takeover-keeps-metadata/get-after-takeover # bug: status eq 200 && response.body.title eq 'QA F31 before B' ``` Expected: `B` reports and keeps the title the owner stored last. The owner's rename reached `meta.json` and `B`'s first load took `Y` over @@ -432,9 +432,9 @@ Preconditions: PS=$(control-agent-server api PATCH "/api/conversations/$F" --json '{"title": "QA F31 stale owner"}' --expect 4xx,5xx \ --save F31.fenced-write-no-trace/patch | jq .status) control-agent-server state cat meta.json --conversation "$F" --check title eq 'QA F31 new owner' - control-agent-server api GET "/api/conversations/$F" --check title ne 'QA F31 stale owner' --save F31.fenced-write-no-trace/get # bug + control-agent-server api GET "/api/conversations/$F" --check title ne 'QA F31 stale owner' --save F31.fenced-write-no-trace/get # bug: status eq 200 && response.body.title eq 'QA F31 stale owner' echo "refused PATCH answered $PS" - test "$PS" -lt 500 # bug + control-agent-server assert --value "$PS" --check . lt 500 # bug: value eq 500 ``` Expected: a client error that says the conversation is owned elsewhere, and no visible change. The refusal itself (any error status) and @@ -588,7 +588,7 @@ Preconditions: --env OH_APP_BACKEND_PUBLIC_URL_IS_NONE=1 control-agent-server config | jq -e '.config_file.app_backend_public_url == "http://qa-f31-file.invalid:9" and .server_env.OH_APP_BACKEND_PUBLIC_URL_IS_NONE == "1"' control-agent-server api GET /server_info --auth none --check app_backend_ingress_url missing \ - --check capabilities not-contains canvas_app_backend_bridge_v1 --save F31.config-null-override/server-info # bug + --check capabilities not-contains canvas_app_backend_bridge_v1 --save F31.config-null-override/server-info # bug: status eq 200 && response.body.app_backend_ingress_url eq http://qa-f31-file.invalid:9 ``` The file value is served, and a non-null variable replaces it (the positive controls); the config shows the file value and the `_IS_NONE` @@ -672,7 +672,7 @@ Preconditions: test -d "$TD" control-agent-server stop --run "$B" | jq -e '.server == "terminated"' trap 'rm -rf -- "$TD" || true' EXIT - test ! -e "$TD" # bug + control-agent-server assert --value "$([ -e "$TD" ] && echo true || echo false)" --check . eq false # bug: value eq true trap - EXIT ``` Expected: the directory is gone after a graceful stop (`stop` reports @@ -681,7 +681,7 @@ Preconditions: Today the server logs `TMUX_TMPDIR not set; defaulting to per-server tmux directory /tmp/openhands-agent-server-`, creates it, and at shutdown only removes the variable from its environment (`api_lifespan`), so every - such start leaves a directory in the temp dir and `test ! -e` fails. The + such start leaves a directory in the temp dir and the `assert` fails. The `trap` removes the leftover after the assertion. - **Storage retention and disk budget (`F31.storage-retention`), blocked.** Needs a Docker daemon and the `conversation_image` pulled diff --git a/.agents/skills/verify-agent-server/references/feature-map/F32-webhooks-and-telemetry.md b/.agents/skills/verify-agent-server/references/feature-map/F32-webhooks-and-telemetry.md index b73050b3f67..3309a69dae8 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F32-webhooks-and-telemetry.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F32-webhooks-and-telemetry.md @@ -245,7 +245,7 @@ Preconditions: control-agent-server conversation events "$BID" --kinds MessageEvent --contains QA_F32_BUFFER --expect-count 1 control-agent-server conversation events "$BID" --key last_user_message_id --expect-count 1 control-agent-server sink read --path "/qa-f32-b/events/${BID//-/}" --expect-min 1 --expect-max 1 - control-agent-server sink read --path "/qa-f32-b/events/${BID//-/}" --contains QA_F32_BUFFER --expect-min 1 --wait 10 --save F32.buffer-stranded/after-wait # bug + control-agent-server sink read --path "/qa-f32-b/events/${BID//-/}" --contains QA_F32_BUFFER --expect-min 1 --wait 10 --save F32.buffer-stranded/after-wait # bug: requests eq 0 ``` The message and its update are stored, and only the first batch was posted. Expected: the user message reaches the sink within 10 s. Actual: @@ -309,8 +309,8 @@ Preconditions: first queued event and is not reset. ```sh control-agent-server api GET /openapi.json --auth none --quiet --check 'components.schemas.InitRequest.properties.webhooks.anyOf.0.items.$ref' eq '#/components/schemas/WebhookSpec' --check components.schemas.WebhookSpec.properties.base_url.description exists --check components.schemas.WebhookSpec.properties.flush_delay.description exists - control-agent-server api GET /openapi.json --auth none --quiet --check components.schemas.WebhookSpec.properties.flush_delay.description not-contains 'Timer is reset on each new event' # bug - control-agent-server api GET /openapi.json --auth none --quiet --check components.schemas.WebhookSpec.properties.base_url.description not-contains 'Events will be sent to {base_url}/events and' # bug + control-agent-server api GET /openapi.json --auth none --quiet --check components.schemas.WebhookSpec.properties.flush_delay.description not-contains 'Timer is reset on each new event' # bug: status eq 200 && checks.0.actual contains 'Timer is reset on each new event' + control-agent-server api GET /openapi.json --auth none --quiet --check components.schemas.WebhookSpec.properties.base_url.description not-contains 'Events will be sent to {base_url}/events and' # bug: status eq 200 && checks.0.actual contains 'Events will be sent to {base_url}/events and' ``` Expected: descriptions that state the per-conversation path and a timer from the first event. Actual: `flush_delay` says "Timer is reset on each @@ -401,7 +401,7 @@ Preconditions: WCID=$(control-agent-server conversation start --tools none --no-autotitle --prompt 'Reply with exactly: ok' --wait --print-id) control-agent-server api GET "/api/conversations/$WCID" --check execution_status eq finished control-agent-server sink read --name qa-f32-slow --path "/events/${WCID//-/}" --expect-min 1 - control-agent-server api POST "/api/conversations/$WCID/run" --expect 200 --save F32.slow-receiver/run-after-finished # bug + control-agent-server api POST "/api/conversations/$WCID/run" --expect 200 --save F32.slow-receiver/run-after-finished # bug: status eq 409 && response.body.detail contains 'Conversation already running' ``` With the fast stand-in, `POST .../run` right after `finished` answers 200 (the conversation is finished, so that run ends without a model call). @@ -511,7 +511,7 @@ Preconditions: ```sh control-agent-server api GET "/api/conversations/$UCID" --check stats.usage_to_metrics.default.accumulated_token_usage.prompt_tokens gt 0 control-agent-server sink read --name qa-f32-telemetry --contains '"total_tokens_bucket": "' --expect-min 1 - control-agent-server sink read --name qa-f32-telemetry --contains '"total_tokens_bucket": "unknown"' --expect-max 0 --save F32.telemetry-usage-buckets/outcome # bug + control-agent-server sink read --name qa-f32-telemetry --contains '"total_tokens_bucket": "unknown"' --expect-max 0 --save F32.telemetry-usage-buckets/outcome # bug: requests ge 1 ``` Expected: a token bucket such as `1000-10000`. Actual: `unknown` (and `cost_bucket` `unknown`), although the conversation's stats hold the @@ -643,7 +643,7 @@ Preconditions: the server keys pseudonyms with its secret key. ```sh control-agent-server api GET /openapi.json --auth none --quiet --check 'components.schemas.InitRequest.properties.telemetry.anyOf.0.$ref' eq '#/components/schemas/TelemetrySpec' --check components.schemas.TelemetrySpec.properties.salt.description exists - control-agent-server api GET /openapi.json --auth none --quiet --check components.schemas.TelemetrySpec.properties.salt.description matches '(?i)secret' # bug + control-agent-server api GET /openapi.json --auth none --quiet --check components.schemas.TelemetrySpec.properties.salt.description matches '(?i)secret' # bug: status eq 200 && checks.0.actual contains 'per-process random salt' ``` Expected: the description names the secret-key fallback. Actual: "Falls back to a per-process random salt, which keeps pseudonyms stable within a @@ -682,7 +682,7 @@ Preconditions: ```sh control-agent-server sink read --name qa-f32-deferred --path /init --contains agent_server.server_started --expect-min 1 control-agent-server sink read --name qa-f32-deferred --path /init --contains '"deferred_init": ' --expect-min 1 - control-agent-server sink read --name qa-f32-deferred --path /init --contains '"deferred_init": true' --expect-min 1 --save F32.deferred-init-flag/events # bug + control-agent-server sink read --name qa-f32-deferred --path /init --contains '"deferred_init": true' --expect-min 1 --save F32.deferred-init-flag/events # bug: requests eq 0 ``` Expected: `deferred_init: true` in the runtime properties. Actual: `false` on every event, because `/api/init` builds the telemetry sink from the diff --git a/.agents/skills/verify-agent-server/references/feature-map/F33-sdk-remote-client.md b/.agents/skills/verify-agent-server/references/feature-map/F33-sdk-remote-client.md index 4abdfa3ca07..a7add6f8f24 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F33-sdk-remote-client.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F33-sdk-remote-client.md @@ -884,7 +884,7 @@ Preconditions: Requires: `F33.conversation-streaming` ```sh test "$(jq .deltas "$F33/stream.json")" -gt 0 - test "$(jq .tokens "$F33/stream.json")" -gt 0 # bug + control-agent-server assert --json "$F33/stream.json" --check tokens gt 0 # bug: value.tokens eq 0 && value.deltas gt 0 ``` The event callback got the deltas (control); today the token callback got `0` calls. @@ -897,7 +897,7 @@ Preconditions: Requires: `F33.conversation-streaming` ```sh test "$(jq '.local.MessageEvent // 0' "$F33/stream.json")" -eq "$(control-agent-server conversation events "$STREAM" --kinds MessageEvent | jq .matching)" - test "$(jq '.local.StreamingDeltaEvent // 0' "$F33/stream.json")" -eq 0 # bug + control-agent-server assert --json "$F33/stream.json" --check local.StreamingDeltaEvent missing # bug: value.local.StreamingDeltaEvent gt 0 ``` The stored kinds agree (control); today `state.events` also holds one `StreamingDeltaEvent` per delta (the same count as the callback saw). @@ -1088,7 +1088,7 @@ Preconditions: assert reads["agent"][0] == "Agent" and reads["is_confirmation_mode_active"][0] is True, reads f33.emit("reread", reads=reads, stable=all(first == second for first, second in reads.values())) PY - test "$(jq .stable "$F33/reread.json")" = true # bug + control-agent-server assert --json "$F33/reread.json" --check stable eq true # bug: value.reads.confirmation_policy.1 eq 'error: ValidationError' && value.reads.security_analyzer.1 eq NoneType ``` Each field is read on a freshly attached conversation, and every first read is right (control). Today the second read of `confirmation_policy` @@ -1442,7 +1442,7 @@ Preconditions: test "$(cat "$F33/longtool/qa-f33-long.txt")" = late control-agent-server conversation events "$LONG" --kinds ActionEvent --contains '"timeout": 90.0' --expect-count 1 control-agent-server api GET "/api/conversations/$LONG" --check execution_status eq finished --save F33.conversation-run-join-long-tool/get - test "$(jq .joined "$F33/longtool.json")" = true # bug + control-agent-server assert --json "$F33/longtool.json" --check joined eq true # bug: value.error contains ReadTimeout && value.status eq running ``` `run(blocking=False)` returns at once; once the 45 s command is running, the blocking `run()` should wait for it and return at `finished`. Today @@ -1731,7 +1731,7 @@ Preconditions: GAP=$(jq -r .cid "$F33/gap.json") control-agent-server api GET "/api/conversations/$GAP/events/search" --query source=user --check items len-eq 2 \ --check items.1.id eq "$(jq -r .message "$F33/gap.json")" --save F33.conversation-reconnect-callbacks/server-message - test "$(jq .callback_got_message "$F33/gap.json")" = true # bug + control-agent-server assert --json "$F33/gap.json" --check callback_got_message eq true # bug: value.callback_got_message eq false ``` The server stored both messages and, after the reconnect, `state.events` has both; the callback got the first one live, but today @@ -1934,7 +1934,7 @@ Preconditions: f33.emit("ghost", cid=cid, statuses=statuses, server_errors=sum(s >= 500 for s in statuses.values())) PY control-agent-server api GET /api/tools/ --check . contains terminal --check . not-contains qa_f33_ghost - test "$(jq .server_errors "$F33/ghost.json")" -eq 0 # bug + control-agent-server assert --json "$F33/ghost.json" --check server_errors eq 0 # bug: value.statuses.create eq 201 && value.statuses.message eq 500 ``` The server's registry lacks `qa_f33_ghost` (control). Today the probe records `{"create": 201, "message": 500}`; the server log has the diff --git a/.agents/skills/verify-agent-server/references/feature-map/F34-typescript-client.md b/.agents/skills/verify-agent-server/references/feature-map/F34-typescript-client.md index 4cef535de35..441e98dda0b 100644 --- a/.agents/skills/verify-agent-server/references/feature-map/F34-typescript-client.md +++ b/.agents/skills/verify-agent-server/references/feature-map/F34-typescript-client.md @@ -401,7 +401,7 @@ Preconditions: JS control-agent-server exec --timeout 60 --expect-output QA_F34_BINARY_READ --save F34.workspace-binary-download/program -- node "$F34/binary.mjs" cat "$F34/binary.json" - jq -e '.blob == [255, 0, 128, 254, 65] and .file_size == 5' "$F34/binary.json" # bug + control-agent-server assert --json "$F34/binary.json" --check blob eq '[255, 0, 128, 254, 65]' --check file_size eq 5 # bug: value.file_size eq 11 && value.blob eq '[239, 191, 189, 0, 239, 191, 189, 239, 191, 189, 65]' ``` Expected: the same five bytes and `file_size` 5. Today the blob holds 11 bytes (`[239,191,189,0,239,191,189,239,191,189,65]`: each invalid byte @@ -507,7 +507,7 @@ Preconditions: TSC="node clients/typescript/node_modules/typescript/bin/tsc --noEmit --strict --skipLibCheck --module nodenext --moduleResolution nodenext --target es2022" $TSC "$F34/git-contract.mts" $TSC "$F34/git-paths.mts" - $TSC "$F34/git-types.mts" # bug + $TSC "$F34/git-types.mts" | control-agent-server assert --check . eq '' # bug: value matches 'TS2322: Type ..UPDATED.. is not assignable' ``` Expected: both files type-check. Today the contract file compiles and the exported type fails with `Type '"UPDATED"' is not assignable to type @@ -591,7 +591,7 @@ Preconditions: JS control-agent-server exec --timeout 60 --expect-output QA_F34_BASH_WS_DONE --save F34.bash-websocket/program -- node "$F34/bash-ws.mjs" cat "$F34/bash-ws.json" - jq -e '.saw_output and .errors == []' "$F34/bash-ws.json" # bug + control-agent-server assert --json "$F34/bash-ws.json" --check saw_output eq true --check errors len-eq 0 # bug: value.saw_output eq false && value.errors contains 'WebSocket implementation not available' ``` Expected: the replayed `BashOutput` reaches the callback and `onError` is never called. Today `saw_output` is false with no frame, and `errors` @@ -795,8 +795,9 @@ Preconditions: JS control-agent-server exec --timeout 60 --expect-output QA_F34_UNKNOWN_EVENT_READ --save F34.events-unknown-id/program -- node "$F34/unknown-event.mjs" "$SCID" cat "$F34/unknown-event.json" - jq -e '.single.http_error and .single.status == 404' "$F34/unknown-event.json" # bug - jq -e '.batch.value == [.first, null]' "$F34/unknown-event.json" # bug + control-agent-server assert --json "$F34/unknown-event.json" --check single.http_error eq true --check single.status eq 404 # bug: value.single.status eq 500 && value.single.response.exception contains 'Unknown event_id' + control-agent-server assert --json "$F34/unknown-event.json" --check batch.value len-eq 2 --check batch.value.0 eq "$(jq -r .first "$F34/unknown-event.json")" \ + --check batch.value.1 missing # bug: value.batch.status eq 500 && value.batch.response.exception contains 'Unknown event_id' ``` Expected: a 404 `HttpError`, and `[, null]`. Today both calls reject with a 500 `HttpError` whose `response.exception` is @@ -827,7 +828,7 @@ Preconditions: JS control-agent-server exec --timeout 60 --expect-output QA_F34_KIND_READ --save F34.events-search-kind/program -- node "$F34/kind.mjs" "$SCID" cat "$F34/kind.json" - jq -e '.short == .full and .short_count == 1' "$F34/kind.json" # bug + control-agent-server assert --json "$F34/kind.json" --check short len-eq 1 --check short.0 eq "$(jq -r '.full[0]' "$F34/kind.json")" --check short_count eq 1 # bug: value.short len-eq 0 && value.short_count eq 0 ``` Expected: the short name finds the same message. Today it returns no items and a count of 0. @@ -913,7 +914,7 @@ Preconditions: JS control-agent-server exec --timeout 60 --expect-output QA_F34_CALLBACK_DONE --save F34.ws-callback-client/program -- node "$F34/callback.mjs" "$SCID" cat "$F34/callback.json" - jq -e '(.kinds | index("ConversationStateUpdateEvent")) != null and .errors == []' "$F34/callback.json" # bug + control-agent-server assert --json "$F34/callback.json" --check kinds contains ConversationStateUpdateEvent --check errors len-eq 0 # bug: value.kinds len-eq 0 && value.errors contains 'WebSocket implementation not available' ``` Expected: the snapshot reaches the conversation callback and `onError` is never called. Today `kinds` is empty and `errors` holds "WebSocket @@ -1005,7 +1006,7 @@ Preconditions: control-agent-server exec --timeout 60 --expect-output QA_F34_UPDATE_READ --save F34.manager-update-result/program -- node "$F34/update.mjs" "$SCID" control-agent-server api GET "/api/conversations/$SCID" --max-chars 300 --check title eq qa-f34-renamed cat "$F34/update.json" - jq -e --arg id "$SCID" '.id == $id and .title == "qa-f34-renamed"' "$F34/update.json" # bug + control-agent-server assert --json "$F34/update.json" --check id eq "$SCID" --check title eq qa-f34-renamed # bug: value.success eq true && value.id missing ``` Expected: the stored title and a `ConversationInfo` with the conversation's `id` and new title. Today the title is stored but the promise resolves with @@ -1041,7 +1042,7 @@ Preconditions: control-agent-server exec --timeout 60 --expect-output QA_F34_CREATE_OPTIONS_READ --save F34.manager-create-options/program -- node "$F34/create-options.mjs" for ID in $(jq -r '.ids[]' "$F34/create-options.json"); do control-agent-server api GET "/api/conversations/$ID" --expect 404; done cat "$F34/create-options.json" - jq -e '.max_iterations == 7 and .stuck_detection == false' "$F34/create-options.json" # bug + control-agent-server assert --json "$F34/create-options.json" --check max_iterations eq 7 --check stuck_detection eq false # bug: value.max_iterations eq 500 && value.stuck_detection eq true ``` Expected: `max_iterations` 7 and `stuck_detection: false`, as the direct `start()` gets. Today the manager's conversation has @@ -1349,7 +1350,7 @@ Preconditions: wait "$RPID" cat "$F34/reconnect-native.json" jq -e '.ws.reconnected and .ws.sent_after >= 1 and .native.went_down' "$F34/reconnect-native.json" - jq -e '.native.reconnected and .native.sent_after >= 1' "$F34/reconnect-native.json" # bug + control-agent-server assert --json "$F34/reconnect-native.json" --check native.reconnected eq true --check native.sent_after ge 1 # bug: value.native.reconnected eq false && value.native.last_state.attemptCount eq 1 ``` Expected: both streams come back and see the message posted after the restart. Today the `ws`-backed stream does, while the native one stays diff --git a/.agents/skills/verify-agent-server/references/maintenance.md b/.agents/skills/verify-agent-server/references/maintenance.md index 25d4c828c95..640df3a34a2 100644 --- a/.agents/skills/verify-agent-server/references/maintenance.md +++ b/.agents/skills/verify-agent-server/references/maintenance.md @@ -140,6 +140,12 @@ are not yet in the client; that is client drift, owned here, not map drift. - **Harness gap**: fix the CLI, prove the new verb live, re-drive. - **Product bug**: record `fail` with evidence and a minimal repro command list; report it in this repository (or the owning one), not in the map PR. +- **Known bug, different failure**: a `known bug` bullet whose marked command + fails without matching its `# bug: PREDICATE` is reported `fail` with the + observed status and hint. Read the transcript: the documented bug may have + changed shape (update the predicate and the prose, citing the PR) or a new + failure may hide it (triage that failure on its own). Never widen the + predicate just to turn the bullet back to `xfail`. - **Intent gap** (behavior changed without documentation): report it to the user with the PR link; do not "fix" the map to bless it silently. diff --git a/.agents/skills/verify-agent-server/references/mapping.md b/.agents/skills/verify-agent-server/references/mapping.md index 01f444fef72..0ba1df09959 100644 --- a/.agents/skills/verify-agent-server/references/mapping.md +++ b/.agents/skills/verify-agent-server/references/mapping.md @@ -177,21 +177,64 @@ Then exactly four H2 sections, in this order: `helper stop NAME` or `stop`. Two label markers keep the map honest without turning it red forever: - a bullet whose bold label says **known bug** (for example + **known bug** and **blocked**. A bullet whose bold label says **known + bug** (for example `**Stale secrets after update (`F08.secrets-visible`), known bug #1234.**`) - asserts the correct behavior and is reported as an expected failure - (`xfail`) while the bug lasts; when it starts passing (`xpass`) `map run` - fails so the marker gets removed. The command that fails because of the - bug ends its line with `# bug`; `map run` counts the bullet as reproduced - only when that command is the one that fails, and reports `fail` when an - arrange step breaks first (`map check` requires the marker). A timeout or an - early exit without a confirmed assertion location is a failure, never a - reproduced bug. Write a - negative bug assertion on one line, as `if cmd; then false; fi # bug`. - A bullet whose label says **blocked** + follows the known-bug contract below. A bullet whose label says **blocked** names its prerequisite in prose, is reported as `blocked`, and is not executed. Later bullets never depend on variables set in either kind. + **The known-bug contract.** Keep these rules in step with the sibling + verification skills (verify-openhands in OpenHands/OpenHands, + verify-automation in OpenHands/automation), so a proof means the same + thing in each: + + - The bullet asserts the **correct** behavior. The command that fails + because of the bug ends its line with `# bug: PREDICATE`, and the + predicate names the bug's own symptom: the value or error it produces, + not the whole response. + - Three outcomes. `xfail`: the marked command failed **and** its + predicate holds (the documented bug reproduced). `xpass`: every command + passed, so the correct behavior was observed; `map run` fails so the + marker gets removed. `fail`: anything else, including a different + failure at the marked command (a 401, 404 or 503 where the bug is a + 500), an arrange step that breaks first, a timeout, an early exit + without a confirmed assertion location, or a pass after the family's + Preconditions or any recipe in its `Requires:` closure (the recipes it + requires, and theirs) failed earlier in the run (`--keep-going`), since + its arrange never ran. + - The predicate is `PATH OP [VALUE]` clauses joined by `&&`, matched like + `--check` against the JSON object the last `control-agent-server` call + on the marked line printed: + `# bug: status eq 500 && response.body.exception contains 'has no attribute'`. + An `api` call prints `status`, `response.status`, `response.body` and + its `checks`; the other verbs print their result or `error`/`hint`; + `--quiet` drops `response.body`, so match `checks.N.actual` or leave + `--quiet` off that line. A value the recipe computed (a shell variable, + a saved JSON file, a program's output) goes through + `control-agent-server assert --value|--json|stdin --check ...`, so the + predicate can name it: `# bug: value.status eq 200`. + - Every path in the predicate must be present in that output, except + under `missing`; a stored `null` counts as present. So + `checks.0.actual eq null` holds when the check ran and found nothing, + never on an error object that has no `checks`. A predicate made only of + `missing` clauses is rejected: anchor it on what the bug's output does + hold (`value.success eq true && value.id missing`). + - `exit N` (the marked command's exit status) is the last resort, for a + line whose symptom has no value to name, such as a TypeScript compile + that fails with exit 2 on a type error. It says only that the line + failed that way. + - `xpass` must mean the correct value was observed, so the marked command + asserts positively. `map check` rejects `if cmd; then false; fi`, + `! cmd` and `test !` on a `# bug` line, because an unrelated error in + `cmd` would read as a fix; use the verb's own expectation + (`ws stop --expect-close`, `api --check`) or `assert`. + - `map check` rejects a missing or malformed predicate, and a `PATH OP` + predicate on a line that does not call the CLI. + - A fix is proven with the baseline reproducing (`xfail`) twice and the + fix passing (`xpass`) twice, with the same recipe, flags and fixtures + (see SKILL.md, "Verify an existing fix"). + Include the read-only second view for every mutation (a GET, a WebSocket frame, a file on disk, a sink delivery), the error cases that matter (404 for unknown ids, 422 for bad bodies, 401 without a key, 409 for diff --git a/.agents/skills/verify-agent-server/scripts/control_agent_server.py b/.agents/skills/verify-agent-server/scripts/control_agent_server.py index d27bad83d66..744b33d6bb2 100644 --- a/.agents/skills/verify-agent-server/scripts/control_agent_server.py +++ b/.agents/skills/verify-agent-server/scripts/control_agent_server.py @@ -52,6 +52,10 @@ RUN_ENV = "AGENT_SERVER_VERIFY_RUN" HOME_ENV = "AGENT_SERVER_VERIFY_HOME" CHECKOUT_ENV = "AGENT_SERVER_VERIFY_CHECKOUT" +# Set by `map run` for each bullet: every CLI call empties this file when it +# starts and writes the JSON object it prints, so a `# bug: PATH OP VALUE` +# predicate can be matched against what the failing command observed. +OBSERVATION_ENV = "AGENT_SERVER_VERIFY_OBSERVATION" SESSION_HEADER = "X-Session-API-Key" FAMILY_FILE_RE = re.compile(r"^F(\d{2})-[a-z0-9-]+\.md$") SUB_FEATURE_RE = re.compile(r"^- `(F\d{2}\.[a-z0-9][a-z0-9-]*)`: \S") @@ -134,7 +138,12 @@ def obj(self, value: Any) -> Any: def emit(payload: dict[str, Any]) -> None: - sys.stdout.write(json.dumps(REDACT.obj(payload), indent=2, default=str) + "\n") + text = json.dumps(REDACT.obj(payload), indent=2, default=str) + sys.stdout.write(text + "\n") + observation = os.environ.get(OBSERVATION_ENV) + if observation: + with contextlib.suppress(OSError): + Path(observation).write_text(text) def now_iso() -> str: @@ -383,6 +392,26 @@ def dig(value: Any, path: str) -> Any: return current +def has_path(value: Any, path: str) -> bool: + """Whether every step of a dotted path exists; a stored `null` counts. + + `dig` answers `None` both for a missing key and for a `null` value, so a + `# bug:` predicate checks this first: an error object without `checks` + must not match `checks.0.actual eq null`. + """ + current = value + for part in [p for p in path.split(".") if p]: + if isinstance(current, list) and part.lstrip("-").isdigit(): + if not -len(current) <= int(part) < len(current): + return False + current = current[int(part)] + elif isinstance(current, dict) and part in current: + current = current[part] + else: + return False + return True + + def save_evidence(run: Run, target: str, payload: Any, suffix: str = ".json") -> Path: """Save under evidence//; never overwrite (name-2, name-3).""" if "/" not in target: @@ -2927,6 +2956,41 @@ def cmd_state_cat(args: argparse.Namespace) -> dict[str, Any]: return result +def cmd_assert(args: argparse.Namespace) -> dict[str, Any]: + """`--check` a value a recipe computed, so a `# bug:` predicate can name it.""" + if not args.check: + usage_error( + "assert needs at least one --check", + example=f'{CLI} assert --value "$N" --check . eq 2', + ) + if args.json is not None: + path = Path(args.json) + if not path.is_file(): + usage_error(f"{args.json} does not exist") + raw = path.read_text(errors="replace") + elif args.value is not None: + raw = args.value + else: + raw = sys.stdin.read() + try: + value: Any = json.loads(raw) + except ValueError: + if args.json is not None: + usage_error(f"{args.json} is not JSON") + value = raw.rstrip("\n") + checks = [evaluate_check(value, spec) for spec in args.check] + result: dict[str, Any] = { + "ok": all(c["ok"] for c in checks), + "value": value, + "checks": checks, + } + if not result["ok"]: + result["hint"] = "failed check: " + "; ".join( + c["check"] for c in checks if not c["ok"] + ) + return result + + def cmd_state_grep(args: argparse.Namespace) -> dict[str, Any]: run = resolve_run(args.run, require_alive=False) needle = os.environ.get(args.env_value, "") if args.env_value else args.text @@ -3186,6 +3250,9 @@ def cmd_helper_start(args: argparse.Namespace) -> dict[str, Any]: stdout=log, stderr=subprocess.STDOUT, start_new_session=True, + # A helper outlives the bullet: keep its output out of the + # observation that `# bug:` predicates read. + env={k: v for k, v in os.environ.items() if k != OBSERVATION_ENV}, ) entry = { "name": args.name, @@ -3795,7 +3862,7 @@ def check_family(path: Path, routes: Sequence[dict[str, Any]] | None) -> list[st f"line {bullet.line}: bullet '{bullet.label}' names no sub-feature ID" ) known_bug = "known bug" in bullet.label.lower() - marked = bool(bug_ranges(bullet.script)) + marked = bool(bug_marks(bullet.script)) if known_bug and not blocked and not marked: problems.append( f"line {bullet.line}: known-bug bullet '{bullet.label}' marks no " @@ -3807,6 +3874,27 @@ def check_family(path: Path, routes: Sequence[dict[str, Any]] | None) -> list[st f"line {bullet.line}: bullet '{bullet.label}' has a `# bug` marker " "but its label does not say known bug" ) + for mark in bug_marks(bullet.script) if known_bug else []: + if NEGATIVE_BUG_RE.search(mark.command): + problems.append( + f"line {bullet.line}: bullet '{bullet.label}': assert the " + "correct behavior positively on the `# bug` line (an " + "unrelated error in `if cmd; then false; fi`, `test !` or " + "`! cmd` would read as fixed); use the verb's own expect " + f"flag or `{CLI} assert`" + ) + try: + clauses = parse_bug_predicate(mark.predicate) + except ValueError as exc: + problems.append(f"line {bullet.line}: bullet '{bullet.label}': {exc}") + continue + if clauses[0][0] != "exit" or len(clauses[0]) != 2: + if CLI not in mark.command: + problems.append( + f"line {bullet.line}: bullet '{bullet.label}': " + f"`# bug: {mark.predicate}` reads a {CLI} result, but " + f"the marked command does not call {CLI}; use `exit N`" + ) for command in extract_commands(text): error = validate_command(command) if error: @@ -3980,7 +4068,7 @@ def parse_exclusions() -> set[str]: BULLET_RE = re.compile(r"^- \*\*(.+?)\*\*") -BUG_MARK_RE = re.compile(r"\s#\s*bug\s*$") +BUG_MARK_RE = re.compile(r"\s#\s*bug\b(?::(?P.*))?\s*$") FENCE_RE = re.compile(r"^\s*```(\w*)\s*$") ASSIGN_RE = re.compile(r"^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=", re.MULTILINE) @@ -3995,21 +4083,128 @@ class Bullet: needs: list[str] = field(default_factory=list) -def bug_ranges(script: str) -> list[tuple[int, int]]: - """Line ranges (1-based, in the bullet script) of commands marked `# bug`. +# Shapes that pass when the command breaks: `if cmd; then false; fi`, `! cmd`, +# `test ! -e X`, or a check run only `if` something else holds. +NEGATIVE_BUG_RE = re.compile(r"(?:^|[;&|(]\s*)(?:if|!)\s|\btest\s+!|\[\s+!\s") + + +@dataclass +class BugMark: + """A command marked `# bug: PREDICATE`, as lines of the bullet script.""" + + first: int + last: int + command: str + predicate: str + + +def bug_marks(script: str) -> list[BugMark]: + """Commands marked `# bug` (1-based line ranges in the bullet script). The marker ends the command's last line; a command continued with `\\` starts at the first line of the continuation. """ lines = script.splitlines() - ranges = [] + marks = [] for number, line in enumerate(lines, 1): - if BUG_MARK_RE.search(line): + match = BUG_MARK_RE.search(line) + if match: first = number while first > 1 and lines[first - 2].rstrip().endswith("\\"): first -= 1 - ranges.append((first, number)) - return ranges + marks.append( + BugMark( + first, + number, + "\n".join(lines[first - 1 : number]), + (match.group("predicate") or "").strip(), + ) + ) + return marks + + +def parse_bug_predicate(text: str) -> list[list[str]]: + """The clauses of a `# bug:` predicate: the documented failure's identity. + + Either `exit N` (the marked command's exit status, for `test`, `jq -e` + and other plain commands) or one or more `PATH OP [VALUE]` clauses joined + by `&&`, matched like `--check` against the JSON object the last + control-agent-server call on the marked line printed, for example + `status eq 500 && response.body.exception contains 'has no attribute'`. + Every clause but a `missing` one also needs its path present in that + output (a stored `null` is present), and at least one clause must not be + `missing`, so an error object never reads as the bug. + """ + if not text: + raise ValueError( + "a `# bug` marker needs the documented failure: " + "`# bug: status eq 500` or `# bug: exit 1`" + ) + try: + tokens = shlex.split(text) + except ValueError as exc: + raise ValueError(f"cannot parse `# bug: {text}`: {exc}") from None + clauses: list[list[str]] = [[]] + for token in tokens: + if token == "&&": + clauses.append([]) + else: + clauses[-1].append(token) + for clause in clauses: + if len(clause) == 2 and clause[0] == "exit": + if not clause[1].isdigit() or not 0 < int(clause[1]) < 256: + raise ValueError(f"`exit {clause[1]}` needs a status from 1 to 255") + if len(clauses) > 1: + raise ValueError("`exit N` stands alone; it cannot be joined") + continue + if len(clause) < 2 or clause[1] not in CHECK_OPS: + raise ValueError( + f"`{' '.join(clause)}` is not PATH OP [VALUE] with OP in " + f"{', '.join(CHECK_OPS)}" + ) + takes_value = clause[1] not in ("exists", "missing") + if len(clause) != (3 if takes_value else 2): + raise ValueError( + f"`{' '.join(clause)}`: {clause[1]} takes " + + ("one value" if takes_value else "no value") + ) + if all(clause[1] == "missing" for clause in clauses): + raise ValueError( + "a `missing` clause needs a clause naming what the bug's output " + "does hold (`status eq 200 && result missing`), or an error object " + "would match" + ) + return clauses + + +def bug_predicate_matches( + clauses: list[list[str]], exit_status: int | None, observation: Any +) -> bool: + """Whether the observed failure is the one the `# bug` predicate documents.""" + if clauses[0][0] == "exit" and len(clauses[0]) == 2: + return exit_status == int(clauses[0][1]) + if not isinstance(observation, dict): + return False + return all( + (clause[1] == "missing" or has_path(observation, clause[0])) + and evaluate_check(observation, clause)["ok"] + for clause in clauses + ) + + +def requires_closure(bullet: Bullet, bullets: Sequence[Bullet]) -> set[str]: + """Every feature `bullet` needs, directly or through its `Requires:`.""" + by_id = {feature: other for other in bullets for feature in other.ids} + closure: set[str] = set() + stack = list(bullet.requires) + while stack: + feature = stack.pop() + if feature in closure: + continue + closure.add(feature) + if feature in by_id: + stack.extend(by_id[feature].requires) + return closure def driving_bullets(path: Path) -> list[Bullet]: @@ -4146,19 +4341,11 @@ def undeclared_dependencies(bullets: list[Bullet]) -> list[str]: id or path can fail the `# bug` line for the wrong reason. Blocked and known-bug bullets never save their variables, so they are not producers. """ - by_id = {feature: bullet for bullet in bullets for feature in bullet.ids} problems = [] for index, bullet in enumerate(bullets): if bullet.label == "Preconditions" or not bullet.ids: continue - closure: set[str] = set() - stack = list(bullet.requires) - while stack: - feature = stack.pop() - if feature in closure or feature not in by_id: - continue - closure.add(feature) - stack.extend(by_id[feature].requires) + closure = requires_closure(bullet, bullets) missing: dict[str, list[str]] = {} for name in sorted(outside_reads(bullet.script)): for producer in reversed(bullets[:index]): @@ -4465,7 +4652,8 @@ def cmd_map_run(args: argparse.Namespace) -> dict[str, Any]: def replay_family(run: Run, path: Path, args: argparse.Namespace) -> dict[str, Any]: - bullets = select_bullets(driving_bullets(path), args.only) + every_bullet = driving_bullets(path) + bullets = select_bullets(every_bullet, args.only) checkout = Path(run.data.get("checkout", REPO_ROOT)) state = run.dir / "map-run" / f"{path.stem}.state.sh" state.parent.mkdir(exist_ok=True) @@ -4479,6 +4667,9 @@ def replay_family(run: Run, path: Path, args: argparse.Namespace) -> dict[str, A results = [] failed = False xpassed = False + # Labels and ids of bullets that failed: a known bug whose arrange did not + # run (with --keep-going) cannot show the correct behavior. + broken: set[str] = set() unavailable: dict[int, list[str]] = {} if not args.dry_run and any(recipe_needs(bullets).values()): unavailable = blocked_recipes(bullets, machine_capabilities()) @@ -4544,13 +4735,23 @@ def replay_family(run: Run, path: Path, args: argparse.Namespace) -> dict[str, A ) failure = run.dir / "map-run" / f"{path.stem}.failed" failure.unlink(missing_ok=True) + observation = run.dir / "map-run" / f"{path.stem}.observation.json" + observation.unlink(missing_ok=True) + # The ERR trap copies the observation at the failing command, before a + # recipe's own EXIT cleanup calls the CLI again. + observed_at_failure = observation.with_suffix(".failed.json") + observed_at_failure.unlink(missing_ok=True) preamble = [ "set -eo pipefail", f"source {shlex_quote(str(state))}", f"cd {shlex_quote(str(checkout))}", - 'trap \'printf "%s\\t%s\\n" "$LINENO" "$BASH_COMMAND" > ' + 'trap \'printf "%s\\t%s\\t%s\\n" "$?" "$LINENO" "$BASH_COMMAND" > ' + shlex_quote(str(failure)) - + "' ERR", + + "; cp -f " + + shlex_quote(str(observation)) + + " " + + shlex_quote(str(observed_at_failure)) + + " 2>/dev/null' ERR", ] script = "\n".join(preamble) + f"\n{bullet.script}{save_state}" if args.dry_run: @@ -4561,17 +4762,25 @@ def replay_family(run: Run, path: Path, args: argparse.Namespace) -> dict[str, A started = time.monotonic() recipe_path = run.private / f"{path.stem}.recipe.sh" recipe_path.write_text(script) - code, out, err, timed_out = execute_recipe(recipe_path, env, args.timeout) + code, out, err, timed_out = execute_recipe( + recipe_path, {**env, OBSERVATION_ENV: str(observation)}, args.timeout + ) elapsed = int((time.monotonic() - started) * 1000) failed_line: int | None = None failed_command: str | None = None + failed_status: int | None = None + observed: Any = None if code != 0 and failure.exists(): - line_text, _, failed_command = ( - failure.read_text().rstrip("\n").partition("\t") - ) + status_text, _, rest = failure.read_text().rstrip("\n").partition("\t") + line_text, _, failed_command = rest.partition("\t") + if status_text.isdigit(): + failed_status = int(status_text) if line_text.isdigit(): failed_line = int(line_text) - len(preamble) failed_command = REDACT.text(failed_command)[:500] + if observed_at_failure.exists(): + with contextlib.suppress(OSError, ValueError): + observed = json.loads(observed_at_failure.read_text()) transcript = { "file": path.name, "bullet": bullet.label, @@ -4582,6 +4791,8 @@ def replay_family(run: Run, path: Path, args: argparse.Namespace) -> dict[str, A "elapsed_ms": elapsed, "failed_line": failed_line, "failed_command": failed_command, + "failed_status": failed_status, + "observation": observed, "stdout": out, "stderr": err, } @@ -4590,20 +4801,39 @@ def replay_family(run: Run, path: Path, args: argparse.Namespace) -> dict[str, A run, f"map-run/{path.stem}-{index:02d}-{slug}", transcript ) known_bug = "known bug" in marker - ranges = bug_ranges(bullet.script) - assertion_failed = ( - not timed_out - and failed_line is not None - and any(first <= failed_line <= last for first, last in ranges) + mark = next( + ( + m + for m in bug_marks(bullet.script) + if not timed_out + and failed_line is not None + and m.first <= failed_line <= m.last + ), + None, ) - if known_bug and code == 0: + documented = False + predicate_error: str | None = None + if known_bug and code != 0 and mark is not None: + try: + clauses = parse_bug_predicate(mark.predicate) + documented = bug_predicate_matches(clauses, failed_status, observed) + except ValueError as exc: + predicate_error = str(exc) + unarranged = sorted( + broken.intersection( + ["Preconditions", *requires_closure(bullet, every_bullet)] + ) + ) + if known_bug and code == 0 and not unarranged: status = "xpass" xpassed = True - elif known_bug and code != 0 and assertion_failed: + elif known_bug and documented: status = "xfail" else: - status = "pass" if code == 0 else "fail" - failed = failed or code != 0 + status = "pass" if code == 0 and not known_bug else "fail" + failed = failed or status == "fail" + if status == "fail": + broken.update([bullet.label, *bullet.ids]) row: dict[str, Any] = { "bullet": bullet.label, "ids": bullet.ids, @@ -4618,13 +4848,32 @@ def replay_family(run: Run, path: Path, args: argparse.Namespace) -> dict[str, A row["failed_command"] = failed_command row["stdout_tail"] = REDACT.text(out[-1200:]) row["stderr_tail"] = REDACT.text(err[-1200:]) - if known_bug and status == "fail": + if known_bug and mark is not None: + row["bug_predicate"] = mark.predicate + if known_bug and status == "fail" and mark is None: row["hint"] = ( "no failure was confirmed at the `# bug` assertion; " "the bug was not reproduced" ) + elif known_bug and status == "fail": + row["failed_status"] = failed_status + if isinstance(observed, dict): + row["observed"] = { + k: observed[k] + for k in ("status", "hint", "error", "checks") + if k in observed + } + row["hint"] = predicate_error or ( + "the `# bug` command failed, but not with the documented " + f"failure (`# bug: {mark.predicate}`); the bug was not reproduced" + ) if status == "xpass": row["hint"] = "the known bug no longer reproduces: update the map" + elif known_bug and code == 0: + row["hint"] = ( + f"passed, but {', '.join(unarranged)} failed earlier in this run, " + "so the pass does not show the correct behavior" + ) results.append(row) if args.record and bullet.ids: note = { @@ -5750,6 +5999,26 @@ def build_parser() -> argparse.ArgumentParser: cmd_config, ) + p = sub( + commands, + "assert", + "Check a value a recipe computed (a variable, a JSON file, stdin).", + f"""\ + {CLI} assert --value "$SLOWEST" --check . le 1500 + {CLI} assert --json "$F/alias-delete.json" --check status eq 409 + some-program | {CLI} assert --check items len-eq 2 + +Prints the value (parsed as JSON when it is JSON) and the --check results like +`api --check`, and exits 1 when a check fails. Use it instead of `test` or +`jq -e` on a `# bug` line, so the marker can name the value the bug produces: +`# bug: value eq 404`.""", + cmd_assert, + ) + source = p.add_mutually_exclusive_group() + source.add_argument("--value", help="the value itself (JSON or text)") + source.add_argument("--json", metavar="FILE", help="a JSON file") + p.add_argument("--check", action="append", nargs="+", metavar="FIELD OP [VALUE]") + p = sub( commands, "exec", @@ -5879,8 +6148,12 @@ def build_parser() -> argparse.ArgumentParser: bullet (CID=..., export X=...) are carried into later bullets. A bullet fails when any command exits non-zero, so recipes encode their expectations with --expect, --check, --expect-kind and `test`. A bullet whose label says -"known bug" is an expected failure (xfail; an unexpected pass, xpass, fails -the run so the map gets updated). A bullet whose label says "blocked" is +"known bug" is an expected failure (xfail) only when the command marked +`# bug: PREDICATE` fails with the documented failure: `exit N`, or `PATH OP +[VALUE]` clauses joined by `&&` and matched like --check against the JSON the +last control-agent-server call on that line printed (`# bug: status eq 500`). +Any other failure is a fail; an unexpected pass, xpass, fails the run so the +map gets updated. A bullet whose label says "blocked" is reported and not executed. Transcripts are saved under /evidence/map-run/.""", ) add_run_flag(mrun) @@ -5985,6 +6258,10 @@ def main(argv: list[str] | None = None) -> int: if head[:1] == ["_llm-stub"]: serve_llm_stub(int(head[1]), Path(head[2]), Path(head[3])) return 0 + observation = os.environ.get(OBSERVATION_ENV) + if observation: + with contextlib.suppress(OSError): + Path(observation).unlink() parser = build_parser() if not head: parser.print_help() diff --git a/tests/cross/test_verify_agent_server_skill.py b/tests/cross/test_verify_agent_server_skill.py index f3bda751a97..26fced0af23 100644 --- a/tests/cross/test_verify_agent_server_skill.py +++ b/tests/cross/test_verify_agent_server_skill.py @@ -9,6 +9,7 @@ from __future__ import annotations import importlib.util +import io import json import signal import subprocess @@ -330,7 +331,7 @@ def greet(ws): Requires: `F98.second` ```sh test "$VALUE" = carried - test "$VALUE" = fixed # bug + test "$VALUE" = fixed # bug: exit 1 ``` - **Offline (`F98.offline`), blocked: needs a GPU.** Not executed. @@ -797,13 +798,231 @@ def test_map_check_requires_a_bug_marker_in_known_bug_bullets( ): feature_map = tmp_path / "map" feature_map.mkdir() - (feature_map / "F98-demo.md").write_text(FAMILY.replace(" # bug", "")) + (feature_map / "F98-demo.md").write_text(FAMILY.replace(" # bug: exit 1", "")) monkeypatch.setattr(cas, "FEATURE_MAP_DIR", feature_map) code, out = _run(capsys, "map", "check", "--file", "F98", "--no-routes") assert code == 1 assert "# bug" in out +@pytest.mark.parametrize( + "marker, problem", + [ + ("# bug", "needs the documented failure"), + ("# bug: exit", "is not PATH OP"), + ("# bug: exit 0", "from 1 to 255"), + ("# bug: exit 1 && status eq 500", "stands alone"), + ("# bug: status is 500", "is not PATH OP"), + ("# bug: status eq", "takes one value"), + ("# bug: detail missing 500", "takes no value"), + ("# bug: detail missing", "needs a clause naming"), + ("# bug: detail contains 'unclosed", "cannot parse"), + ("# bug: status eq 500", "does not call control-agent-server"), + ], +) +def test_map_check_rejects_a_missing_or_malformed_bug_predicate( + write_verification_family, capsys, marker, problem +): + write_verification_family(cas, FAMILY.replace("# bug: exit 1", marker)) + code, out = _run(capsys, "map", "check", "--file", "F98", "--no-routes") + assert code == 1, out + assert problem in out + + +@pytest.mark.parametrize( + "line", + [ + 'if test "$VALUE" = carried; then false; fi # bug: exit 1', + '! test "$VALUE" = carried # bug: exit 1', + 'test ! -e "$VALUE" # bug: exit 1', + ], +) +def test_map_check_rejects_negative_bug_lines(write_verification_family, capsys, line): + write_verification_family( + cas, FAMILY.replace('test "$VALUE" = fixed # bug: exit 1', line) + ) + code, out = _run(capsys, "map", "check", "--file", "F98", "--no-routes") + assert code == 1, out + assert "positively" in out + + +def test_assert_names_a_computed_value(tmp_path, capsys, monkeypatch): + code, out = _run(capsys, "assert", "--value", "1700", "--check", ".", "le", "1500") + result = json.loads(out) + assert code == 1 + assert result["value"] == 1700 + assert cas.bug_predicate_matches( + cas.parse_bug_predicate("value gt 1500"), 1, result + ) + saved = tmp_path / "saved.json" + saved.write_text('{"status": 500}') + code, out = _run( + capsys, "assert", "--json", str(saved), "--check", "status", "eq", "409" + ) + assert code == 1 + assert json.loads(out)["checks"][0]["actual"] == "500" + monkeypatch.setattr("sys.stdin", io.StringIO("qa-text\n")) + code, out = _run(capsys, "assert", "--check", ".", "eq", "qa-text") + assert code == 0, out + + +BUG_API = "control-agent-server api GET {path} --expect 200" +DOCUMENTED = " # bug: status eq 404 && response.body.detail eq 'Not Found'" + + +@pytest.mark.parametrize( + "path, status", + [ + # The documented failure: the marked command answers 404 Not Found. + ("/missing", "xfail"), + # An unrelated error at the same marked command is not the known bug. + ("/refused", "fail"), + # Correct behavior: the bug no longer reproduces. + ("/info", "xpass"), + ], +) +def test_known_bug_xfails_only_on_the_documented_failure( + run_dir, write_verification_family, capsys, path, status +): + family = FAMILY.replace( + ' test "$VALUE" = fixed # bug: exit 1', + " " + BUG_API.format(path=path) + DOCUMENTED, + ) + write_verification_family(cas, family) + code, out = _run(capsys, "map", "run", "--file", "F98", "--record") + result = json.loads(out) + bug = next(r for r in result["bullets"] if r.get("ids") == ["F98.bug"]) + assert bug["status"] == status, out + assert code == (0 if status == "xfail" else 1) + if status == "fail": + assert bug["failed_status"] == 1 + assert bug["observed"]["status"] == 503 + assert "not with the documented failure" in bug["hint"] + ledger = [ + json.loads(line) + for line in (run_dir / "evidence" / "ledger.jsonl").read_text().splitlines() + ] + assert {r["feature"]: r["result"] for r in ledger}["F98.bug"] == "fail" + + +def test_known_bug_matches_the_failure_not_a_later_cleanup_call( + run_dir, write_verification_family, capsys +): + # A recipe's EXIT cleanup calls the CLI after the marked command failed; + # the predicate still sees what the marked command observed. + family = FAMILY.replace( + ' test "$VALUE" = fixed # bug: exit 1', + " trap 'control-agent-server api GET /info >/dev/null' EXIT\n " + + BUG_API.format(path="/missing") + + DOCUMENTED, + ) + write_verification_family(cas, family) + code, out = _run(capsys, "map", "run", "--file", "F98") + bug = next(r for r in json.loads(out)["bullets"] if r.get("ids") == ["F98.bug"]) + assert bug["status"] == "xfail", out + + +def test_known_bug_pass_after_a_broken_arrange_is_not_a_fix( + run_dir, write_verification_family, capsys +): + # With --keep-going, a recipe whose prerequisite failed can pass on empty + # variables; that is no evidence the bug is fixed. + family = FAMILY.replace( + "VALUE=$(echo carried)", "VALUE=$(echo carried)\n false" + ).replace( + ' test "$VALUE" = carried\n test "$VALUE" = fixed # bug: exit 1', + " true # bug: exit 1", + ) + write_verification_family(cas, family) + code, out = _run(capsys, "map", "run", "--file", "F98", "--keep-going") + bug = next(r for r in json.loads(out)["bullets"] if r.get("ids") == ["F98.bug"]) + assert bug["status"] == "fail", out + assert "F98.second" in bug["hint"] + + +def test_known_bug_pass_after_a_broken_indirect_arrange_is_not_a_fix( + run_dir, write_verification_family, capsys +): + # F98.second passes on its own, but it needs F98.first, which failed; the + # known bug needs F98.second, so its pass is no evidence either. + family = ( + FAMILY.replace("VALUE=$(echo carried)", "VALUE=$(echo carried)\n false") + .replace( + ' test "$VALUE" = carried\n control-agent-server api GET /info', + " control-agent-server api GET /info", + ) + .replace( + ' test "$VALUE" = carried\n test "$VALUE" = fixed # bug: exit 1', + " true # bug: exit 1", + ) + ) + write_verification_family(cas, family) + code, out = _run(capsys, "map", "run", "--file", "F98", "--keep-going") + rows = {tuple(r.get("ids") or []): r for r in json.loads(out)["bullets"]} + assert rows[("F98.second",)]["status"] == "pass", out + bug = rows[("F98.bug",)] + assert bug["status"] == "fail", out + assert "F98.first" in bug["hint"] + + +@pytest.mark.parametrize( + "stored, status", + [ + # The documented failure: the file is there and has no key. + ('{"agent": {"model": "m"}}', "xfail"), + # The file is missing: an error object has no `checks`, so the + # `eq null` clause must not read its absence as the bug. + (None, "fail"), + ], +) +def test_known_bug_predicate_needs_its_paths_present( + run_dir, write_verification_family, capsys, stored, status +): + if stored is not None: + (run_dir / "state.json").write_text(stored) + family = FAMILY.replace( + ' test "$VALUE" = fixed # bug: exit 1', + " control-agent-server state cat state.json --check agent.key exists" + " # bug: checks.0.actual eq null", + ) + write_verification_family(cas, family) + code, out = _run(capsys, "map", "run", "--file", "F98") + bug = next(r for r in json.loads(out)["bullets"] if r.get("ids") == ["F98.bug"]) + assert bug["status"] == status, out + + +def test_known_bug_exit_predicate_tells_a_false_test_from_an_error( + run_dir, write_verification_family, capsys +): + # `test` exits 1 when the comparison is false and 2 when it cannot run. + family = FAMILY.replace( + ' test "$VALUE" = fixed # bug: exit 1', + ' test "$VALUE" -le 3 # bug: exit 1', + ) + write_verification_family(cas, family) + code, out = _run(capsys, "map", "run", "--file", "F98") + bug = next(r for r in json.loads(out)["bullets"] if r.get("ids") == ["F98.bug"]) + assert bug["status"] == "fail", out + assert bug["failed_status"] == 2 + + +def test_the_marked_call_replaces_an_earlier_observation( + run_dir, write_verification_family, capsys +): + # The marked line's own call replaces what an earlier call observed, so an + # earlier 404 cannot stand in for the marked command's failure. + family = FAMILY.replace( + ' test "$VALUE" = fixed # bug: exit 1', + " control-agent-server api GET /missing --expect 404\n" + " control-agent-server api GET /refused --expect 200" + DOCUMENTED, + ) + write_verification_family(cas, family) + code, out = _run(capsys, "map", "run", "--file", "F98") + bug = next(r for r in json.loads(out)["bullets"] if r.get("ids") == ["F98.bug"]) + assert bug["status"] == "fail", out + assert bug["observed"]["status"] == 503 + + def test_committed_feature_map_is_structurally_valid(capsys): """`map check --no-routes`: headings, IDs, index counts, recipes parse.""" code, out = _run(capsys, "map", "check", "--no-routes")