fix(classic): register finish result before task continuation

AgentFinished is caught before execute() registers a result, leaving
the finish episode with result=None. The interaction loop sees this as
"episode in progress" and reuses the old finish proposal instead of
calling the LLM for the new task. Register a success result before
continuing so the loop calls propose_action() for the new task.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nicholas Tindle
2026-04-04 17:45:30 +02:00
parent 17e1578c46
commit 6aed43d708

View File

@@ -754,6 +754,16 @@ async def run_interaction_loop(
logger.info("User chose to exit after task completion.")
return
# Close the finish episode so the loop doesn't reuse it.
# AgentFinished is caught before execute() can register
# a result, leaving result=None — which the loop
# interprets as "episode in progress, reuse proposal".
from forge.models.action import ActionSuccessResult
agent.event_history.register_result(
ActionSuccessResult(outputs=e.message)
)
# Start new task in same workspace, keeping prior context
agent.state.task = next_task