Skip to content

feat: add structured input pauses#59

Merged
mbelinky merged 2 commits intomainfrom
mariano/slice-needs-input
Apr 6, 2026
Merged

feat: add structured input pauses#59
mbelinky merged 2 commits intomainfrom
mariano/slice-needs-input

Conversation

@mbelinky
Copy link
Copy Markdown
Contributor

@mbelinky mbelinky commented Apr 6, 2026

Summary

Scope

Included:

  • ask
  • workflow input
  • needs_input envelopes
  • --response-json resume path
  • deep step refs like $review.response.decision

Explicitly excluded from this PR:

  • richer condition grammar
  • retry / retry_delay / on_error
  • next / loops / max_iterations

Hardening

  • preserves existing approval-id resume behavior
  • validates user-provided schemas before use
  • preserves the full workflow input subject in resume state even when the tool envelope preview is truncated

Verification

  • pnpm build
  • pnpm test

Ref: #39

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c286282754

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +257 to +261
if (cancel === true || approved === false) {
if (consumedResumeStateKey) {
await deleteStateJson({ env: ctx.env, key: consumedResumeStateKey });
}
return { status: 'cancelled', output: [] };
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require explicit approval decision before resuming workflow

In the approval-resume branch, only approved === false is treated as cancellation, but approved === undefined is allowed to proceed. Since resumeToolRequest now accepts optional intents, a caller can resume an approval-paused workflow without passing any decision and still execute downstream steps. This bypasses the approval gate for API consumers that call resume programmatically with just a token.

Useful? React with 👍 / 👎.

Comment on lines +770 to +773
if (refValue === undefined) {
if (pathValue === 'approved' || pathValue === 'skipped') return 'false';
return '';
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep unresolved step refs intact in template substitution

Template expansion now replaces missing $<id>.<path> references with an empty string. The new regex also matches normal shell variable concatenations like $HOME.json, so commands can be silently corrupted when there is no workflow step named HOME. Previously unresolved references were left as-is; this regression can break existing workflow commands by deleting command text unexpectedly.

Useful? React with 👍 / 👎.

@mbelinky mbelinky merged commit 8e66d15 into main Apr 6, 2026
@mbelinky mbelinky deleted the mariano/slice-needs-input branch April 6, 2026 13:19
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fda74a8189

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +260 to +263
if (approved !== true) {
await cleanupIndex();
await deleteStateJson({ env: runtime.env, key: payload.stateKey });
return okEnvelope('cancelled', [], null, null);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require explicit decision for pipeline approval resumes

The pipeline resume path now treats any value other than approved === true as cancellation, so omitting approved silently cancels and deletes the saved state. Since approved was made optional in this commit to support input resumes, programmatic callers can now accidentally drop an approval-paused pipeline by calling resumeToolRequest without an explicit decision instead of getting a parse error.

Useful? React with 👍 / 👎.

Comment on lines +111 to +114
if (params.previousStateKey) {
await cleanupApprovalIndexByStateKey({ env: params.env, stateKey: params.previousStateKey });
await deleteStateJson({ env: params.env, key: params.previousStateKey });
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve prior resume state until new approval ID is persisted

This branch deletes previousStateKey (and its approval index) before creating the next approval ID. If createApprovalIndex fails afterward, the catch removes nextStateKey and rethrows, leaving no resumable state at all. That turns a transient storage/index failure into unrecoverable loss of the paused pipeline.

Useful? React with 👍 / 👎.

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.

1 participant