Repository navigation
fix(agent-core-v2): preserve explicit loop profile binding semantics - #4840
Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d11885c56c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| bindingSnapshot(): ProfileBindingSnapshot { | ||
| return this.profileAdapter.snapshot(); |
There was a problem hiding this comment.
Preserve raw thinking through allowlist refreshes
When a main agent explicitly binds thinkingLevel: 'off' to an alwaysThinking model and a catalog change alters its derived subagent allowlist, AgentProfileService.refreshBoundSubagentAllowlist() builds the replacement from data(current) (profileService.ts:283), which converts off to the model's effective/default effort, and profileAdapter.ts:223 then stores that converted value. This new accessor therefore returns (for example) high instead of the explicit off, so a host's later snapshot rebind still cannot preserve the setting this API is intended to expose; construct the allowlist-only replacement from the raw current snapshot instead.
AGENTS.md reference: AGENTS.md:L130-L132
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The allowlist refresh now copies the current binding snapshot and replaces only subagents. The existing catalog refresh test now verifies that a newly discovered subagent is added, the stored effort stays off, and the effective effort stays high for an always-thinking model.
The new assertion reproduced the rewrite before the fix. Both targeted test files pass after the fix (87 tests).
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Port MoonshotAI#4901, MoonshotAI#4909 and MoonshotAI#4911: complete the task before asserting a zero-timeout wait sees the completed snapshot, restore the instructions reload spy after the failure assertion, poll the search index until it is ready before asserting the page, and run remote-session git probes through a host process that refuses gh. Record MoonshotAI#4840 as equivalent (the refresh path already rebuilds from the effective binding here) and pin it with a regression case, record MoonshotAI#4883 as ported with the compaction profile already present, and record MoonshotAI#4830 as blocked on the absent loop requester/request-attribution layering. Clear the generated-bundle, release-sync and working-notes rows with their applicable verdicts.
Requirement or Bug
宿主需要读取 Agent 已绑定的工具名单和思考设置,以便用原值重新绑定。当前工具名单包含运行期临时激活的工具,思考设置可能经过模型能力修正。显式重绑后,旧的临时工具名单还可能继续覆盖新绑定。
Core 共用的子代理允许名单刷新也会把模型解析后的思考档位写回绑定快照。使用始终开启思考的模型时,刷新名单可以把原始
off改写成模型默认档位。Bug Reproduction Steps
activeToolNames: ['Read'],调用addActiveTool('InheritedTool')模拟临时继承一个工具。loop.applyBindingSnapshot()重新绑定,并将activeToolNames留空以恢复默认工具范围。loop.getActiveToolNames()。修复前返回['Read', 'InheritedTool'],预期返回undefined,由现有工具策略决定可用工具。名单刷新问题可在始终开启思考且默认档位为
high的模型上复现。显式绑定thinkingLevel: 'off'后注册一个可加入的子代理 profile,修复前绑定快照中的off会变为high。Root Cause
已绑定的 profile 存在 loop 的内存状态中。
data()返回模型修正后的设置和包含临时增删的工具名单。loop.applyBindingSnapshot()此前直接调用setProfile(),保留临时增删。普通 profile 更新也使用setProfile(),包括子代理允许名单刷新,因此显式重绑需要单独清理临时增删。名单刷新此前以
data(current)为基础创建新绑定。该方法会解析模型的实际思考档位,于是刷新名单时也持久化了这个解析值。Code Changes
bindingSnapshot()直接读取 loop 已持有的快照,保留绑定的思考级别和工具名单。applyBindingSnapshot()与新 Agent 初始化复用已有的 AGENTS.md 路径提取和提醒初始化逻辑。Behavior Changes and Affected Users
data()提供运行值bindingSnapshot()提供只读绑定值,data()继续提供运行值data()loop.applyBindingSnapshot()的宿主setProfile()setProfile()更新off写成实际档位off,请求仍按模型能力解析实际档位回归测试覆盖绑定名单与临时增删、普通更新、显式恢复默认工具范围,以及 AGENTS.md 路径提取和提醒初始化。名单刷新回归验证子代理成功加入,原始档位保持
off,有效档位仍为high。Kimi Code 的 fork 继续走现有的 Agent 初始化入口。此次验证使用本地测试,模型使用测试配置。首轮 GitHub 检查中 15 项通过,Windows 作业按现有配置跳过。测试分片 2 的 SDK 用例在
source.undoHistory(1)报records.write_failed,运行到该行时尚未创建 fork。在同一环境对主线基线aa839f05f重复运行该用例 6 次,其中 2 次复现同一错误。当前账号缺少 GitHub Actions 重跑权限。首轮失败的测试分片修复提交
a254fe05c的 GitHub 检查中 15 项通过,Windows 作业按配置跳过。首轮失败的 SDK 用例本轮通过。分片 2 有一项失败,taskManager.test.ts的零超时等待用例收到completed,预期为running。在本地用修复提交和主线aa839f05f分别跑该文件,均为 53 项通过。本轮失败的测试分片本地验证
binding.test.ts、profileOps.test.ts、toolSelectService.test.ts和 loophooks.test.ts共 209 项通过。agentLifecycle.test.ts和agentsMdReminder.test.ts共 133 项通过。pnpm run lint通过,0 个错误。high,预期为off。修复后binding.test.ts与thinking.test.ts共 87 项通过,Core 类型检查和改动文件 lint 通过。Checklist
gen-changesetsskill. 名单刷新修复持久化的原始档位,CLI 的思考设置入口与模型档位解析规则保持原样。