Files
Jyotisha/docs/tasks/PROGRESS-answer-effort-ab-20261013.md
T
jesse-uxandGrok (agent loop) 9324253408 fix(consult): move the answer-effort probe out of the image build
The dry-run script lived under frontend/scripts and read a test fixture, so the web image build would type-check a file the image does not copy. Move it to frontend/tests with a non-test filename. The switch default is unchanged.

Checked: guard plus answer-effort tests 5 pass, 0 fail, 0 cancelled; probe --dry-run exit 0; tsc exit 0; lint 0 errors and 123 warnings.

Co-Authored-By: Grok (agent loop)
2026-10-15 10:56:22 +08:00

3.7 KiB
Raw Blame History

PROGRESS · 答题步推理强度开关(2026-10-15)

  • 分支:codex/answer-effort-ab-20261013
  • 实际基线:origin/staging 9274491681f6fcacbc87e3797441d2c5221de874
  • 前置 consult-prep-parallel 已在 origin/staging 上(git merge-base --is-ancestor 退出码 0)
  • 默认行为不变。没有模型钥匙,A/B 未跑。

做了什么

  1. 新环境变量 CONSULT_ANSWER_REASONING_EFFORT。low / medium / high / max 才生效。空着或没设,请求体与改前一致。非法值 console.warn 一次,然后当作没设。
  2. agentGenerationSettings 增加 providerReasoningEffort。它写在供应商选项的最外层,兼容通道据此发出 reasoning_effort。原来的 reasoningEffort 仍嵌在 thinking 里,切片那两条断言不用改。
  3. 答题步才带这个字段。判据与答案时钟相同:计算结果已经在手(answerReady),或者公开日历从第一步就是答题(answerFromStart)。主循环第 0 步计算结果还没到,不带。重试是新的一轮,步号从 0 重新计,但计算结果已经在手,所以重试的第 0 步也带。续写仍是关闭思考,不带这个字段。
  4. Mastra 的 prepareStep 会按步合并 providerOptions(mergeObjects)。答题步返回的强度会并进这一步,不会整轮都带。本单按步生效,没有改成整轮。
  5. 生平回测脚本增加 --cases figure:domain,… 和 --efforts unset,low,medium。每行记下端到端秒数、第 0 / 1 步秒数和推理 token、输出 token、结束原因、是否空答、是否截断、正文字数。摘要记下当次强度。

自测

检查 命令 结果
请求体拦截 node node_modules/tsx/dist/cli.mjs tests/answer-effort-probe.mts --dry-run 退出码 0。数字见 docs/testing/answer-effort-ab-20261013.md。2026-10-15 打回后脚本从 frontend/scripts/research/ 挪到 frontend/tests/,命令改成这一条。
本单测试与任务书点名的四份 node node_modules/tsx/dist/cli.mjs --test 后接 answer-effort-switch-20261013、consultation-agentic-runtime、consultation-workflow-contract、consult-answer-clock-20261001、consult-latency-timing-20261005 114 pass,0 fail,0 cancelled
类型检查 在 frontend 下 .\node_modules\.bin\tsc --noEmit -p . 退出码 0
lint 在 frontend 下 npm run lint 退出码 0,0 error,123 条原有 warning。探针里多出来的 1 条未使用变量已去掉,改过的文件再跑 eslint 是 0

开关不设时,两步请求体与改前保存的整份 JSON 逐字节一致。设 low 时只有答题步出现 reasoning_effort: "low",第 0 步没有;续写仍是 thinking: disabled 且没有 reasoning_effort。

改既有断言

原值 新值 原因
await streamWithOverflowRetry(agent) await streamWithOverflowRetry(agent, generalStreamOptions) 公开日历从第一步就是答题。不传选项就没有 prepareStep,强度加不上去。开关不设时这些选项不改请求体。答案时钟的断言还在。

切片的嵌套形状和它的两条断言没有改。

需拍板

  • 默认强度。本单不改。有钥匙的验收按任务书 T3 出数之后,再决定设不设、设哪一档。部署默认写在哪里也留到那次。
  • consultationSliceGenerationSettings 删掉还是改成最外层。它没有调用方。本单不改。见 BUG-1354(原先写成 BUG-1351,该号已被数据层占用)。
  • 若供应商不接受降档,对照组 D(答题步关思考)只供参考,采用与否另说。本机没跑。

环境缺口

A/B 未跑:缺模型 key。没有 DS_KEY,也没有 BACKTEST_MODEL_KEY。