🤖 fix: remove redundant advisor pending-call handoff#3423
Merged
Conversation
Removes the serialized advisor(...) pending tool call from the advisor handoff while preserving the prose question and same-step context. --- _Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` • Cost: `4.70`_ <!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=4.70 -->
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
Removes the redundant serialized
advisor({"question": ...})pending tool-call block from advisor handoff messages, so debug-console advisor requests show the advisor question only once.Background
The debug LLM request modal renders backend-captured messages verbatim. Advisor handoff construction already includes the question as prose, so the extra pending-tool-call block duplicated the same content.
Implementation
buildAdvisorHandoffMessage.Validation
bun test src/node/services/tools/advisor.test.tsmake typecheckmake static-checkRisks
Low. The change is scoped to advisor handoff message formatting and leaves generic debug rendering and advisor snapshot capture untouched.
📋 Implementation Plan
Plan: Remove redundant advisor pending-call text from debug-console payload
Goal
Stop the advisor-model invocation/debug LLM request from repeating the same advisor question as a serialized pending tool call:
The question should remain available once as prose in the advisor handoff, along with any useful same-step context.
Verified repo context
src/node/services/tools/advisor.tsbuilds the synthetic advisor handoff message:buildAdvisorHandoffMessage(question, snapshot)appends**Question:** ....**Pending tool call:**\nadvisor(${JSON.stringify(snapshot.input)})whenever an advisor snapshot exists.formatPendingToolCall(input)exists only for that serialized pending-call block.src/browser/components/DebugLlmRequestModal/DebugLlmRequestModal.tsxrenders capturedsnapshot.messageswithJSON.stringify(..., null, 2); it is showing the backend-generated message verbatim rather than adding tool-call formatting itself.src/node/services/aiService.tsfreezes anAdvisorToolCallSnapshotfortoolName === "advisor"during streaming and passes it into the advisor tool runtime viatakeToolCallSnapshot(toolCallId).src/common/utils/tools/toolDefinitions.tsdefines the advisor input schema as onlyquestion?: string | null, so the serializedadvisor({"question":"..."})block normally carries no additional user-visible information beyond the prose question.Recommended approach
Remove the advisor-only pending tool-call block from the advisor handoff.
Net product LoC estimate: -6 to -8 LoC.
src/node/services/tools/advisor.ts:formatPendingToolCall(input)if it becomes unused.if (snapshot != null) { ... sections.push("**Pending tool call:**...") }branch insidebuildAdvisorHandoffMessage.**Question:**,**Current-step commentary:**, and**Current-step reasoning:**sections unchanged.question, same-step commentary, and same-step reasoning are all absent.Rejected narrower alternative
A conditional helper could suppress the block only when
snapshot.input.questionequals the normalized prosequestionand retain it for malformed or future extra fields. That is about +8 to +12 product LoC and is more complex than needed because the current advisor schema only supportsquestion. If advisor inputs later gain more fields, revisit the handoff format then.Implementation steps and quality gates
Update advisor handoff construction
src/node/services/tools/advisor.ts.formatPendingToolCallremain.Update unit coverage
src/node/services/tools/advisor.test.ts, update the existing test around the full advisor handoff with question + same-step snapshot context.**Question:** ...section,**Pending tool call:**,advisor({"question":...}).not.toContainassertions over creating a tautological prose-only test.Run validation
bun test src/node/services/tools/advisor.test.tsmake typecheckmake testormake static-checkbefore declaring the work done.Dogfooding plan
Skill context read for this plan:
dogfood,agent-browser, anddev-server-sandbox.Prepare the dogfood session and evidence directory
agent-browserbinary, nevernpx agent-browser.agent-browser skills get coreagent-browser skills get electron../dogfood-output/advisor-pending-call/withscreenshots/andvideos/subdirectories, and keep all artifacts instead of deleting/restarting mid-session.Start an isolated Mux dev environment
make dev-server-sandbox.make dev-server-sandbox DEV_SERVER_SANDBOX_ARGS="--clean-providers --clean-projects".BACKEND_PORT,VITE_PORT) and remember the sandbox copies provider/project config when available but intentionally does not copysecrets.json.agent-browser --session advisor-pending-call open <target-url>when a browser target is sufficient; if a desktop shell is required, use the agent-browser Electron workflow after the sandbox server is running.Orient and capture baseline evidence
agent-browser --session advisor-pending-call screenshot --annotate ./dogfood-output/advisor-pending-call/screenshots/initial.pngagent-browser --session advisor-pending-call snapshot -iExercise the behavior with recorded repro evidence
agent-browser --session advisor-pending-call record start ./dogfood-output/advisor-pending-call/videos/advisor-debug-request.webmmessagespayload.messagespayload.Verify and capture the final state
**Question:** ...section and no**Pending tool call:**block in the advisor model request payload.agent-browser --session advisor-pending-call record stop.Acceptance criteria
**Pending tool call:**\nadvisor({"question":"..."})section for normal advisor invocations.Generated with
mux• Model:openai:gpt-5.5• Thinking:xhigh• Cost:4.70