From: Anderson A. Giacomolli Date: Fri, 6 Nov 2026 23:19:46 +0000 (-0300) Subject: Run the turns of an agent in a loop X-Git-Url: https://git.giacomolli.uk/onechat/commitdiff_plain/5da3ea038d1e9f9a2634d5ab137aef6989a3a789?hp=5da3ea038d1e9f9a2634d5ab137aef6989a3a789 Run the turns of an agent in a loop A user message goes to the log when it comes and wakes the loop. A turn waits until every build is done, so the view holds the summaries of the messages before it. Its first request holds the prompt, the six tools, and one user message with the view, the date and time of the turn, and each new message whole. The view leaves out the leaf lines of the new messages, but it keeps every other line, also the replies that came after a message that waited. The loop runs the tool calls of each response and sends their results back until a response has no tool call. Each later request begins with the whole previous input, then the output items with the encrypted reasoning and without their ids, because the calls do not store them, then the tool results. So each request of a turn begins with all of the one before it. User messages that come during a turn join the next request after the tool results, and a message that comes during the final request starts a new turn. Replies, tool calls, and results go to the log as they happen, and the reasoning never does. An interrupt cancels the turn and kills a running tool. A failed call ends the turn without a retry, and its messages stay in the log, so a lasting failure does not repeat. Only a failed log write stops the loop. The prompt gets a paragraph on persistent mode: a reply with no tool call ends the turn, a question in the middle of a task does not end the task, and "continue" resumes the latest unfinished task. Issue: 5daf23e ---