From 6210b3259d9a4fe5d4778e803008f705b01463ba Mon Sep 17 00:00:00 2001 From: Nicholas Tindle Date: Tue, 3 Feb 2026 23:00:08 -0600 Subject: [PATCH] fix(classic): ensure user feedback on denied commands reaches the agent do_not_execute() was not calling append_user_feedback(), so feedback from denied commands only appeared as a tool result message which the model often ignored. Now feedback is also surfaced as a prominent [USER FEEDBACK] user message in the next prompt. Co-Authored-By: Claude Opus 4.5 --- .../components/action_history/action_history.py | 13 ++++++++----- classic/original_autogpt/autogpt/agents/agent.py | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/classic/forge/forge/components/action_history/action_history.py b/classic/forge/forge/components/action_history/action_history.py index c9a8c8df6d..a096c08dee 100644 --- a/classic/forge/forge/components/action_history/action_history.py +++ b/classic/forge/forge/components/action_history/action_history.py @@ -102,13 +102,16 @@ class ActionHistoryComponent( yield from messages - # Include any pending user feedback (from approval + feedback scenarios) - # This feedback was provided when the user approved the command, so the - # command was executed successfully. Make this explicit to the agent. + # Include any pending user feedback as a prominent user message. + # This ensures the agent pays attention to what the user said, + # whether they approved a command with feedback or denied it. pending_feedback = self.event_history.pop_pending_feedback() - for feedback in pending_feedback: + if pending_feedback: + feedback_text = "\n".join(f"- {feedback}" for feedback in pending_feedback) yield ChatMessage.user( - f"Command executed successfully. User feedback: {feedback}" + f"[USER FEEDBACK] The user provided the following feedback. " + f"Read it carefully and adjust your approach accordingly:\n" + f"{feedback_text}" ) def after_parse(self, result: AnyProposal) -> None: diff --git a/classic/original_autogpt/autogpt/agents/agent.py b/classic/original_autogpt/autogpt/agents/agent.py index 03f944501b..42632a7912 100644 --- a/classic/original_autogpt/autogpt/agents/agent.py +++ b/classic/original_autogpt/autogpt/agents/agent.py @@ -464,6 +464,11 @@ class Agent(BaseAgent[AnyActionProposal], Configurable[AgentSettings]): await self.run_pipeline(AfterExecute.after_execute, result) + # Store feedback so it also appears as a prominent user message + # in the next prompt (in addition to the tool result) + if user_feedback: + self.event_history.append_user_feedback(user_feedback) + logger.debug("\n".join(self.trace)) return result