Skip to content

Add cancel-execution command for Hosted Agents triggers - #1995

Merged
SSharma-10 merged 2 commits into
mainfrom
prao/MARSOHS-1686/feat.cancel-execution
Sep 30, 2026
Merged

SSharma-10 merged 2 commits into
mainfrom
prao/MARSOHS-1686/feat.cancel-execution

Conversation

@sanpj2292

Copy link
Copy Markdown
Contributor

What

Adds doctl harness-runtime triggers cancel-execution <trigger-id> <execution-id> [--force]
(also reachable via the agent/agents/ohr aliases), wrapping
harness-trigger's new POST /v2/agents/triggers/{trigger_id}/executions/{execution_id}/cancel
(MARSOHS-1686) -- a supported way to end a stuck webhook/cron execution
instead of waiting on the platform's reclaim sweep or destroying the session
by hand.

Shape

  • Mirrors get-execution's command shape and displayers.HostedAgentTriggerExecution
    card/JSON output -- the response is the same execution shape.
  • --force reuses the existing ArgForce/ArgShortForce constants (delete's
    flag), though the purpose differs: it bypasses a server-side guard against a
    dispatch race, not a client confirmation prompt. Without it, cancelling an
    execution that has not started a run yet returns an error.

⚠️ Depends on digitalocean/godo#1129

go.mod currently pins github.com/digitalocean/godo v1.215.1-0.20260924162540-187a35d4a803
-- a pseudo-version of the commit adding Cancel in godo#1129 -- so this
builds and passes tests today. Once that PR merges and ships a real tag
(per godo's own CONTRIBUTING.md, version bump/tag/release is its own
follow-up PR there), this branch's go.mod/go.sum/vendor/ need bumping to
the real released version before this can merge. Flagging prominently so
that step isn't missed.

Testing

go build ./commands/... ./do/... . and go test ./commands/... ./do/... .
-- new cases for JSON mode, text/card mode, and --force actually reaching
the service call as true. Also fixed TestAgentTriggersCommand's exhaustive
subcommand-name assertion to include cancel-execution.

(TestRegistryLogout fails locally on this machine with "credentials not
found in native keychain" -- a local OS keychain issue unrelated to this
change; confirmed it's untouched by this diff.)

Not in this PR

godo mock regenerated via go install go.uber.org/mock/mockgen@latest +
scripts/regenmocks.sh's exact command, per the repo's own documented
process -- no manual mock edits.

harness-trigger now exposes POST .../executions/{id}/cancel (a supported
way to end a stuck webhook/cron execution instead of waiting on the
platform's reclaim sweep or destroying the session by hand).

doctl harness-runtime triggers cancel-execution <trigger-id> <execution-id> [--force]

Mirrors get-execution's command shape and displayer. --force reuses the
existing ArgForce/ArgShortForce constants (delete's flag) but a different
purpose here: it bypasses a server-side guard against a dispatch race, not
a client confirmation prompt -- an execution that has not started a run
yet otherwise returns an error.

Depends on digitalocean/godo#1129 (Cancel method). go.mod currently
pins a pseudo-version of that commit so this builds and tests today;
bump to the real tagged release once that PR merges and ships, per
godo's own CONTRIBUTING.md release process.
@SSharma-10
SSharma-10 merged commit f72a7ce into main Sep 30, 2026
9 checks passed
@SSharma-10
SSharma-10 deleted the prao/MARSOHS-1686/feat.cancel-execution branch September 30, 2026 12:08
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.

2 participants