Repository navigation
feat(durable): answer durable callbacks with their token - #337
Conversation
8a42e87 to
0afce52
Compare
Adds volcano durable callbacks succeed, fail and heartbeat. The token is the only credential they send, so the system a workflow hands a token to needs no login or project; - reads the token from stdin. Syncs the three callback routes into the vendored contract and adds cloud and local-mode E2E that answer the tokens a workflow logs. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…n SDK Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
0afce52 to
f9e8bf1
Compare
AI review: no P0-P2 findingsAdds ⚪ P3
Not checked: The AI review read the diff, the code, and the PR's text; it ran no tests or builds and read nothing outside this repository.
Human review: needed
The AI review found no P0-P2 problems at 29311b8, so the code needs no second review for bugs. Decide the points above: approve to accept them, or request changes. Suggested reviewer: |
There was a problem hiding this comment.
🟡 Changes recommended
HTML escaping can push valid callback results over the request limit, API error translation loses documented exit codes and telemetry metadata, and unrelated project-link errors can block token-only commands.
3 open issues
What changed in this PR
Adds token-based callback commands so external systems can resume or heartbeat durable workflows without a login or project.
Changes:
- Adds
callbacks succeed,fail, andheartbeat, including stdin tokens, JSON output, and refusal messages. - Extends the OpenAPI specification and generated client, and adds callback-token telemetry redaction.
- Documents callback usage and adds unit and cloud/local end-to-end coverage.
| File | Description |
|---|---|
tests/e2e/localmode/durable_callbacks_test.go |
Tests callback round trips on the local stack. |
tests/e2e/api/durable_callbacks_test.go |
Tests cloud callbacks without holder login. |
openapi/openapi.yaml |
Defines callback routes and schemas. |
Makefile |
Includes callbacks in local acceptance tests. |
internal/telemetry/fields.go |
Adds callback-token redaction. |
internal/telemetry/fields_test.go |
Tests callback-token redaction. |
internal/durable/callbacks.go |
Adds token validation, service calls, and refusal mapping. |
internal/cmd/durable/durable.go |
Registers the callbacks command group. |
internal/cmd/durable/callbacks/succeed.go |
Adds JSON-result submission and null rejection. |
internal/cmd/durable/callbacks/heartbeat.go |
Adds heartbeat submission. |
internal/cmd/durable/callbacks/fail.go |
Adds callback failure submission. |
internal/cmd/durable/callbacks/callbacks.go |
Provides token input and shared output helpers. |
internal/cmd/durable/callbacks/callbacks_test.go |
Tests command input, authentication behavior, and outcomes. |
internal/apiclient/client.gen.go |
Generates callback models and request methods. |
internal/api/durable_callbacks.go |
Wraps callback API operations. |
internal/api/durable_callbacks_test.go |
Tests request bodies and refusal codes. |
docs/telemetry.md |
Documents callback-token redaction. |
docs/README.md |
Lists callback support. |
docs/durable-functions.md |
Documents callback commands and retry behavior. |
Review effort: Balanced
…scaped A translated refusal keeps the API error as its cause, so an unknown token exits 4 and telemetry keeps the status and code. Answers are encoded without HTML escaping, the commands ignore an unusable project link, and the E2E tests accept an answer that is still delivering. Co-authored-by: Cursor <cursoragent@cursor.com>

Adds
volcano durable callbacks succeed|fail|heartbeat <token>, the token holder's side ofctx.waitForCallback(hosting#1966).-instead of the token to read it from stdin.<token>placeholder isn't on telemetry's resource list.succeedtakes--resultor--result-fileand refusesnullbefore sending.failtakes--typeand--message.202reports that the answer is still being delivered and shouldn't be resent.callback_completed,callback_expired,execution_ended,callback_not_foundand a heartbeat503each say what became of the wait.openapi/openapi.yaml, and the client is regenerated.vcb_tokens, in case an error ever quotes one. Hosting#1966 makes the same change to its copy of the rules.Tests
Authorizationheader, stdin tokens, refusals made before any request, and refusal mapping.TestAPIE2ECloudDurableCallbacksruns in hosting's cloud-e2e durable CLI suite. hosting#1966 adds it todurable_regex. The workflow logs each token, and the test reads it fromdurable logs --type runtime. It then heartbeats and succeeds one token and fails the next, using a freshHOMEwith no login, and follows both outcomes into the execution's result.TestLocalModeE2EDurableCallbacksruns the same round trip on the local stack. It is added tomake localmode-e2e, which this repo'slocalmode-e2ejob and hosting's local-mode workflow both run. Local mode supports callbacks (hosting#1966), so there is no refusal path.Merge order
This PR stays a draft until its dependencies exist. The cloud test pins
@volcano.dev/sdk^2.2.0, the first release withwaitForCallback, and runs only from CLI main after that release. The local-mode test deploys a Python workflow that builds volcano-sdk-python from a source archive of a fixed commit (the head of Kong/volcano-sdk-python#400, then its merge commit), so it doesn't wait for a release. It switches tovolcano-sdk-python~=0.16.0once that's published. Both tests need a server and alocal-nightlyimage with the callback routes, solocalmode-e2estays red until hosting#1966 merges and the nightly image rebuilds.