Skip to content

feat(task): support parameters on task run#62

Open
skipi wants to merge 3 commits into
mainfrom
skipi/task-run-params
Open

feat(task): support parameters on task run#62
skipi wants to merge 3 commits into
mainfrom
skipi/task-run-params

Conversation

@skipi

@skipi skipi commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Make sem-ai's parameterized API calls work. Two related changes to how the CLI passes parameters:

  1. task run — support parameters at all (they were silently dropped).
  2. 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-file

sem-ai task run <id> posted run_now with 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 runs

The body is built only when an override is supplied, so the parameter-less default is unchanged.

Shape: run_now consumes parameters as a map, with branch / pipeline_file alongside.

2. pipeline promote: fix --param (was HTTP 500)

pipeline promote --param sent parameters nested as "parameters": [{name, value}]. But the POST /promotions endpoint maps every non-reserved top-level body key — everything except switch_id/name/user_id/override/request_token/pipeline_id — to a promotion env var whose value must be a string. The nested array left parameters as a list-valued env var, so the server rejected it (EnvVariable value invalid) and returned HTTP 500.

Fix: send each --param as a flat top-level body key.

Why the two paths differ: run_now consumes parameters as a map; /promotions consumes flat top-level keys. Intentional per-endpoint contract — each is now correct.

Verified

  • task run with --param / --branch / --pipeline-file → triggers a parameterized task: 200 { "workflow_id": "…" }.
  • pipeline promote <id> --target "<promotion>" --param KEY=VALUE --confirm200, promotion triggered.

go vet + go test ./cmd/ pass; gofmt clean.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the enhancement New feature or request label Jun 18, 2026
skipi and others added 3 commits June 19, 2026 11:10
`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>
@skipi skipi force-pushed the skipi/task-run-params branch from 10fef08 to cb48d86 Compare June 19, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant