Skip to content

feat(submitqueue): Announce received and finished requests from the gateway's request materializer - #1106

Open
roychying wants to merge 1 commit into
mainfrom
chenghan.ying/sq-hook-request-started
Open

roychying wants to merge 1 commit into
mainfrom
chenghan.ying/sq-hook-request-started

Conversation

@roychying

@roychying roychying commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Why?

SubmitQueue v2 says nothing on a pull request or diff after a land. v1 comments when it receives a request, with a link to it, and again when the request lands or fails. The hooks framework is the seam for side effects like this, but SubmitQueue publishes no request events yet.

These events follow the request's summary in the gateway, the status users see, rather than pipeline transitions. That way a hook agrees with the UI in every case, including a request whose start failed before the orchestrator saved it. That request is only ever an error log with request version 0, and it gets no pipeline transition to hang an event on.

What?

  • submitqueue/core/hookevent holds SubmitQueue's hook source and three event types:
    • request.received: the request left the internal accepting status, normally when Land records accepted. Its id carries version 0, since a request is received once.
    • request.landed and request.failed: the summary reached landed or error. The id carries the summary's request version, so a restated status mints the same id and a later finished version mints a new one.
    • Cancellation has no event, because no hook needs one yet.
    • The payload is {queue, request_id, change_uris}. The events are consumed by the orchestrator's hook stage (next PR), which cannot read the gateway's store. A request's URIs never change, so they cannot go stale on redelivery.
    • The timestamp is the summary's (ReceivedAtMs or StatusTimestampMs), so a constructor is pure.
  • Materializer gains WithHookPublishing(registry). It publishes only on the summary update that crosses a transition, received first on the request's partition. A log that restates the summary publishes nothing, so a hook does no work for redeliveries, repair resends or stale logs.
  • Known gaps are listed in the hookevent package doc:
    • A failed publish after the summary update is lost, because the redelivery finds no transition. It is counted on request_hook.publish_errors and returned to the caller.
    • request.received is published inside the Land RPC.
    • A receipt that is retrying does not hold back the finish.
    • The queue drops a repeated id only for seconds.
  • The orchestrator-side publishing this PR first proposed is gone. That covered start, TerminateRequest and the terminal-log resend.

Test Plan

  • bazel test //submitqueue/core/hookevent/... //submitqueue/gateway/core/request/...
  • make lint check-gazelle check-mocks
  • make test: all pass.

Issue

@roychying
roychying marked this pull request as ready for review November 16, 2026 23:41
@roychying roychying changed the title Chenghan.ying/sq hook request started feat(submitqueue): Announce each request's start and terminal state on the hook topic Nov 16, 2026
@roychying
roychying force-pushed the chenghan.ying/sq-hook-request-started branch from 93b20df to 86f8b0a Compare November 17, 2026 04:56
@roychying roychying changed the title feat(submitqueue): Announce each request's start and terminal state on the hook topic feat(submitqueue): Announce received and finished requests from the gateway's request materializer Nov 17, 2026
@roychying
roychying force-pushed the chenghan.ying/sq-hook-request-started branch from 86f8b0a to bf89510 Compare November 17, 2026 06:30
@roychying
roychying force-pushed the chenghan.ying/sq-hook-request-started branch from bf89510 to 5540e3f Compare November 17, 2026 08:12
@roychying
roychying added this pull request to stack #1111 November 17, 2026 19:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant