Conversation
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 4/5
- On a clean checkout,
agent-cancellation.test.tsspawnsdist/index.js, butpnpm testdoes not build it, so the cases fail withENOENT. Build the CLI as part of the test setup.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/__tests__/commands/agent-cancellation.test.ts">
<violation number="1" location="src/__tests__/commands/agent-cancellation.test.ts:56">
P3: This test spawns the compiled `dist/index.js`, but `pnpm test` (`vitest run`) builds nothing, so on a clean checkout the CLI spawn fails with ENOENT and every case errors out — or, after unrelated source edits, the suite quietly tests a stale build. Build the project before running the suite (e.g., a `pretest` script or CI `build` step) or have `cli()` fail with a clear message when `dist/` is missing.</violation>
</file>
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
| ...(await exec( | ||
| process.execPath, | ||
| [ | ||
| 'dist/index.js', |
There was a problem hiding this comment.
P3: This test spawns the compiled dist/index.js, but pnpm test (vitest run) builds nothing, so on a clean checkout the CLI spawn fails with ENOENT and every case errors out — or, after unrelated source edits, the suite quietly tests a stale build. Build the project before running the suite (e.g., a pretest script or CI build step) or have cli() fail with a clear message when dist/ is missing.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/__tests__/commands/agent-cancellation.test.ts, line 56:
<comment>This test spawns the compiled `dist/index.js`, but `pnpm test` (`vitest run`) builds nothing, so on a clean checkout the CLI spawn fails with ENOENT and every case errors out — or, after unrelated source edits, the suite quietly tests a stale build. Build the project before running the suite (e.g., a `pretest` script or CI `build` step) or have `cli()` fail with a clear message when `dist/` is missing.</comment>
<file context>
@@ -0,0 +1,126 @@
+ ...(await exec(
+ process.execPath,
+ [
+ 'dist/index.js',
+ 'agent',
+ prompt,
</file context>
firecrawl agent "<prompt>" --waitkeeps 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--waitalready stops oncancelled; 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-checkandformat:checkpass locally.AI help was used for this change.
Summary by cubic
Stops
firecrawl agent "<prompt>" --waitfrom 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.Written for commit d497c59. Summary will update on new commits.