Skip to content

[Feat] Add retry and original prompt on failed environment starts#411

Merged
mrubens merged 4 commits into
developfrom
feat/retry-failed-environment-start-1tfblqskjsd0v
Jul 16, 2026
Merged

[Feat] Add retry and original prompt on failed environment starts#411
mrubens merged 4 commits into
developfrom
feat/retry-failed-environment-start-1tfblqskjsd0v

Conversation

@roomote-roomote

@roomote-roomote roomote-roomote Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Opened on behalf of Matt Rubens. Follow up by mentioning @roomote-roomote, in the web UI, or in Slack.

Related issue

Internal product request: after Modal spend-limit environment start failures, failed tasks had no way to restart and the original prompt disappeared from the UI.

Why this PR exists

  • A maintainer explicitly invited this PR in the linked issue or discussion
  • I am a maintainer / this is internal Roomote work

What changed

Failed first-start tasks now show a Retry action that re-enqueues a new run on the same task, reusing the original payload after provider issues (for example Modal spend limits) are resolved. Snapshot resume failures still use Retry resume.

The startup failure screen also surfaces the original request under Your prompt (text and attachments) so users can confirm or recover it without hunting task metadata. Session loading falls back to the durable task-level prompt when the run payload alone has no visible prompt.

Follow-up review fixes:

  • Serialize active-run checks with run insertion so concurrent retries cannot create duplicate active runs
  • Ignore provider kickoff message rows when deciding if a failed start is restartable (Slack kickoffs no longer false-block)
  • Show prompt attachments on the failed-start branch that has no displayable error string

How it was tested

  • pnpm --filter @roomote/cloud-agents exec vitest run src/server/__tests__/enqueue-task.test.ts (relaunch + kickoff cases)
  • pnpm --filter @roomote/web exec vitest run src/app/(sandbox)/task/[taskId]/startup/StartupMessage.client.test.tsx
  • Pre-push typecheck/lint/knip gates

Screenshots

Failed environment start shows the Modal error, stored prompt, and Retry

Checklist

  • The PR title follows the repo convention: [Fix], [Feat], [Improve], [Refactor], [Docs], or [Chore] followed by a user-facing description
  • This PR is small and scoped to one change
  • pnpm lint and pnpm check-types pass locally
  • I added tests or included a clear manual validation note above
  • I removed secrets, tokens, private keys, and customer data from code, logs, and screenshots
  • If this change should appear in the changelog, I ran pnpm changeset

@roomote-roomote

roomote-roomote Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

No new code issues found. See task

  • packages/cloud-agents/src/server/task-run-queue.ts:1603 Serialize the active-run check with insertion. The check currently runs before the transaction, so concurrent retry requests can both observe no active run and insert separate pending runs with separate queue scopes, starting duplicate work for the same task.
  • packages/cloud-agents/src/server/task-run-queue.ts:1615 Exclude provider kickoff rows from the “run already has messages” guard. The normal Slack start path persists a task_kickoff task_messages row before provisioning, so every SlackAppMention startup failure is rejected even though that payload kind is explicitly marked relaunchable.
  • apps/web/src/app/(sandbox)/task/[taskId]/startup/StartupMessage.tsx:213 Render prompt attachments in the generic failed branch as well. hasPrompt includes image-only prompts, but this branch only renders promptText, so a failed run without a displayable error silently drops the original attachments.

Reviewed 11bae6c

@roomote-roomote

roomote-roomote Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all three open review items in 11bae6c:

  1. Concurrent retries — active-run check + insert now run under a task-row FOR UPDATE transaction so two clicks cannot enqueue duplicate pending starts.
  2. Slack kickoff false positivestask_kickoff transcript rows are ignored when deciding whether a failed start is restartable.
  3. Image-only prompts — the generic failed branch now renders attachment links, not only text.

Tests updated for restart + kickoff and the startup failure UI.

@mrubens mrubens marked this pull request as ready for review July 16, 2026 04:36
@mrubens mrubens merged commit 50e79ba into develop Jul 16, 2026
17 checks passed
@mrubens mrubens deleted the feat/retry-failed-environment-start-1tfblqskjsd0v branch July 16, 2026 04:36
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