Skip to content

docs(agents): document trigger status_reason and resume 409 (MARSOHS-2525) - #1336

Open
nveerdixit wants to merge 2 commits into
digitalocean:mainfrom
nveerdixit:nveerdixit/marsohs-2525-trigger-status-reason
Open

nveerdixit wants to merge 2 commits into
digitalocean:mainfrom
nveerdixit:nveerdixit/marsohs-2525-trigger-status-reason

Conversation

@nveerdixit

Copy link
Copy Markdown

Why

The trigger API now pauses a trigger whose agent config was deleted, says why on every read, and refuses a plain resume. Public clients (godo, doctl, the control panel) cannot show the reason or explain the 409 until this spec documents them. This is part 1 of MARSOHS-2525.

What changed

  • trigger gains status_reason and status_message. status_reason is a string, not a closed enum, like trigger_execution.status_reason. The known value is agent_config_deleted. Both fields are present only while the service has paused the trigger.
  • PATCH /v2/harness-runtime/triggers/{trigger_id} documents the new 409: status: active without a new session_template while status_reason is agent_config_deleted. The error message is the same text as status_message.
  • The resume rule matches the service. One PATCH with a new session_template and status: active resumes the trigger. A session_template alone clears the reason and leaves the trigger paused.
  • session_template on reads is omitted while the reason is set, because the deleted config cannot be read back.

Scope

Spec only. godo, doctl and the control panel follow in separate changes.

Verification

  • make lint (the Validate spec CI job, which also runs make bundle) exits 0. Both Spectral passes report 0 errors and 8 warnings, all in files this PR does not touch.
  • The bundled spec shows the two fields on the trigger returned by get, list and update, and the new 409 text.

This needs API Engineering review. Merge once the service returns these fields in production.

🤖 Generated with Claude Code

…2525)

The service now pauses a trigger whose agent config was deleted and
tells the customer why. Add status_reason and status_message to the
trigger schema, and document that re-enabling such a trigger without
a new session_template returns 409.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@sanpj2292 sanpj2292 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the service behavior. One gap is noted inline. Client follow-ups (dots, the MCP server, the console) are tracked in MARSOHS-2525.

'409':
description: Duplicate name, or an attempt to change an immutable field (kind, provider).
description: >-
Duplicate name, an attempt to change an immutable field (kind, provider), or status active

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 409 isn't only for status: active. If the trigger gets paused for a deleted agent config while any PATCH is in flight (a rename, for example), the service refuses the whole update with the same 409. Suggest adding something like: "…or the trigger was paused because its agent config was deleted while this update was in flight."

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that any PATCH can hit this. Every ordinary update runs a compare-and-swap on status_reason (storer_mysql.go:410), so a rename that races the pause is refused as a whole. One detail from the service: only a request that sets status active gets the resume message. Any other update gets "the trigger was modified concurrently; please retry" (updateMissErr, handlers.go:736-743). The description now says nothing is applied in that case and tells clients to re-read and retry (8badfab).

A PATCH that races a deleted-config pause is refused whole with a 409,
not only one that sets status active. Only a resume gets the resume
message; any other update is told to retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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