Skip to content

Allow tool use right after a rejection. - #1806

Closed
AYM1607 wants to merge 2 commits into
anomalyco:devfrom
AYM1607:tool-rejection-prompt
Closed

AYM1607 wants to merge 2 commits into
anomalyco:devfrom
AYM1607:tool-rejection-prompt

Conversation

@AYM1607

@AYM1607 AYM1607 commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

Add disclaimer about tool use after rejection to the system prompt, makes it so the model knows it's okay to use a tool even right after it was rejected.

@spoons-and-mirrors

Copy link
Copy Markdown
Contributor

Good idea, but the wording feels too loose and ambiguous IMO.
I believe this version is clearer and less prone to tool miss-use, spam etc...:

Permission system

  • Users can configure the tools permission status, in which case opencode handles requesting user approval. This applies to the: edit bash and webfetch tools; otherwise, tool uses are allowed by default.
  • A permission denial applies only to that single attempt; never treat it as a permanent ban of the tool.
  • When a tool use is denied, acknowledge the user intent behind the denial and keep working towards the completion of the task at hand.
  • Never loop identical tool requests.

This probably can be significantly improved, but prompt engineering is a slow process, let's keep at it.

@thdxr

thdxr commented Aug 11, 2025

Copy link
Copy Markdown
Member

this probably should be implemented by improving the error message from a permission rejection - otherwise we need to do this for every system prompt

@AYM1607

AYM1607 commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

Yup, @spoons-and-mirrors, prompting is subtle. Open to any kind of wording as long as the message is conveyed.

@AYM1607

AYM1607 commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

I'm happy to go in either direction @thdxr, though it seems like there's some parts of the system prompts that should be shared by all the models, and this feels like one of them. Unless you've found that models react wildly differently to wording, in which case, it does make sense to keep them separate.

This is actually related to another PR I wanted to send. In Claude Code, when you reject a tool use, the original diff (edit tool) or file content (write tool) is kept in the context, which makes it easy to reference a specific part you want to tweak. In combination with this prompt change, the UX is greatly improved IMO. If the error message (alongside the diff/content) signals that it's just the content that was rejected, then it'd work as well.

@thdxr

thdxr commented Aug 12, 2025

Copy link
Copy Markdown
Member

maybe we can add what you have to the environment section of the system prompt, can see that in system.ts

i also updated the error message today lmk if that works better

@AYM1607
AYM1607 force-pushed the tool-rejection-prompt branch from a30212b to bffa914 Compare August 13, 2025 04:17
@AYM1607

AYM1607 commented Aug 13, 2025

Copy link
Copy Markdown
Contributor Author

Moved it to the environment in system.ts @thdxr I still think that this should be part of the system prompt to protect against changes in the error message.

@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants