Summary
The autonomous tool execution loop intermittently stops after a tool completes successfully. The UI remains parked on the final tool result (for example, “Script executed successfully”) instead of scheduling the next assistant turn.
This appears more frequently during workflows using manage_task, likely because tracked tasks require additional tool boundaries for progress updates, action execution, verification, task completion, and end_loop.
Observed behavior
During a multi-step journal cleanup task:
- A tracked task was active through
manage_task.
- Several document edits and deletions completed successfully.
- A final
run_javascript verification returned valid data:
- the retained journal existed;
- it still had 8 pages;
- the obsolete UUID reference was absent;
- the replacement note was present.
- The tool displayed “Script executed successfully.”
- No subsequent assistant turn was scheduled.
- The task tracker remained unfinished even though the underlying work had completed.
- The user had to send another message to recover control.
A related symptom occurred earlier in the same conversation: after an interrupted tracked task, a later manage_task update returned “No active task to update.” This suggests the active task lifecycle may become orphaned or be lost when the autonomous loop stops unexpectedly.
Expected behavior
After any successful non-terminal tool result, the tool-loop handler should reliably schedule the next assistant/model turn so it can:
- process the result;
- continue to the next planned action;
- update or finish
manage_task;
- call
end_loop; and
- return control to the user cleanly.
A successful tool response should never become an implicit terminal state unless the assistant explicitly calls end_loop.
Actual behavior
The loop sometimes terminates or stalls immediately after a successful tool response. The raw tool result becomes the final visible state, with no summary, no task completion, and no end_loop call.
Reproduction steps
The issue is intermittent, but this pattern appears to trigger it more often:
- Start an autonomous multi-step workflow with
manage_task(action="start_task").
- Perform several document operations.
- Verify each operation with additional read/search/JavaScript calls.
- Near the end of the workflow, execute a final
run_javascript, read_document, or similar verification tool.
- Observe that the tool returns successfully.
- In affected runs, the system does not initiate the next assistant turn, leaving the tracked task incomplete.
Frequency
Intermittent, but reported as happening often, especially during tracked tasks.
Impact
- Users perceive the assistant as hung even though the tool action succeeded.
- Destructive or mutating workflows may complete without a final human-readable report.
- Visual task trackers remain incomplete or become orphaned.
- Users must manually prompt the assistant to continue.
- A resumed task may report “No active task to update.”
- Repeated recovery attempts can cause confusion about whether operations completed.
Suspected area
Likely in the post-tool-result continuation path in scripts/core/tool-loop-handler.js, particularly around:
- result processing after a successful tool call;
- scheduling the next model turn;
- determining whether a tool result is terminal;
- preserving active
manage_task state across loop iterations; and
- cleanup/error paths that may return without either continuing or explicitly ending the loop.
Related but not duplicate: #147 tracks refactoring tool-loop-handler.js; it does not describe this post-tool continuation failure.
Suggested diagnostics / safeguards
- Add structured logging around every tool-loop state transition:
- tool call received;
- tool execution started/completed;
- result appended to conversation;
- next model turn scheduled;
- loop explicitly ended.
- Assert that every successful non-
end_loop tool result has exactly one continuation scheduled.
- Add a watchdog that detects an active autonomous loop with no scheduled continuation after result processing.
- Persist or recover active
manage_task state when a loop is interrupted unexpectedly.
- Add an integration test with a tracked task containing multiple action/verification cycles followed by a final verification call.
Acceptance criteria
- A successful non-terminal tool call always results in another assistant turn.
manage_task workflows reliably reach finish_task and end_loop unless the user interrupts or a terminal error occurs.
- Interrupted loops do not silently discard or orphan active task state.
- Automated coverage reproduces and guards against the final-tool-result stall.
Summary
The autonomous tool execution loop intermittently stops after a tool completes successfully. The UI remains parked on the final tool result (for example, “Script executed successfully”) instead of scheduling the next assistant turn.
This appears more frequently during workflows using
manage_task, likely because tracked tasks require additional tool boundaries for progress updates, action execution, verification, task completion, andend_loop.Observed behavior
During a multi-step journal cleanup task:
manage_task.run_javascriptverification returned valid data:A related symptom occurred earlier in the same conversation: after an interrupted tracked task, a later
manage_taskupdate returned “No active task to update.” This suggests the active task lifecycle may become orphaned or be lost when the autonomous loop stops unexpectedly.Expected behavior
After any successful non-terminal tool result, the tool-loop handler should reliably schedule the next assistant/model turn so it can:
manage_task;end_loop; andA successful tool response should never become an implicit terminal state unless the assistant explicitly calls
end_loop.Actual behavior
The loop sometimes terminates or stalls immediately after a successful tool response. The raw tool result becomes the final visible state, with no summary, no task completion, and no
end_loopcall.Reproduction steps
The issue is intermittent, but this pattern appears to trigger it more often:
manage_task(action="start_task").run_javascript,read_document, or similar verification tool.Frequency
Intermittent, but reported as happening often, especially during tracked tasks.
Impact
Suspected area
Likely in the post-tool-result continuation path in
scripts/core/tool-loop-handler.js, particularly around:manage_taskstate across loop iterations; andRelated but not duplicate: #147 tracks refactoring
tool-loop-handler.js; it does not describe this post-tool continuation failure.Suggested diagnostics / safeguards
end_looptool result has exactly one continuation scheduled.manage_taskstate when a loop is interrupted unexpectedly.Acceptance criteria
manage_taskworkflows reliably reachfinish_taskandend_loopunless the user interrupts or a terminal error occurs.