Skip to content

feat(agent): opt-in retry for no-tool-call stalls via HERMES_STALL_RETRY_MODEL - #35620

Closed
OmarB97 wants to merge 2 commits into
NousResearch:mainfrom
OmarB97:fix/dflash-stall-retry-adopt-tools-upstream
Closed

feat(agent): opt-in retry for no-tool-call stalls via HERMES_STALL_RETRY_MODEL#35620
OmarB97 wants to merge 2 commits into
NousResearch:mainfrom
OmarB97:fix/dflash-stall-retry-adopt-tools-upstream

Conversation

@OmarB97

@OmarB97 OmarB97 commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add an opt-in HERMES_STALL_RETRY_MODEL path for short no-tool-call action preambles from dflash
  • route successful retry tool calls through the normal tool executor in the same loop iteration
  • fail closed as a partial turn when the retry also returns no tool call, so planning-only text is not persisted as a final assistant message
  • add regression tests for stall detection, retry model switching, and the conversation-loop ordering

Root Cause

The dflash Q4 lane can stop after text like “Let me check ...” without emitting a tool call. Accepting that as a normal final response leaves the session with an assistant planning turn and makes later continue prompts inherit poisoned history. The retry must either produce executable tool calls or fail the turn without saving the stalled assistant text.

Validation

  • python3 -m pytest tests/agent/test_stall_retry.py
  • python3 -m py_compile agent/conversation_loop.py agent/stall_retry.py

OmarB97 and others added 2 commits May 30, 2026 18:32
dflash (Qwen3.6-27B Q4_K_M, lucebox spec-decode) sometimes ends an agentic
decision turn with EOS right after a short action preamble ("Let me check
X:") and NO tool_call, stalling the loop. Higher-precision weights (the
stock qwen3.6-27b-256k lane on the same host) continue to a real tool call
on the identical prompt.

This adds agent/stall_retry.py: when a no-tool-call turn looks like that
stall (short, announces an action, not a genuine completion) and
HERMES_STALL_RETRY_MODEL is set, re-issue the SAME turn once on that lane;
if it yields tool calls, adopt it and continue. Same provider/endpoint so
only the model name is overridden (no client rebuild). Fires at most once
per conversation. No-op unless the env is set, so default behavior is
unchanged.

Validated: detector 17/17 on real captured stall contents, 0 false
positives on genuine completions; live retry recovered real stalls into
real tool calls (terminal/execute_code) against the live endpoint; runs
correctly under `hermes -z` (probe-confirmed, env propagated).
@OmarB97
OmarB97 marked this pull request as ready for review May 31, 2026 01:37
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels May 31, 2026
@OmarB97 OmarB97 changed the title [dflash] Retry no-tool-call stalls without poisoning history feat(agent): opt-in retry for no-tool-call stalls via HERMES_STALL_RETRY_MODEL Jun 9, 2026
@OmarB97

OmarB97 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #37166, which carries this same stall-retry stack (agent/stall_retry.py + conversation_loop integration + tests) in its complete form. Consolidating to one canonical PR so reviewers don't see three PRs creating the same module.

@OmarB97 OmarB97 closed this Jun 9, 2026
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 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.

2 participants