Skip to content

When delegating to an extension, exit with the same code the extension used#1116

Merged
chaptersix merged 2 commits into
temporalio:mainfrom
jeri-temporal:extension-error-codes
Jul 9, 2026
Merged

When delegating to an extension, exit with the same code the extension used#1116
chaptersix merged 2 commits into
temporalio:mainfrom
jeri-temporal:extension-error-codes

Conversation

@jeri-temporal

Copy link
Copy Markdown
Contributor

Related issues

CLDDX-141

What changed?

When delegating to an extension (e.g. temporal-cloud, non-zero exit codes don't make it back to the user, so there's no programmatic way to know if the command succeeded. This change uses the exit code of the extension as the exit command for the temporal command that wrapped it.

Checklist

Stability

  • Breaking changes are marked with 💥 in the PR title and release notes
  • Changes to JSON output (-o json / -o jsonl) are treated as breaking changes

Design

  • This feature does not depend on Cloud-only APIs or behavior (it works against an OSS server)
  • New commands follow temporal <noun> <verb> structure (e.g. temporal workflow start)
  • New flags are named after the API concept, not the implementation mechanism (good: --search-attribute, bad: --index-field)
  • New flags don't duplicate an existing flag that serves the same purpose
  • New flags do not have short aliases without strong justification
  • Experimental features are marked with (Experimental) in commands.yaml

Help text (see style guide at the top of commands.yaml)

  • All flags shown in help text and examples are implemented and functional
  • Summaries use sentence case and have no trailing period
  • Long descriptions end with a period and include at least one example invocation
  • Examples use long flags (--namespace, not -n), one flag per line
  • Placeholder values use YourXxx form (YourWorkflowId, YourNamespace)

Behavior

  • Results go to stdout; errors and warnings go to stderr
  • Error messages are lowercase with no trailing punctuation

Tests

  • Added functional test(s) (SharedServerSuite)
  • Added unit test(s) (func TestXxx) where applicable

Manual tests

Setup
Create an executable file named temporal-exit somewhere on your PATH

#!/bin/bash
exit $1

Happy path

$ temporal exit 0; echo $?
0

Error case

$ temporal exit 1; echo $?
1

@jeri-temporal jeri-temporal requested a review from a team as a code owner July 8, 2026 20:27
@CLAassistant

CLAassistant commented Jul 8, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chaptersix chaptersix merged commit 99eb050 into temporalio:main Jul 9, 2026
10 checks passed
@jeri-temporal jeri-temporal deleted the extension-error-codes branch July 9, 2026 16:31
chaptersix added a commit that referenced this pull request Jul 9, 2026
#1112, #1115, #1116) (#1118)

Backports the following PRs from `main` to `release/1.8.x`:

- #1112 — ci/docs: escape MDX-incompatible patterns and add `-subdir` to
gen-docs
- #1115 — Bump `go.temporal.io/server` to v1.31.2 (originally merged
into `release/1.7.x`)
- #1116 — When delegating to an extension, exit with the same code the
extension used

Cherry-picked in merge order with `-x`.

### Notes
- #1115 conflicted on `go.mod`/`go.sum` because `release/1.8.x` was on
`go.temporal.io/server v1.31.0`. Resolved by taking `v1.31.2` and
regenerating `go.sum` via `go mod tidy`.
- `go build ./...` passes; tests for `internal/commandsgen`,
`cmd/gen-docs`, and the extension delegation tests pass locally.

---------

Co-authored-by: Lina Jodoin <lina.jodoin@temporal.io>
Co-authored-by: Jeri Lane <jeri.lane@temporal.io>
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.

3 participants