Skip to content

Fail useagent fan --qc when no verifier passed the work - #421

Merged
abhishekgahlot2 merged 1 commit into
useagenthq:mainfrom
officialasishkumar:fix/fan-qc-unverified-exit
Nov 5, 2026
Merged

abhishekgahlot2 merged 1 commit into
useagenthq:mainfrom
officialasishkumar:fix/fan-qc-unverified-exit

Conversation

@officialasishkumar

@officialasishkumar officialasishkumar commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

By opening this pull request you agree to the Contributor License Agreement. On your first pull request a bot asks you to sign it with a one-line comment.

Fixes #417

useagent fan --qc gates a batch on a verifier, but fanCommand only checked verdict !== "fail" and ignored the verifier run's own status. In three cases it exited 0 or did the wrong work:

  • Verifier run fails or times out. There is usually no VERDICT: line, so the verdict is "unknown". The row kept the work run's completed status and the command exited 0.
  • Verifier completes with no verdict. The verdict is "unknown" and the command exited 0.
  • Work run never finished. Runs that failed, or hit the settle timeout while still working, were still sent to QC. For a run still working, that queued a verifier turn behind it in the same thread and waited up to another 15 minutes to judge unfinished work.

The existing case where verify throws already reports verification_error and exits 1. This change applies the same rule to the cases above.

What changed

All code changes are in packages/cli/src/commands.ts:

  • Only runs that settled completed are sent to the verifier. A failed or timed-out run keeps its own status, which already makes the command exit 1.
  • A verifier run that does not complete becomes status: "verification_error" with verdict: "unknown". The error names the verifier run and its status, for example verifier run <id> did not complete (timeout).
  • With --qc, the command exits 0 only when every verdict is pass. Without --qc, nothing changes.
  • packages/cli/README.md states the exit rule.

Tests

Three new cases in packages/cli/test/commands.test.ts, using the package's fake client:

  • one verifier run ends failed (with a stray VERDICT: PASS in its partial answer) and one ends timeout: both rows are verification_error with the expected error, and the command exits 1
  • a completed verifier with no verdict line: exit 1, and the summary reads verdicts: 2 unknown
  • a work run that settles timeout is never sent to verify, and the completed one is

All three fail on main. Checks with Bun 1.3.14:

  • cd packages/cli && bun run test: 49 pass, 0 fail
  • cd packages/cli && bunx -p typescript@5.9.3 tsc --noEmit: passes

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

fanCommand gated a QC batch on `verdict !== "fail"` and ignored the
verifier run's own status. A verifier run that failed or timed out
usually leaves no VERDICT line, so its verdict was "unknown", the row
kept the work run's "completed" status with no error, and the command
exited 0. A completed verifier that gave no verdict also exited 0. The
existing case where verify throws already shows the intended rule: it
is a verification_error and the batch exits 1.

QC also ran on every settled run, including runs that failed or hit the
settle timeout while still working. For a run still working, that queued
a verifier reply behind it in the same thread and waited up to another
15 minutes to judge unfinished work.

Now:
- only completed runs are sent to the verifier; a failed or timed-out
  run keeps its own status, which already exits 1
- a verifier run that does not complete is reported as
  verification_error, with an error naming the verifier run and its
  status
- with --qc, the command exits 0 only when every verdict is PASS

The README states the exit rule. Three new cases in
test/commands.test.ts cover a failed and a timed-out verifier, a
verifier with no verdict, and a timed-out work run that must not be
verified. All three fail without the change.

Fixes useagenthq#417
@abhishekgahlot2
abhishekgahlot2 merged commit fd37469 into useagenthq:main Nov 5, 2026
20 checks passed
@abhishekgahlot2

Copy link
Copy Markdown
Contributor

Merged, thanks @officialasishkumar. A batch should only pass when a verifier actually said PASS, and now it does.

@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail useagent fan --qc when no verifier passed the work

2 participants