Problem
Some models can produce a valid final textual response while repeatedly failing to emit AlphaCode's finish tool call. The runtime currently allows this to become an unbounded continuation loop.
Reproduction
With Nex-N2.5-Pro, a trivial session was observed behaving like this:
- User sends
Bom dia.
- Model responds
Bom dia! Como posso ajudar?.
- The model's own reasoning repeatedly recognizes that it must call
finish (We need call finish exactly once.), but emits only the same text response.
- AlphaCode starts another turn.
- The same thing happens again, repeatedly.
- The session never reaches terminal state.
The observed trace repeated the same response across 8+ turns.
Expected behavior
A model that fails to emit finish must not be able to keep the session alive indefinitely. The runtime should have a deterministic, model-independent termination invariant for this class of failure.
The fix should be implemented in the actual runner/control-flow, not as a prompt-only instruction or a provider-specific Nex workaround.
Requirements
- Reproduce the failure with an integration/regression test against the actual runner/turn loop using a simulated model that returns final text but never calls
finish.
- Ensure the runner reaches a bounded terminal state instead of repeatedly invoking the model forever.
- Preserve normal multi-turn agent behavior and legitimate tool-call continuation.
- Do not special-case Nex-N2.5 or hardcode provider/model names.
- Make the termination behavior explicit and observable in the runtime state/result.
Context
This is a runtime safety/liveness issue exposed by Nex-N2.5-Pro, not merely a model-quality issue. Nex-N2.5 documents function calling support, so AlphaCode should tolerate models that occasionally fail to materialize a required terminal tool call rather than turning that failure into an infinite loop.
Problem
Some models can produce a valid final textual response while repeatedly failing to emit AlphaCode's
finishtool call. The runtime currently allows this to become an unbounded continuation loop.Reproduction
With Nex-N2.5-Pro, a trivial session was observed behaving like this:
Bom dia.Bom dia! Como posso ajudar?.finish(We need call finish exactly once.), but emits only the same text response.The observed trace repeated the same response across 8+ turns.
Expected behavior
A model that fails to emit
finishmust not be able to keep the session alive indefinitely. The runtime should have a deterministic, model-independent termination invariant for this class of failure.The fix should be implemented in the actual runner/control-flow, not as a prompt-only instruction or a provider-specific Nex workaround.
Requirements
finish.Context
This is a runtime safety/liveness issue exposed by Nex-N2.5-Pro, not merely a model-quality issue. Nex-N2.5 documents function calling support, so AlphaCode should tolerate models that occasionally fail to materialize a required terminal tool call rather than turning that failure into an infinite loop.