Skip to content

Add fail-closed goal verifier to completion resolution - #281

Open
raymondginger2018-sudo wants to merge 2 commits into
HKUDS:mainfrom
raymondginger2018-sudo:pr/goal-verifier
Open

raymondginger2018-sudo wants to merge 2 commits into
HKUDS:mainfrom
raymondginger2018-sudo:pr/goal-verifier

Conversation

@raymondginger2018-sudo

Copy link
Copy Markdown
Contributor

Summary

Closes the goal-completion verify loop: a registered async verifier decides whether a goal request may complete, and rejections keep the agent working instead of falsely completing. Borrowed from harness-style goal verification. Dormant unless a verifier is configured — with none registered, behavior is exactly as before.

Changes

  • New core/agent_runtime/goal_verifier.py: GoalRuntimeRouter.configure_completion_verifier registration surface plus verdict normalization helpers.
  • core/agent_runtime/goal_runtime.py:
    • resolve_completion(...) awaits the registered verifier (handles both coroutine and sync verdicts), then feeds the outcome into request(verified=...).
    • A rejection raises GoalRuntimeError("...keep working.") so the turn continues.
    • Fails closed: a verifier exception or empty evidence means "not completed" (the goal is not falsely closed).
  • core/harness/tools/goal.py: pass the verifier outcome through the goal tool response.
  • New tests/test_goal_completion_verifier.py (approval, rejection, exception, empty-evidence, no-verifier paths).

Tests

  • tests/test_goal_completion_verifier.py + tests/test_goal_runtime.py — 19 passed
  • CI-exact lint: pre-commit run --all-files (ruff 0.15.21) — passed
  • Local preflight verdict recorded against this revision (baseline reds unchanged)

Notes

  • Independent PR; no follow-up required for callers that don't register a verifier.

GoalRuntimeRouter.configure_completion_verifier registers an async verdict
callback; GoalRuntime.resolve_completion awaits it and feeds the outcome
into request(verified=...). Rejection raises GoalRuntimeError('...keep
working.'). Exceptions or empty evidence fail closed (goal not completed).

Dormant by default — no verifier configured means exactly the old flow.
…ort-inert

GoalRuntime pulled goal_verifier in at module import; now only
resolve_completion / _confirm_completion / _build_completion_request
import it when the gate actually runs, so processes that merely import
goal_runtime (tools registry, test collection) keep main's import
footprint.

This branch has not been deployed

No deployments
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