Skip to content

fix: exit with error when agent job status is failed - #296

Open
flcrom wants to merge 4 commits into
firecrawl:mainfrom
flcrom:fix/agent-failed-status-check
Open

flcrom wants to merge 4 commits into
firecrawl:mainfrom
flcrom:fix/agent-failed-status-check

Conversation

@flcrom

@flcrom flcrom commented Oct 1, 2026 •

Copy link
Copy Markdown

firecrawl agent <jobId> on a job that already failed printed {"success":true,"status":"failed","data":null} and exited 0, so the server's error was lost. The --wait path already returns the failure with the error; this makes the plain status check do the same: exit 1 with the server's error, or "Agent failed" if none is sent. Completed, processing and cancelled are unchanged.

This covers the remaining non-wait case of #115, it doesn't close the whole issue.

Added agent-status.test.ts (6 cases against a local HTTP fixture). The failed-status case fails on current main. pnpm test, type-check and format:check pass locally.

AI help was used for this change.


Summary by cubic

Makes firecrawl agent <jobId> exit 1 when an already-failed job is checked, matching the --wait path so the server's error isn't lost.

  • Prints the server's error to stderr, or "Agent failed" when the server sends none.
  • Completed, processing, and cancelled statuses are unchanged.
  • Adds agent-status.test.ts covering exit codes across all statuses, empty/missing errors, and HTTP rejection cases.

Written for commit 4746693. Summary will update on new commits.

Review in cubic

flcrom added 2 commits October 1, 2026 20:22
The plain `firecrawl agent <jobId>` check printed {"success":true,"status":"failed","data":null} and exited 0 for an already-failed job, dropping the server error. Match the --wait path: exit 1 with the server's error (or "Agent failed" when none is sent). Completed, processing and cancelled statuses are unchanged. Refs firecrawl#115.

@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 2 open P3 issues. Makes the non-wait agent status check exit 1 on failed jobs and surface the server error, matching the existing --wait behavior. Adds fixture-based tests covering exit codes across statuses, keeping the fix bounded and verified.

Fix all with cubic | Re-trigger cubic

Comment thread src/commands/agent.ts Outdated
Comment thread src/__tests__/commands/agent-status.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 2 files (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 firecrawl agent <jobId> to exit 1 and surface the server error for failed jobs, matching the --wait path; other statuses stay unchanged and tests cover the behavior.

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