Skip to content

agent: add agent_job_pending webhook, JS_CANCELLED status and JobState.reason - #1860

Merged
erikhortsch merged 5 commits into
mainfrom
erik/agent-job-pending-webhook
Oct 20, 2026
Merged

erikhortsch merged 5 commits into
mainfrom
erik/agent-job-pending-webhook

Conversation

@erikhortsch

@erikhortsch erikhortsch commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Extends the agent job lifecycle webhooks to cover jobs that never reach an agent:

  • agent_job_pending: a new webhook event (webhook.EventAgentJobPending). It is sent while a dispatched job is still waiting for an agent and carries the job with state.status = JS_PENDING.
  • JS_CANCELLED: a new JobStatus for a job that ended before it was assigned to an agent. It is reported through agent_job_ended, so customers can tell "never dispatched" apart from JS_FAILED.
  • JobState.reason (JobStateReason): says why a job has no agent.
    • JSR_NO_CAPACITY: used on agent_job_pending.
    • JSR_ROOM_CLOSED / JSR_DISPATCH_DELETED: used with JS_CANCELLED.
    • JSR_RETRYING: used on agent_job_pending when a failed job is being dispatched again.
  • Updates the WebhookEvent.event comment and adds a changeset.

Only .proto, hand-written Go and the changeset are committed; the Generate workflow produces the Go/JS bindings.

Compatibility

  • New enum values and a new field are wire-compatible.
  • JS_CANCELLED and reason are only set for jobs that were never assigned, so workers never receive them for their own jobs.
  • The agent observability mappers fall back to Undefined for unknown statuses.

Verification

  • protoc --descriptor_set_out on livekit_agent.proto and livekit_webhook.proto succeeds.
  • go build ./webhook/ passes.
  • With the generated bindings (8c488ce): go build ./... passes, and go test -race passes for ./webhook/..., ./livekit/... and ./observability/agentsobs/....

Related: #1711

🤖 Generated with Claude Code

…e.reason

agent_job_pending reports a dispatched job that is still waiting for an
agent, with JobState.reason saying why (e.g. no capacity). A job that
ends before any agent is assigned is reported as agent_job_ended with
the new JS_CANCELLED status, and the reason distinguishes a closed room
from a deleted dispatch, so it can be told apart from JS_FAILED.

Generated Go/JS bindings are produced by the Generate workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2d216e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
github.com/livekit/protocol Patch
@livekit/protocol Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@erikhortsch
erikhortsch marked this pull request as ready for review October 14, 2026 22:33
@erikhortsch
erikhortsch requested review from a team October 14, 2026 22:34
@erikhortsch
erikhortsch merged commit 78625f8 into main Oct 20, 2026
7 checks passed
@erikhortsch
erikhortsch deleted the erik/agent-job-pending-webhook branch October 20, 2026 21:33
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants