Skip to content

fix(tools): keep the tool order when navigation restores the same tools - #1405

Open
zhangt2333 wants to merge 1 commit into
agegr:mainfrom
zhangt2333:main
Open

zhangt2333 wants to merge 1 commit into
agegr:mainfrom
zhangt2333:main

Conversation

@zhangt2333

Copy link
Copy Markdown

Thanks for pi-web — I've used it for a long time and really like it; this is the first real problem I've run into.

Problem

Editing a history message reorders the same tools: navigateTreeKeepingToolSelection() re-applies the selection after the navigation restored the branch's loadout, and resolveActiveToolNames() moves every coding tool in front of the carried ones.

before  read,bash,edit,write,todo,ask_user_question,Agent,web_search,…,web_enable,grep,find
after   read,bash,edit,write,todo,ask_user_question,Agent,grep,find,web_search,…,web_enable

Nothing was enabled or disabled: only the order changed, which rewrites the system prompt and drops the cached prefix, so the next request re-bills the whole conversation.

Reproduction

  1. New session in Pi Web: send 1, then 2.
  2. Edit 2, resend as 2.2.
  3. The system prompt is rewritten: the session file gains a new system entry whose <tools> section carries the order above.

The re-apply reordered the tools even when pi restored the same loadout,
which changed the prompt and re-billed the cached conversation.

This branch has not been deployed

No deployments
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.

1 participant