Skip to content

fix: stop agent --wait polling when the job is cancelled - #297

Open
flcrom wants to merge 4 commits into
firecrawl:mainfrom
flcrom:fix/agent-cancelled-wait
Open

flcrom wants to merge 4 commits into
firecrawl:mainfrom
flcrom:fix/agent-cancelled-wait

Conversation

@flcrom

@flcrom flcrom commented Oct 1, 2026 •

Copy link
Copy Markdown

firecrawl agent "<prompt>" --wait keeps polling after the server reports the job as cancelled, so it never returns without --timeout, and with one it exits 1 with "Agent still processing". Checking an existing job id with --wait already stops on cancelled; this makes the start-and-wait path do the same: exit 0 with the cancelled status and data.

Only the polling loop changes (8 lines). Completed, failed, processing and timeout behavior is unchanged.

Added agent-cancellation.test.ts (6 cases against a local HTTP fixture). The two cancellation cases fail on current main. pnpm test, build, type-check and format:check pass locally.

AI help was used for this change.


Summary by cubic

Stops firecrawl agent "<prompt>" --wait from polling forever when the job is cancelled. Previously it only stopped on completed/failed, so a cancelled job kept polling until timeout or exited with "Agent still processing". Now the start-and-wait path matches the existing-job path: it exits 0 with the cancelled status and data. Only the polling loop changes; completed, failed, processing, and timeout behavior are unchanged.

Added agent-cancellation.test.ts (6 cases against a local HTTP fixture). The two cancellation cases fail on current main. pnpm test, build, type-check and format:check pass locally.

Written for commit 75d9f97. Summary will update on new commits.

Review in cubic

@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.

All reported issues were addressed across 2 files

Shadow auto-approve: would auto-approve with 1 open P3 issue. Bounded fix to stop firecrawl agent --wait from polling forever when a job is cancelled: the start-and-wait path now exits 0 with cancelled status/data, matching the existing-job path; adds cancellation tests against a local HTTP fixture.

Fix all with cubic | Re-trigger cubic

Comment thread src/__tests__/commands/agent-cancellation.test.ts Outdated

@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.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

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

Shadow auto-approve: would auto-approve. Fixes agent --wait polling to stop and return success when the job is cancelled, matching the existing check-job path; added fixture-based tests pin the corrected behavior and no other polling behavior changes.

Re-trigger cubic

@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.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

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

Shadow auto-approve: would auto-approve. Fixes agent --wait start-and-wait polling to stop and exit 0 with cancelled status and data, matching the existing job-id path; fixture-based tests pin the corrected behavior and other polling outcomes are unchanged.

Re-trigger cubic

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