feat: Paseo reasoning — separate thinking block + mode-only control #14
No reviewers
Labels
No labels
code-review
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
sam/brainless!14
Loading…
Reference in a new issue
No description provided.
Delete branch "rebel-duck"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two related changes to how reasoning is relayed and controlled in Paseo, in the
sam/brainlessACP agent.1. Stream reasoning as a separate thinking block (fix)
When a reasoning model (e.g. melious
deepseek-v4-flash-0731at a non-zero effort) replies, the thinking was shown inline with the answer instead of as a distinct Thinking block.Root cause:
eventTextconcatenated all text parts of the final ADK response event, including parts flaggedThought: true, into the answer, which it streamed as a singleagent_message_chunk.Fix:
eventTextexcludesThoughtparts; neweventThoughtcollects them; the ACP path relays reasoning as a separateagent_thought_chunkupdate (acp.UpdateAgentThoughtText) and the answer as the regularagent_message_chunk. The single-shot stdout path prints reasoning to stderr.replayHistoryseparates stored reasoning the same way. Test:TestACPPromptSeparatesReasoningFromAnswer.2. Control reasoning through session modes only (feature)
Reasoning was exposed two redundant ways: a raw
thinkingconfig option (shown as "Thinking Mode") and ACP session modes ("Change Mode", fast/normal/deep). It is now mode-only:thinkingconfig option is dropped; the model selector is the only config option, so Paseo shows Change Mode but no raw effort selector.normalis renamed to default. It previously resolved to the model's lowest (first-declared) effort, which for an[off, low, high]model silently disabled reasoning.defaultnow turns reasoning on with no effort override — the ADK's dynamic-thinking-budget sentinel sendsreasoningwith noeffort, so the provider applies the model's natural default. This is the same as passingreasoning: truewithout areasoningEffortto the OpenAI API; no config knob is involved.off/none, so a non-reasoning model (or one that only supportsoff) shows no selector.Behavior change
For your config (
deepseek-v4-flash-0731,deepseek-v4.1-flash,glm-5.3-flash, all[off, low, high]):Verification
go build,go test ./...,golangci-lint run ./...clean.racedetector testclean.offmodels, mode-preset recompute across model switch.fix: stream reasoning as a separate thinking blockto feat: Paseo reasoning — separate thinking block + mode-only control2fb4b306f5to9cf874fafcReview of PR #14 — Paseo reasoning separation + mode-only control
Reviewed with the samber/cc-skills-golang skills (code-style, naming, documentation, error-handling, safety, concurrency, security, dependency-management, testing, performance, observability, modernize) against a fresh checkout of
rebel-duck(9cf874f). Verified in this session:go build ./...,go vet ./...,go test ./...,racedetector test ./internal/harness/,golangci-lint run ./internal/harness/...all clean;go docconfirmsgenai.Part.Thought,session.Event.IsFinalResponse,acp.UpdateAgentThoughtText, and the openaimodel bridge (dynamicThinkingBudget = -1, reasoning items surfaced asThought:trueparts) all exist exactly as the code assumes. The reasoning-separation fix is sound and the dynamic-budget semantics of Default mode are correct.No 🔴 BLOCKING issues. Two 🟠 IMPORTANT correctness gaps in the mode/effort wiring (each requires a non-standard model config to manifest), and one 🟡 SUGGESTION. Both IMPORTANT items were reproduced empirically with scratch tests in the package (evidence quoted inline).
🟠 IMPORTANT —
SetSessionModedoes not guard named-effort presets against the active model's declared efforts, unlikeSetSessionConfigOptionbelow it.Setting Fast on a model whose
ReasoningEffortdoes not includeoff(e.g.[low, high]) storesthinking="off", andthinkingConfigmaps it toThinkingBudget 0, which the openaimodel bridge turns intoreasoning.effort="none"— a level the model never declared. The mode selector is advertised for a[low, high]model (low/highare notoff/none, soHasReasoningSelectorreturns true), so a client can pick Fast and the harness will send an effort the model does not support (provider 400 or silent behavior change).Reproduced: scratch test on a
[low, high]model →Fast on [low,high] model: thinking="off" wire ThinkingConfig=&{...ThinkingBudget:0x...}(budget 0 → effortnone).Note the asymmetry:
SetSessionConfigOptionguards this exact case (if mode != modeDefault && !slices.Contains(...) { thinking = ""; mode = modeDefault }) and falls back to default.SetSessionModehas no such guard.Fix: in
SetSessionMode, after computingmodeThinking, if the mode is a named-effort preset (fast→off, deep→max) that the active model does not declare, fall back to default mode — mirror theslices.Containsguard fromSetSessionConfigOption.@ -263,0 +279,4 @@// reasoning with no effort, so the provider applies the model's natural// default effort. This is what the "default" mode means — reasoning on, no// override.const dynamicThinkingBudget = -1🟡 SUGGESTION —
dynamicThinkingBudget = -1is a magic constant duplicated from the ADK openaimodel bridge's private sentinel (same literal-1ingoogle.golang.org/adk/v2@v2.4.0/model/openaimodel/request.go). If the bridge ever changes that sentinel, Default-mode reasoning silently changes meaning. The doc comment already points at the bridge, which mitigates it; a cheap hardening is a test asserting thatthinkingConfig(efforts, "")returnsThinkingBudget == -1(pinning the coupling). Minor, optional.@ -295,2 +313,3 @@default:return nil // unknown level: defer to the model// No specific level: reasoning on, effort left to the model's default.budget := int32(dynamicThinkingBudget)🟠 IMPORTANT — Default mode turns reasoning on for an off/none-only model, contradicting both the pre-PR behavior and the harness's own
HasReasoningSelector.For a model declaring only
[off](or[none]),len(efforts) > 0so thisdefault:branch is reached and returnsThinkingBudget = -1(dynamic budget). The bridge sends noreasoning.effort, so the model reasons at its natural default. ButHasReasoningSelectortreats such a model as non-reasoning (selector hidden, "cannot honor any preset"), and the pre-PR code resolved an unset level toefforts[0]=off→ effortnone. So a configured off-only model now silently reasons, with no selector for the user to correct it.Reproduced: scratch test on a
[off]-only model →default mode on off-only model: thinking="" -> reasoning block budget=-1(dynamic → reasoning on), whilemodeStatehides the selector.The root inconsistency is that
Reasoning()(len>0) andHasReasoningSelector()(has an effort other than off/none) disagree for off/none-only models, and the wire path trustsReasoning().Fix: map the unset/default level to effort
none(budget 0) when the model has no meaningful effort — i.e. guard the dynamic budget onHasReasoningSelectorrather than justlen(efforts) == 0.Resolved in commit
0870d6b(force-pushed torebel-duck).🟠 Comment 567 (SetSessionMode undeclared preset): Fixed.
SetSessionModenow mirrors theslices.Containsguard fromSetSessionConfigOption: a named-effort preset (fast→off, deep→max) that the active model does not declare falls back todefaultmode instead of putting an undeclared effort on the wire. Test:TestSetSessionModeFallsBackForUndeclaredPreset. The e2e mode test's model now declaresoff([off, low, high]) so Fast→none is still exercised.🟠 Comment 568 (default mode turns reasoning on for off/none-only models): Fixed. Added
meaningfulReasoning(efforts)(shared withHasReasoningSelector);thinkingConfignow returnsnil(no reasoning) for the unset/default level on a model whose only declared efforts are off/none, so such a model never silently reasons — consistent with the hidden mode selector. Test:TestOffOnlyModelDefaultLeavesReasoningOff.🟡 Comment 569 (pin the dynamic-budget sentinel): Already covered —
TestSelectorModelDefaultThinkingWhenUnsetasserts*ThinkingBudget == dynamicThinkingBudget(-1), pinning the coupling to the ADK bridge's sentinel.Verification:
go build,go test ./...(x3),golangci-lint run ./...,racedetector testall clean.