Skip to content

[Bug]: WebhookSpec descriptions give the wrong events path and say the flush timer resets on each event #5936

Closed

Description

@enyst

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_url says "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_delay says "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

  1. In a checkout of main: uv sync, then SESSION_API_KEY=dev-key uv run python -m openhands.agent_server --host 127.0.0.1 --port 8000.
  2. 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.
  3. Compare with the code: WebhookSubscriber._post_events posts to f"{base_url}/events/{self.conversation_id.hex}", and _start_flush_timer only 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}/conversations for 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-docs passes with its # bug marker 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.json returns, at components.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.json returns, at components.schemas.WebhookSpec.properties.flush_delay.description, text stating that a partial batch is posted flush_delay seconds 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 past flush_delay from the first event (verified against a running server, e.g. the F32.events-post and F32.flush-delay recipes).
  • clients/typescript/src/generated/agent-server-schema.ts embeds the corrected text and npm run check:agent-server-api passes from clients/typescript/. That contract is regenerated from the pinned package.json -> config.agentServerImage release, not from main, so the regenerated line carries the corrected text only once the pin is at or past the release that includes this change (the bump-typescript-agent-server-* PR); the check must not be satisfied by hand-editing the generated file.
  • make test-server-schema passes: the exported OpenAPI document still exports deterministically and validates.
  • No behavior change in WebhookSubscriber._post_batch, post_conversation_info, or _start_flush_timer, and tests/agent_server/test_webhook_subscriber.py::test_flush_delay_not_reset_on_new_event still passes.
  • In .agents/skills/verify-agent-server/references/feature-map/F32-webhooks-and-telemetry.md, the # bug markers on the F32.webhook-spec-docs bullet (its Sub-features entry, its recipe, and its Gotchas entry) are removed, F32.webhook-spec-docs passes, and F32.events-post and F32.flush-delay continue to pass.

Activity

  1. added
    bug
    on Oct 14, 2026
  2. added
    ready-for-dev
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugready-for-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions