feat(task): support parameters on task run#62
Open
skipi wants to merge 3 commits into
Open
Conversation
`task run <id>` posted run_now with a nil body, so task parameters were silently dropped — parameterized scheduled tasks could not be triggered from the CLI. Add `--param KEY=VALUE` (repeatable), `--branch`, and `--pipeline-file`. The body is built only when an override is supplied, so the parameter-less default is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rray
The POST /promotions endpoint maps every non-reserved top-level body key
to a promotion env var whose value must be a string. Sending parameters
nested as "parameters": [{name, value}] left the "parameters" key itself
as a list-valued env var, so the server rejected it (EnvVariable value is
invalid) and returned HTTP 500. Send each --param as a flat top-level body
key instead, so it encodes as a string promotion env var.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
manage-infra: `task run --param/--branch/--pipeline-file`. deploy: note that each promote `--param` becomes a promotion env var, with a generic example. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
10fef08 to
cb48d86
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make sem-ai's parameterized API calls work. Two related changes to how the CLI passes parameters:
task run— support parameters at all (they were silently dropped).pipeline promote— fix--param, which sent the wrong body shape and returned HTTP 500.The two endpoints consume parameters differently, so each path is matched to its endpoint (see note below).
1.
task run: support--param,--branch,--pipeline-filesem-ai task run <id>postedrun_nowwith a nil body, so task parameters were silently dropped — parameterized scheduled tasks couldn't be triggered from the CLI at all.Adds to
task run:--param KEY=VALUE(repeatable)--branch— git ref the task pipeline runs on--pipeline-file— pipeline YAML the task runsThe body is built only when an override is supplied, so the parameter-less default is unchanged.
Shape:
run_nowconsumesparametersas a map, withbranch/pipeline_filealongside.2.
pipeline promote: fix--param(was HTTP 500)pipeline promote --paramsent parameters nested as"parameters": [{name, value}]. But thePOST /promotionsendpoint maps every non-reserved top-level body key — everything exceptswitch_id/name/user_id/override/request_token/pipeline_id— to a promotion env var whosevaluemust be a string. The nested array leftparametersas a list-valued env var, so the server rejected it (EnvVariablevalue invalid) and returned HTTP 500.Fix: send each
--paramas a flat top-level body key.Verified
task runwith--param/--branch/--pipeline-file→ triggers a parameterized task:200 { "workflow_id": "…" }.pipeline promote <id> --target "<promotion>" --param KEY=VALUE --confirm→200, promotion triggered.go vet+go test ./cmd/pass;gofmtclean.🤖 Generated with Claude Code