Skip to content

fix(runtime): 扩展思考强度调整同步到实际请求 - #2223

Merged
vastsa merged 7 commits into
vastsa:mainfrom
yg2224:fix/extension-thinking-state
Nov 9, 2026
Merged

vastsa merged 7 commits into
vastsa:mainfrom
yg2224:fix/extension-thinking-state

Conversation

@yg2224

@yg2224 yg2224 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

受信扩展调用 setThinkingLevel 后,运行时 getter 显示新档位,但 Pi Agent 的实际请求状态仍是旧档位。

同步更新 Agent thinking state,保留模型能力 clamp。后续实际 provider stream 选项和 getter 一致。

验证:旧代码回归实际 Agent 状态仍 medium,修复后通过生产扩展 bridge 调整 high、真实 Agent loop 发送提示,provider 流捕获的 reasoning 为 high。runtime.test.ts 的 420 项通过,agent-runtime TypeScript 检查通过。模型流为外部边界 fixture,不访问真实付费 provider;完整 native/UI E2E 未运行。基线 ab56bfe,候选 1a59b6a。

Refs #1974。这是扩展思考强度路径的确定缺陷,未声称解决原 issue 的所有 DeepSeek/中转序列化问题。

同步候选验证(2026-11-09):普通 merge 主线 215b7a9,候选 4c33bd5;文档双方段落均保留。runtime.test.ts 420/420、Stop/terminal 13/13、agent-runtime TypeScript 和样式检查通过。另运行整个 agent-runtime 测试集:1878 通过、1 跳过,已有 bundle-assets 测试在并行负载下触发默认 5 秒超时;原样单独重跑该测试 1/1 通过(1.66 秒),未修改时限或断言。GitHub merge ref ae1bb07 的源码树与已测试候选相同。完整 native/UI E2E 未运行,provider 使用合成流。2026-11-09 22:40 复查:以上最新候选的六项 CI 全部 SUCCESS,无 pending、无失败;包含 JS build/typecheck/lint/architecture/test、Docs、最新基线、Rust、Windows transcript cache E2E 和 Trusted extensions Electron E2E。最新 AIUO diff-only 初审没有确定发现,但不是人工批准。

扩展桥接只修改运行时公开值,Pi Agent 仍携带旧档位。同步更新请求状态,保留模型能力校验,避免 getter 和实际 reasoning 参数不一致。

Refs vastsa#1974
历史动作的慢读取可能在新流式消息之后返回,原逻辑无条件替换缓存。仅缓存读取期间未改变的快照,调用方仍得到完整历史用于独立校验。

Refs vastsa#2086
Copilot AI balanced review requested due to automatic review settings November 9, 2026 13:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@aiuo-codepilot aiuo-codepilot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIUO CodePilot · Preliminary review

Diff-only preliminary review: trusted-extension `setThinkingLevel` now writes the clamped value into `runtime.agent.state.thinkingLevel` so subsequent provider requests match the getter, with a runtime test that substitutes `models.streamSimple` and captures `options.reasoning`. No evidenced defect found in the added lines. Verification limits: I could not run tests, TypeScript checks, the agent loop, or inspect surrounding implementation (e.g., how `agentThinkingLevel`/`agent.state.thinkingLevel` are consumed or whether `runtime.agent` is always initialized at that call site), so correctness of the sync path beyond the quoted lines is unverified.

No evidenced findings in the supplied diff.

Head: 1a59b6a
Base: ab56bfe
CI: pending; mergeable: true.

Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.

主线已合入停止失败时保留运行状态的修复。保留独立问题的行为说明和新增停止场景,使共享分支继续包含当前主线且不改写历史。
主线已合入停止失败时保留运行状态的修复。保留独立问题的行为说明和新增停止场景,使共享分支继续包含当前主线且不改写历史。

@aiuo-codepilot aiuo-codepilot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIUO CodePilot · Preliminary review

diff-only 初步审查:修复将扩展 setThinkingLevel 的 clamp 结果同步到 runtime.agent.state.thinkingLevel,并补充文档与回归测试。可见改动范围很小,未发现有证据支撑的缺陷;但由于无法执行测试、检查 CI 或查看 diff 上下文之外的实现(如 agentThinkingLevel 映射、prompt 前的状态读取路径),验证能力有限。

No evidenced findings in the supplied diff.

Head: 4c33bd5
Base: 215b7a9
CI: success; mergeable: true.

Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.

@vastsa

vastsa commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Independent validation on current main 7f2ec5d: removing the new Agent state assignment reproduces the defect through the production extension bridge, runtime.prompt and actual Agent loop: getter reports high while provider reasoning remains medium. Restoring it passes runtime.test.ts 419/419 and agent-runtime tsc --noEmit; diff-check is clean. No paid provider or native/UI E2E claim. The previous progress count of 420 came from the author's report; this run executed 419.

The setter now follows the existing configuration synchronization pattern and preserves capability clamping. This proves the extension-path defect only; #1974's broader UI/provider behavior is not fully resolved here.

Integrated latest main with a normal merge preserving contributor history. Both English and Chinese E2E document conflicts retain both scenarios, with paragraph spacing restored. Pushed candidate 31d4cb3. Awaiting fresh CI and actual merge-ref verification before approval or merge.

@aiuo-codepilot aiuo-codepilot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIUO CodePilot · Preliminary review

Diff-only 初步审查:PR 标题与主体声称修复 `setThinkingLevel` 同步到 Pi Agent 实际请求状态,但 diff 还包含全量会话读取缓存竞态的运行时修复及其测试/文档;二者是不同缺陷。代码侧:runtime.ts 一行同步 `agent.state.thinkingLevel`,测试验证 high 档位经 provider 流 options.reasoning 传出;session-runtime.ts 用缓存引用比较防止晚到的全量读取覆盖更新快照。未发现可由新增行精确引文证实的确定缺陷。未能验证:无法运行测试、类型检查、CI 或与基线对比;测试通过、CI SUCCESS 等均为作者声明。测试中 `runtime as any`、`internal.models` 重赋值和 `createExtensionBridge()` 是白盒改动,若实现细节变化可能脆弱,但不足以构成确定缺陷。

No evidenced findings in the supplied diff.

Head: 31d4cb3
Base: 215b7a9
CI: success; mergeable: null.

Validation: code/tests NOT EXECUTED. Diff-only preliminary analysis; not approval. Human review and repository gates remain required.

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复核通过:此前独立复现扩展 setter getter 已 high、实际 Agent 请求仍 medium;修复后 runtime 419/419 和类型检查通过。当前六项 CI 全部 SUCCESS。当前 main 7f2ec5d;实际 merge ref 057e3cb 的树 6f4566b2a7f5 与已验证 head 完全相同。生产改动仅同步 clamped Agent state,符合现有配置路径。无付费 provider/本地 native UI 验证声明;远程 Trusted extensions Electron E2E 通过。仅确认扩展路径修复,不将 #1974 全部关闭。

@vastsa
vastsa merged commit 036dfa0 into vastsa:main Nov 9, 2026
6 checks passed
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.

3 participants