Draft
Add agentReplanOnError flag to restart planning loop on tool errors#1
Conversation
Agent-Logs-Url: https://github.com/esolithe/opticlaw/sessions/d1a79539-25fb-4868-90e3-ab842139a548 Co-authored-by: esolithe <65901558+esolithe@users.noreply.github.com>
…tency Agent-Logs-Url: https://github.com/esolithe/opticlaw/sessions/d1a79539-25fb-4868-90e3-ab842139a548 Co-authored-by: esolithe <65901558+esolithe@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add agentReplanOnError flag to newMenuOptions.js
Add agentReplanOnError flag to restart planning loop on tool errors
Apr 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a configurable
agent_replan_on_errorflag that changes the agent's recovery behavior when a tool call fails — instead of continuing with the default "explain or call another tool" prompt, it injects a replan-specific system message instructing the AI to try a different strategy.Changes
core/config.py— Addedagent_replan_on_error: falsetomodeldefaults; picked up automatically by the config sync logic on existing installscore/toolcalls.py— Trackshad_tool_erroracross the tool execution loop; conditionally switches the follow-up system prompt when the flag is enabled:channels/webui/static/js/new_menu_options.js(new) — DefinesAGENT_MENU_OPTIONSregistry and extendsFIELD_DESCRIPTIONSso the flag renders with a description in the settings UIchannels/webui.py— Registersnew_menu_optionsinJS_FILESaftermodal_settingsOriginal prompt
Start implementation
[Chronological Review: The conversation began with the user requesting an examination of files in the specified directory to identify error cases handled by the "addThought" function. The user then requested the addition of a new flag in the `newMenuOptions.js` file to restart the thinking loop upon encountering errors. The user later pointed out that certain files were missing from the examination, specifically mentioning the utilities, world state, and search web files.][Intent Mapping:
[Technical Inventory:
agent_filesystem.js,agent_groups_loader.js,agent_macros.js,agent_media.js,agent_messaging.js,agent_openlumara.js,agent_openlumarapolling.js,agent_planning_input.js,agent_search_web.js,agent_utilities.js,agent_world_state.js.agent_search_web.jsand has requested modifications tonewMenuOptions.js.][Code Archaeology:
newMenuOptions.jsto control behavior based on error handling.][Progress Assessment:
newMenuOptions.jsis pending implementation.][Context Validation: The user’s requests for examining files and adding a new flag are clearly articulated, and the context for continuing work is established.]
[Recent Commands Analysis:
1. Conversation Overview: - Primary Objectives: - "Examine the files in #file:agent" to identify error cases in "addThought". - "I would like a new flag added to #file:newMenuOptions.js called agentReplanOnError" to enhance error handling. - Session Context: The user is focused on improving the error handling mechanism in their codebase, specifically within the agent files. - User Intent Evolution: The user initially sought a review of files but later clarified that certain files were missing from the examination.- Technical Foundation:
- JavaScript: Used for the implementation of the agent files and the requested modifications.
- Error Handling Logic: The user is looking to integrate a new flag for better error management.
- Codebase Status:
- File Name:
- Purpose: Part of the agent's functionality related to web searching.
- Current State: Under examination for error handling.
- File Name:
- Purpose: To manage menu options, including the new error handling flag.
- Current State: Pending modification to include
- Problem Resolution:
- Issues Encountered: The user noted missing files in the previous examination.
- Solutions Implemented: None yet; the user is still in the process of gathering information.
- Debugging Context: The user is focused on identifying error cases in the "addThought" function.
- Progress Tracking:
- Completed Tasks: None completed yet; the user is still in the information-gathering phase.
- Partially Complete Work: Examination of files is ongoing, with specific requests for modifications pending.
- Validated Outcomes: No features confirmed working yet.
- Active Work State:
- Current Focus: The user is examining
- Recent Context: The user has requested a review of files and pointed out missing files.
- Working Code: The user is focused on the "addThought" function and its error handling.
- Immediate Context: The user is looking to enhance error handling in the agent's logic.
- Recent Operations:
- Last Agent Commands: User requested examination of files and pointed out missing files.
- Tool Results Summary: No specific tool results were generated; the focus was on user requests.
- Pre-Summary State: The agent...
agent_search_web.jsnewMenuOptions.jsagentReplanOnError.agent_search_web.jsand preparing to modifynewMenuOptions.js.Created from VS Code.