Skip to content

Add verification stop loop - #52296

Merged
OutThisLife merged 1 commit into
mainfrom
bb/verify-stop-loop
Jun 25, 2026
Merged

Add verification stop loop#52296
OutThisLife merged 1 commit into
mainfrom
bb/verify-stop-loop

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add default-on agent.verify_on_stop / HERMES_VERIFY_ON_STOP behavior for coding turns, with config/env escape hatches to disable
  • track concrete resolved file paths for landed write_file / patch edits during a turn
  • before accepting a final answer, ask the model to run canonical checks, repair failures, or explain the concrete blocker when edited code lacks fresh passing verification evidence
  • keep the loop bounded and preserve message alternation by storing the attempted final answer internally followed by a synthetic user nudge
  • avoid surfacing the premature final answer to users while the verification guard is asking for another repair/check turn
  • clean retry/empty-response scaffolding before verification-stop nudges, matching normal final-response transcript hygiene

Stack

Stacked on #52285 (bb/verify-ledger). This consumes the passive verification ledger; it does not depend on the desktop RPC in #52286.

Test plan

  • scripts/run_tests.sh tests/agent/test_verification_stop.py tests/agent/test_verification_evidence.py tests/agent/test_coding_context.py tests/run_agent/test_file_mutation_verifier.py -- -q

@alt-glitch alt-glitch added type/feature New feature or request comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Jun 25, 2026
@OutThisLife OutThisLife changed the title Add opt-in verification stop loop Add verification stop loop Jun 25, 2026
@OutThisLife
OutThisLife force-pushed the bb/verify-stop-loop branch from 1fb7152 to 6375628 Compare June 25, 2026 03:52
Make verification closure the default coding behavior after landed file edits while keeping bounded retries and config/env switches for users who need to disable it.
@OutThisLife
OutThisLife force-pushed the bb/verify-stop-loop branch from 6375628 to 2f1a47b Compare June 25, 2026 04:02

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Well-structured verify-on-stop loop implementation. The feature is well-scoped with proper config/env escape hatches, bounded retry loop, and clean separation of concerns. Good test coverage.

Changes:

  • agent/conversation_loop.py: Verification check before accepting final answer
  • agent/tool_dispatch_helpers.py: New _extract_landed_file_mutation_paths function
  • agent/turn_context.py: Per-turn verification state initialization
  • agent/verification_stop.py: New module with build_verify_on_stop_nudge and verify_on_stop_enabled
  • hermes_cli/config.py: New verify_on_stop config option
  • run_agent.py: Re-export of _extract_landed_file_mutation_paths
  • tests/agent/test_verification_stop.py: Comprehensive test suite
  • tests/run_agent/test_file_mutation_verifier.py: Updated tests for landed paths

LGTM.

Reviewed by Hermes Agent

Base automatically changed from bb/verify-ledger to main June 25, 2026 04:07
@OutThisLife
OutThisLife merged commit d473e5d into main Jun 25, 2026
@OutThisLife
OutThisLife deleted the bb/verify-stop-loop branch June 25, 2026 04:10
OutThisLife pushed a commit that referenced this pull request Jun 26, 2026
The verify-on-stop guard (PRs #52296, #52297) defaulted ON for every
session, so on gateway messaging surfaces (Telegram, Discord, etc.) the
model complied with the nudge by writing a hermes-verify temp script and
emitting an ad-hoc verification summary, which the gateway delivered to
the end user as chat noise.

Resolve a surface-aware default instead. The DEFAULT_CONFIG value becomes
the sentinel "auto", which verify_on_stop_enabled() resolves to ON for
interactive coding surfaces (CLI, TUI, desktop) and programmatic callers,
and OFF for conversational messaging surfaces. The surface is read from
HERMES_SESSION_PLATFORM (what the gateway actually binds), with
HERMES_SESSION_SOURCE and HERMES_PLATFORM as fallbacks, matching the
sibling resolution in skill_commands.py and prompt_builder.py. An explicit
HERMES_VERIFY_ON_STOP env var or a boolean agent.verify_on_stop config
still overrides in either direction.

The passive evidence ledger and the call site are untouched.
teknium1 added a commit that referenced this pull request Jun 26, 2026
The verify-on-stop guard (#52296) printed '↻ Verification required before
finishing' to the terminal on every internal nudge turn, adding noise to
CLI/gateway sessions whenever code was edited without fresh passing checks.
Demote the user-facing status emit to a logger.debug breadcrumb — the loop
still nudges the model to verify before finishing, just silently.
@gmaxwell

Copy link
Copy Markdown

This seems to be having pretty bad effects for me with multiple backend llms including qwen 27b. The agent is misinterpreting the prods from it as instructions to go run the code it just wrote even when I keep telling it to not do so I can review it. It's also mistaking it as other commands from me and just confusing thing. I'm not sure if it's unique to me, but between this and a sudden new problem with context cache invalidation I've rolled back to a prior commit I was on. (I see I could just turn this off .. but I doubt this is the cause of the cache problem).

pai-scaffolde pushed a commit to pai-scaffolde/hermes-agent that referenced this pull request Jun 28, 2026
The verify-on-stop guard (PRs NousResearch#52296, NousResearch#52297) defaulted ON for every
session, so on gateway messaging surfaces (Telegram, Discord, etc.) the
model complied with the nudge by writing a hermes-verify temp script and
emitting an ad-hoc verification summary, which the gateway delivered to
the end user as chat noise.

Resolve a surface-aware default instead. The DEFAULT_CONFIG value becomes
the sentinel "auto", which verify_on_stop_enabled() resolves to ON for
interactive coding surfaces (CLI, TUI, desktop) and programmatic callers,
and OFF for conversational messaging surfaces. The surface is read from
HERMES_SESSION_PLATFORM (what the gateway actually binds), with
HERMES_SESSION_SOURCE and HERMES_PLATFORM as fallbacks, matching the
sibling resolution in skill_commands.py and prompt_builder.py. An explicit
HERMES_VERIFY_ON_STOP env var or a boolean agent.verify_on_stop config
still overrides in either direction.

The passive evidence ledger and the call site are untouched.
pai-scaffolde pushed a commit to pai-scaffolde/hermes-agent that referenced this pull request Jun 28, 2026
…53223)

The verify-on-stop guard (NousResearch#52296) printed '↻ Verification required before
finishing' to the terminal on every internal nudge turn, adding noise to
CLI/gateway sessions whenever code was edited without fresh passing checks.
Demote the user-facing status emit to a logger.debug breadcrumb — the loop
still nudges the model to verify before finishing, just silently.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
The verify-on-stop guard (PRs NousResearch#52296, NousResearch#52297) defaulted ON for every
session, so on gateway messaging surfaces (Telegram, Discord, etc.) the
model complied with the nudge by writing a hermes-verify temp script and
emitting an ad-hoc verification summary, which the gateway delivered to
the end user as chat noise.

Resolve a surface-aware default instead. The DEFAULT_CONFIG value becomes
the sentinel "auto", which verify_on_stop_enabled() resolves to ON for
interactive coding surfaces (CLI, TUI, desktop) and programmatic callers,
and OFF for conversational messaging surfaces. The surface is read from
HERMES_SESSION_PLATFORM (what the gateway actually binds), with
HERMES_SESSION_SOURCE and HERMES_PLATFORM as fallbacks, matching the
sibling resolution in skill_commands.py and prompt_builder.py. An explicit
HERMES_VERIFY_ON_STOP env var or a boolean agent.verify_on_stop config
still overrides in either direction.

The passive evidence ledger and the call site are untouched.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…53223)

The verify-on-stop guard (NousResearch#52296) printed '↻ Verification required before
finishing' to the terminal on every internal nudge turn, adding noise to
CLI/gateway sessions whenever code was edited without fresh passing checks.
Demote the user-facing status emit to a logger.debug breadcrumb — the loop
still nudges the model to verify before finishing, just silently.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
The verify-on-stop guard (PRs NousResearch#52296, NousResearch#52297) defaulted ON for every
session, so on gateway messaging surfaces (Telegram, Discord, etc.) the
model complied with the nudge by writing a hermes-verify temp script and
emitting an ad-hoc verification summary, which the gateway delivered to
the end user as chat noise.

Resolve a surface-aware default instead. The DEFAULT_CONFIG value becomes
the sentinel "auto", which verify_on_stop_enabled() resolves to ON for
interactive coding surfaces (CLI, TUI, desktop) and programmatic callers,
and OFF for conversational messaging surfaces. The surface is read from
HERMES_SESSION_PLATFORM (what the gateway actually binds), with
HERMES_SESSION_SOURCE and HERMES_PLATFORM as fallbacks, matching the
sibling resolution in skill_commands.py and prompt_builder.py. An explicit
HERMES_VERIFY_ON_STOP env var or a boolean agent.verify_on_stop config
still overrides in either direction.

The passive evidence ledger and the call site are untouched.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…53223)

The verify-on-stop guard (NousResearch#52296) printed '↻ Verification required before
finishing' to the terminal on every internal nudge turn, adding noise to
CLI/gateway sessions whenever code was edited without fresh passing checks.
Demote the user-facing status emit to a logger.debug breadcrumb — the loop
still nudges the model to verify before finishing, just silently.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
The verify-on-stop guard (PRs NousResearch#52296, NousResearch#52297) defaulted ON for every
session, so on gateway messaging surfaces (Telegram, Discord, etc.) the
model complied with the nudge by writing a hermes-verify temp script and
emitting an ad-hoc verification summary, which the gateway delivered to
the end user as chat noise.

Resolve a surface-aware default instead. The DEFAULT_CONFIG value becomes
the sentinel "auto", which verify_on_stop_enabled() resolves to ON for
interactive coding surfaces (CLI, TUI, desktop) and programmatic callers,
and OFF for conversational messaging surfaces. The surface is read from
HERMES_SESSION_PLATFORM (what the gateway actually binds), with
HERMES_SESSION_SOURCE and HERMES_PLATFORM as fallbacks, matching the
sibling resolution in skill_commands.py and prompt_builder.py. An explicit
HERMES_VERIFY_ON_STOP env var or a boolean agent.verify_on_stop config
still overrides in either direction.

The passive evidence ledger and the call site are untouched.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…53223)

The verify-on-stop guard (NousResearch#52296) printed '↻ Verification required before
finishing' to the terminal on every internal nudge turn, adding noise to
CLI/gateway sessions whenever code was edited without fresh passing checks.
Demote the user-facing status emit to a logger.debug breadcrumb — the loop
still nudges the model to verify before finishing, just silently.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
The verify-on-stop guard (PRs NousResearch#52296, NousResearch#52297) defaulted ON for every
session, so on gateway messaging surfaces (Telegram, Discord, etc.) the
model complied with the nudge by writing a hermes-verify temp script and
emitting an ad-hoc verification summary, which the gateway delivered to
the end user as chat noise.

Resolve a surface-aware default instead. The DEFAULT_CONFIG value becomes
the sentinel "auto", which verify_on_stop_enabled() resolves to ON for
interactive coding surfaces (CLI, TUI, desktop) and programmatic callers,
and OFF for conversational messaging surfaces. The surface is read from
HERMES_SESSION_PLATFORM (what the gateway actually binds), with
HERMES_SESSION_SOURCE and HERMES_PLATFORM as fallbacks, matching the
sibling resolution in skill_commands.py and prompt_builder.py. An explicit
HERMES_VERIFY_ON_STOP env var or a boolean agent.verify_on_stop config
still overrides in either direction.

The passive evidence ledger and the call site are untouched.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…53223)

The verify-on-stop guard (NousResearch#52296) printed '↻ Verification required before
finishing' to the terminal on every internal nudge turn, adding noise to
CLI/gateway sessions whenever code was edited without fresh passing checks.
Demote the user-facing status emit to a logger.debug breadcrumb — the loop
still nudges the model to verify before finishing, just silently.
@5tevebaker

Copy link
Copy Markdown

This seems to be having pretty bad effects for me with multiple backend llms including qwen 27b. The agent is misinterpreting the prods from it as instructions to go run the code it just wrote even when I keep telling it to not do so I can review it. It's also mistaking it as other commands from me and just confusing thing. I'm not sure if it's unique to me, but between this and a sudden new problem with context cache invalidation I've rolled back to a prior commit I was on. (I see I could just turn this off .. but I doubt this is the cause of the cache problem).

You aren't the only one. This had all kinds of issues for me. I'm glad I finally happened upon a way to disable it. Running GPT-5.6 sol and this was causing failed verification loops because it insisted the verification script be written and run from somewhere the agent didn't have access to.

leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
The verify-on-stop guard (PRs NousResearch#52296, NousResearch#52297) defaulted ON for every
session, so on gateway messaging surfaces (Telegram, Discord, etc.) the
model complied with the nudge by writing a hermes-verify temp script and
emitting an ad-hoc verification summary, which the gateway delivered to
the end user as chat noise.

Resolve a surface-aware default instead. The DEFAULT_CONFIG value becomes
the sentinel "auto", which verify_on_stop_enabled() resolves to ON for
interactive coding surfaces (CLI, TUI, desktop) and programmatic callers,
and OFF for conversational messaging surfaces. The surface is read from
HERMES_SESSION_PLATFORM (what the gateway actually binds), with
HERMES_SESSION_SOURCE and HERMES_PLATFORM as fallbacks, matching the
sibling resolution in skill_commands.py and prompt_builder.py. An explicit
HERMES_VERIFY_ON_STOP env var or a boolean agent.verify_on_stop config
still overrides in either direction.

The passive evidence ledger and the call site are untouched.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…53223)

The verify-on-stop guard (NousResearch#52296) printed '↻ Verification required before
finishing' to the terminal on every internal nudge turn, adding noise to
CLI/gateway sessions whenever code was edited without fresh passing checks.
Demote the user-facing status emit to a logger.debug breadcrumb — the loop
still nudges the model to verify before finishing, just silently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants