Skip to content

fix(mothership): settle a sim_cli wait that outlasted --wait-timeout as done, not failed - #9469

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/cli-still-running-not-failed
Oct 30, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/cli-still-running-not-failed

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

A sim_cli wait whose --wait-timeout elapsed while the work keeps going exits 4 and prints the record to continue from. That covers workflows runs wait, a synchronous workflows run that detached (#9464), and a workspace operation wait. The sim_cli handler treated every non-zero exit as a failed call. So when the worker runs a long draft workflow test run in slices, each still-running slice got:

  • recorded in copilot_async_tool_calls as failed, with the "still running" stderr line as its error
  • published to the chat as an errored tool row. Its title stays in the progressive tense ("Running workflow", "Waiting for workflow run") instead of "Ran workflow" / "Waited for workflow run", and the activity header drops the model's completed title (e.g. "Tested the draft workflow") for a summary of the calls that did succeed
  • counted as outcome=error in copilot.tool.calls, with the tool span ended as error

The CLI now names that exit status (STILL_RUNNING_EXIT_CODE, exported from sim/embed) at both places that produce it. The handler settles it as a successful call and keeps exitCode: 4 in the output, which is what the worker branches on to issue the next slice. Every other non-zero exit is still a failed call, including 1 (the run failed), 2 (cancelled) and 3 (paused).

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • New regression test in sim-cli-bridge.test.ts: an exit-4 wait settles as { success: true, output: { exitCode: 4, … } }. It fails on the pre-fix handler (success: false with the stderr line as error).
  • Before the fix, I traced that pre-fix result through executeToolAndReport with a throwaway probe: async row failed, client tool event status: error, metric outcome: error. The UI helpers gave "Running workflow" and "Waiting for workflow run" for errored rows, and a group header of "Get run" instead of "Tested the draft workflow".
  • bun run lint, type-check (sim, sim-cli), check:audits, and the vitest suites for lib/mothership/agent-cli, the handler and sim-cli commands/protocol all pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…as done, not failed

A wait whose --wait-timeout elapsed with the work still going (workflows runs
wait, a detached synchronous workflows run, a workspace operation wait) exits 4
and prints the record to continue from. The sim_cli handler mapped every
non-zero exit to a failed call, so each still-running slice the worker issues
for a long draft run was recorded as a failed async tool call, published to the
chat as an errored row (titled 'Running workflow' / 'Waiting for workflow run'
instead of the past tense, and dropping the activity's completed title), and
counted as outcome=error in copilot.tool.calls.

The CLI now names that status (STILL_RUNNING_EXIT_CODE, exported from
sim/embed) at both producers, and the handler settles it as success while
keeping exitCode 4 in the output the worker branches on.
@vercel

vercel Bot commented Oct 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 30, 2026 10:51am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

This PR treats an expired sim_cli wait as a completed tool call while keeping exitCode: 4 available for the next wait.

  • Waits that reach their deadline finish as successful tool calls.

No actionable issues were found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "fix(mothership): settle a sim_cli wait t..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 1782a22 into staging Oct 30, 2026
69 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/cli-still-running-not-failed branch October 30, 2026 16:35
waleedlatif1 added a commit that referenced this pull request Oct 30, 2026
…l controller (#9475)

* test(mothership): drive a draft run past a wait slice through the real controller

A live case for the worker's sliced synchronous `workflows run`
(#9464, #9469): a draft with Wait blocks totalling 500 s runs
through runCopilotLifecycle, the sim_cli handler, the embedded CLI and the v2
execute and runs routes against the worker's scripted draft-run probe. With
workflow-run-wait-timeout declared it checks the detached first slice, the
`workflows runs wait` slices, the output read-back, that no call holds the run
and no slice row is failed, and that the model receives the run's output.
Without the capability it checks one held call as before, and a model's own
--wait-timeout 5 reaches the model as exit 4 with the running receipt.

The controller fixture now pins direct Sim transport, since self-hosted
defaults to checkpoint delivery and its run control went unanswered, and the
fixture plan's execution timeout is per case so a run can outlast a slice.

* test(mothership): keep the draft-run case inside the repo's audits

Uses sleep from @sim/utils/helpers, guards the last wait slice instead of a
non-null assertion, gives the probe's startup its own ten-second deadline like
the neighbouring controller case, and tells knip the probe path lives in the
worker checkout.

This branch was previously deployed

1 inactive deployment
Preview — 1a1cc84f Deployed Oct 30, 2026 by vercel[bot]
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