Skip to content

fix(agent): stop bypassing ask tool in YOLO mode#3709

Closed
CVEngineer66 wants to merge 2 commits into
esengine:main-v2from
CVEngineer66:fix/ask-yolo
Closed

fix(agent): stop bypassing ask tool in YOLO mode#3709
CVEngineer66 wants to merge 2 commits into
esengine:main-v2from
CVEngineer66:fix/ask-yolo

Conversation

@CVEngineer66

Copy link
Copy Markdown
Contributor

Bug

In YOLO mode, when the agent calls the ask tool to get a user decision, no prompt UI appears and the agent receives a fake answer (the first option is automatically selected). This defeats the purpose of the ask tool, which exists specifically for cases where the model needs genuine user input.

Root Cause

Controller.Ask() (which implements agent.Asker) checked bypassEnabled() before emitting the AskRequest event:

func (c *Controller) Ask(ctx context.Context, questions []event.AskQuestion) ([]event.AskAnswer, error) {
    if c.bypassEnabled() {
        return recommendedAskAnswers(questions), nil  // ← silently picks first option
    }
    // ... normal flow: emit AskRequest, block for user ...
}

The same check appeared twice — once before promptMu.Lock() and once after — both returning recommendedAskAnswers() which always selects q.Options[0].Label.

Logic Error

YOLO mode (c.bypass = true) was designed to skip tool-approval gates (the requestApproval() method), allowing autonomous execution without manual approval of each tool call. The ask tool is semantically different:

Operation YOLO mode expected behavior Previous behavior
Tool call approval (requestApproval) ✅ Auto-allow (skip prompt) ✅ Correct
ask tool (user decision) ✅ Show prompt, wait for real input ❌ Silently returned first option

The ask tool exists precisely for cases where the model cannot decide on its own — treating it the same as a tool approval gate undermines its purpose.

Fix

Removed both bypassEnabled() checks from Controller.Ask(), so the ask tool always emits an AskRequest event and waits for the user to respond, regardless of mode.

Also removed the now-unused recommendedAskAnswers() helper function.

Testing

  • go build ./internal/... — clean
  • go test ./internal/agent/ -run TestAsk — all 4 ask tool tests pass
  • Manual verification: YOLO mode now shows the ask prompt UI and waits for user input

Fixes #3696

The ask tool is meant to get a user decision, but Controller.Ask()
checked bypassEnabled() and returned a fake answer (first option)
without prompting the user. YOLO mode should only skip tool-approval
gates, not the ask tool.

Removed the two bypassEnabled() checks from Ask() and the now-unused
recommendedAskAnswers() helper.

Fixes esengine#3696
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development agent Core agent loop (internal/agent, internal/control) labels Jun 9, 2026
@esengine

esengine commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Thanks @CVEngineer66 — your minimal controller.go fix is exactly right and is the basis of #3712. Closing in favor of that, which also updates the existing yolo_test.go cases that asserted the old auto-answer behavior (those were why CI went red here). Credited via Co-authored-by. Closes the same #3624.

@esengine esengine closed this Jun 9, 2026
@CVEngineer66 CVEngineer66 deleted the fix/ask-yolo branch June 9, 2026 13:20
esengine added a commit that referenced this pull request Jun 9, 2026
)

* fix(control): don't auto-answer the ask tool in YOLO mode

Controller.Ask checked bypassEnabled() and silently returned the first option
of every question, so in YOLO mode the `ask` tool got a fake answer and the
user never saw the prompt. Bypass is meant to skip tool-approval gates, not to
answer the user's genuine questions. Remove both bypass checks (and the now
unused recommendedAskAnswers helper); Ask always emits an AskRequest and waits
for AnswerQuestion, even under bypass.

Combines the minimal fix from #3709 (CVEngineer66) with the behavior tests
from #3638 (warvyvr), dropping that PR's unrelated files.

Closes #3624

Co-authored-by: CVEngineer66 <CVEngineer66@users.noreply.github.com>
Co-authored-by: warvyvr <warvyvr@users.noreply.github.com>

* fix(control): drop now-unused bypassEnabled helper

Removing the bypass checks from Ask left bypassEnabled with no callers
(staticcheck unused).

---------

Co-authored-by: reasonix <reasonix@deepseek.com>
Co-authored-by: CVEngineer66 <CVEngineer66@users.noreply.github.com>
Co-authored-by: warvyvr <warvyvr@users.noreply.github.com>
SuMuxi66 pushed a commit to SuMuxi66/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
) (esengine#3712)

* fix(control): don't auto-answer the ask tool in YOLO mode

Controller.Ask checked bypassEnabled() and silently returned the first option
of every question, so in YOLO mode the `ask` tool got a fake answer and the
user never saw the prompt. Bypass is meant to skip tool-approval gates, not to
answer the user's genuine questions. Remove both bypass checks (and the now
unused recommendedAskAnswers helper); Ask always emits an AskRequest and waits
for AnswerQuestion, even under bypass.

Combines the minimal fix from esengine#3709 (CVEngineer66) with the behavior tests
from esengine#3638 (warvyvr), dropping that PR's unrelated files.

Closes esengine#3624

Co-authored-by: CVEngineer66 <CVEngineer66@users.noreply.github.com>
Co-authored-by: warvyvr <warvyvr@users.noreply.github.com>

* fix(control): drop now-unused bypassEnabled helper

Removing the bypass checks from Ask left bypassEnabled with no callers
(staticcheck unused).

---------

Co-authored-by: reasonix <reasonix@deepseek.com>
Co-authored-by: CVEngineer66 <CVEngineer66@users.noreply.github.com>
Co-authored-by: warvyvr <warvyvr@users.noreply.github.com>
dorokuma pushed a commit to dorokuma/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
) (esengine#3712)

* fix(control): don't auto-answer the ask tool in YOLO mode

Controller.Ask checked bypassEnabled() and silently returned the first option
of every question, so in YOLO mode the `ask` tool got a fake answer and the
user never saw the prompt. Bypass is meant to skip tool-approval gates, not to
answer the user's genuine questions. Remove both bypass checks (and the now
unused recommendedAskAnswers helper); Ask always emits an AskRequest and waits
for AnswerQuestion, even under bypass.

Combines the minimal fix from esengine#3709 (CVEngineer66) with the behavior tests
from esengine#3638 (warvyvr), dropping that PR's unrelated files.

Closes esengine#3624

Co-authored-by: CVEngineer66 <CVEngineer66@users.noreply.github.com>
Co-authored-by: warvyvr <warvyvr@users.noreply.github.com>

* fix(control): drop now-unused bypassEnabled helper

Removing the bypass checks from Ask left bypassEnabled with no callers
(staticcheck unused).

---------

Co-authored-by: reasonix <reasonix@deepseek.com>
Co-authored-by: CVEngineer66 <CVEngineer66@users.noreply.github.com>
Co-authored-by: warvyvr <warvyvr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ask 工具在 yolo 模式下无弹窗 UI,自动返回假结果

2 participants