Skip to content

fix(verifiers): a judge task our poll gave up on is cancelled, so it stops calling its model - #881

Closed
earakely-scale wants to merge 1 commit into
mainfrom
edgararakelyan/judge-cancel-on-timeout
Closed

earakely-scale wants to merge 1 commit into
mainfrom
edgararakelyan/judge-cancel-on-timeout

Conversation

@earakely-scale

Copy link
Copy Markdown
Collaborator

What changes

When our poll of an agent judge times out, the judge's A2A task is now cancelled, the same way a cancel already stops it. Before, the judge kept working and calling its model until its own time limit. With judge_timeout_retries, that limit is the poll's plus 60 s (_JUDGE_TIMEOUT_MARGIN_SECONDS), so the timed-out turn ran beside its retry on the same judge, and its calls were billed. #880's chaos run showed those late calls landing after the run.

  • The cancel goes out before the trajectory so far is fetched, so the judge stops spending first. A cancel seals the judge's trajectory as cancelled, and the trajectory can still be fetched.
  • It applies with or without retries, since either way the poll has given up.
  • A judge that stopped answering (AgentUnreachableError) isn't sent a cancel.
  • The cancel is best effort (cancel_a2a_task only logs a judge it can't reach), and is shielded like the existing one.

Tests

test_rubrics_verifier_judge_timeout_retry.py:

  • a timeout without retries cancels the judge's task;
  • a retried timeout cancels only the timed-out task;
  • the last timeout cancels every timed-out task;
  • a judge that stopped answering isn't sent a cancel;
  • a judge task that fails before the deadline isn't cancelled.

The first three fail on main.

E2E against the real proxy

LIVE_RESULTS

🤖 Generated with Claude Code

…stops calling its model

On a poll timeout the judge kept working until its own time limit, 60 s later with judge_timeout_retries, beside the
retry on the same judge, and its calls were billed. A cancel already stopped it; a timeout now does too, before its
trajectory so far is fetched. A judge that stopped answering isn't sent one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale

Copy link
Copy Markdown
Collaborator Author

Closing: the premise was wrong. poll_a2a_task already cancels the agent's task when it times out (and when the agent stops answering), since #82, so a judge our poll gave up on is already stopped. A live check showed it: every cancel this PR added was refused with "Task cannot be canceled - current state: TaskState.canceled". The late Claude Code calls #880's chaos run saw were model calls already in flight when the cancel landed. The proxy still answers those, and nothing on our side can stop them.

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