Repository navigation
Description
I'm an AI agent (Claude Code) helping Engel Nyst (@enyst) with project maintenance.
Is there an existing issue for the same bug?
- I have searched existing issues and this is not a duplicate.
Bug Description
The WebhookSpec field descriptions, which the OpenAPI document publishes as the item type of POST /api/init's webhooks (and the TypeScript client embeds in clients/typescript/src/generated/agent-server-schema.ts), contradict what the server does:
base_urlsays "Events will be sent to {base_url}/events", but event batches are posted to{base_url}/events/{conversation_id.hex}(the conversation id without dashes).flush_delaysays "Timer is reset on each new event", but the timer starts with the first queued event and later events do not restart it.
An orchestrator that configures a webhook receiver from these descriptions listens on the wrong path and expects the wrong batching latency.
Expected Behavior
base_url describes event batches going to {base_url}/events/{conversation_id.hex} and conversation info to {base_url}/conversations. flush_delay says a partial batch is posted flush_delay seconds after the first queued event, and that later events do not reset the timer.
Actual Behavior
GET /openapi.json returns:
components.schemas.WebhookSpec.properties.base_url.description: "The base URL of the webhook service. Events will be sent to {base_url}/events and conversation info to {base_url}/conversations"components.schemas.WebhookSpec.properties.flush_delay.description: "The delay in seconds after which buffered events will be flushed to the webhook, even if the buffer is not full. Timer is reset on each new event."
Steps to Reproduce
- In a checkout of main:
uv sync, thenSESSION_API_KEY=dev-key uv run python -m openhands.agent_server --host 127.0.0.1 --port 8000. curl -s http://127.0.0.1:8000/openapi.json | jq '.components.schemas.WebhookSpec.properties | {base_url: .base_url.description, flush_delay: .flush_delay.description}'prints the two descriptions above.- Compare with the code:
WebhookSubscriber._post_eventsposts tof"{base_url}/events/{self.conversation_id.hex}", and_start_flush_timeronly creates a timer when none is running.
With the verify-agent-server skill: control-agent-server map run --file F32 --only F32.webhook-spec-docs --fresh reports the known-bug bullet as an expected failure while the bug lasts (F32.events-post and F32.flush-delay prove the actual behaviour).
Acceptance Criteria
-
WebhookSpec.base_url's description names{base_url}/events/{conversation_id.hex}for event batches and{base_url}/conversationsfor conversation info. -
WebhookSpec.flush_delay's description says the timer starts at the first queued event and is not reset by later events. - No behaviour change in
WebhookSubscriber. - The map bullet
F32.webhook-spec-docspasses with its# bugmarker removed.
The committed TypeScript contract (clients/typescript/src/generated/agent-server-schema.ts) is generated from the pinned released image (config.agentServerImage, 1.54.0) and CI's check:agent-server-api fails on any other content, so it is not edited in the fix; it picks up the new text at the next agent-server version bump.
Installation Method
uv sync in a checkout of main
Version
main at 6e7a853
Additional Context
Root cause: the descriptions in openhands-agent-server/openhands/agent_server/config.py:101-114 (WebhookSpec.base_url and WebhookSpec.flush_delay). The code: openhands-agent-server/openhands/agent_server/conversation_service.py:2636 (events URL) and :2751-2753 (_start_flush_timer starts a timer only when none is running); tests/agent_server/test_webhook_subscriber.py:1054 (test_flush_delay_not_reset_on_new_event) asserts the timer is not reset. Documentation only; trivial severity.
Found by the first full agentic run of verify-agent-server; tracked in #5653.
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
This is a documentation-only defect. Two WebhookSpec field descriptions in openhands-agent-server/openhands/agent_server/config.py contradict the server's behavior: WebhookSubscriber._post_batch posts event batches to {base_url}/events/{conversation_id.hex} (the conversation id without dashes), post_conversation_info posts conversation info to {base_url}/conversations, and _start_flush_timer creates a timer only when none is running, so later events do not reset it. The stale text surfaces in GET /openapi.json (where WebhookSpec is the item type of POST /api/init's webhooks), in the generated TypeScript contract, and in the verify-agent-server map bullet F32.webhook-spec-docs. The defect is real and reproducible by the issue's steps, but it is documentation text with no runtime impact and a trivial workaround (an operator can read the code or observe the deliveries), so it stays priority:low.
Bounded scope: correct the base_url and flush_delay descriptions and refresh the two downstream artifacts that publish them (the generated TypeScript contract and the one map bullet), with no behavior change.
Non-goals: no change to WebhookSubscriber (_post_batch, post_conversation_info, _start_flush_timer), to the webhook paths, to batching/flush mechanics or the event_buffer_size/max_batch_bytes/queue-limit semantics, or to the telemetry descriptions; no new webhook features, options, or endpoints; no change to POST /api/init handling.
Acceptance Criteria
-
GET /openapi.jsonreturns, atcomponents.schemas.WebhookSpec.properties.base_url.description, text stating that event batches are posted to{base_url}/events/{conversation_id.hex}(the conversation id without dashes) and conversation info to{base_url}/conversations. -
GET /openapi.jsonreturns, atcomponents.schemas.WebhookSpec.properties.flush_delay.description, text stating that a partial batch is postedflush_delayseconds after the first queued event and that later events do not reset the timer. - The text above matches the observed behavior: a webhook delivery arrives at
/events/<conversation id hex, no dashes>, and events queued after the first do not postpone the flush pastflush_delayfrom the first event (verified against a running server, e.g. theF32.events-postandF32.flush-delayrecipes). -
clients/typescript/src/generated/agent-server-schema.tsembeds the corrected text andnpm run check:agent-server-apipasses fromclients/typescript/. That contract is regenerated from the pinnedpackage.json->config.agentServerImagerelease, not frommain, so the regenerated line carries the corrected text only once the pin is at or past the release that includes this change (thebump-typescript-agent-server-*PR); the check must not be satisfied by hand-editing the generated file. -
make test-server-schemapasses: the exported OpenAPI document still exports deterministically and validates. - No behavior change in
WebhookSubscriber._post_batch,post_conversation_info, or_start_flush_timer, andtests/agent_server/test_webhook_subscriber.py::test_flush_delay_not_reset_on_new_eventstill passes. - In
.agents/skills/verify-agent-server/references/feature-map/F32-webhooks-and-telemetry.md, the# bugmarkers on theF32.webhook-spec-docsbullet (its Sub-features entry, its recipe, and its Gotchas entry) are removed,F32.webhook-spec-docspasses, andF32.events-postandF32.flush-delaycontinue to pass.
Activity