Skip to content

[RT14 partial] 校验小型上下文的工具配对,保留执行器与确认验收缺口 - #720

Merged
LIghtJUNction merged 2 commits into
mainfrom
test/rt-14-agent-tool-intent
Oct 11, 2026
Merged

LIghtJUNction merged 2 commits into
mainfrom
test/rt-14-agent-tool-intent

Conversation

@LIghtJUNction

Copy link
Copy Markdown
Member

LMM API Pull Request

变更说明 / Summary

RT14 部分交付,不是助手权限或用户意图验收通过。保持 Draft,不合并、不发布、不部署。

基线:2f4164978cf27f6e0e605b0589fbe631aef2c441。未采用 #675 的实现或测试替身。提交前读取的 main 为 ed147e1d24c6fc127f898592f4f8639ca92e97db,相关 context.go 仍与基线相同。

本次实际复现的局部问题:internal/agent.Compact 在上下文未超过字节上限时提前返回,未执行已有的工具调用/结果配对检查。因此,相同的不完整或不匹配工具交换会因字节上限不同而被接受或拒绝。

本 PR 仅修改两个文件:新增独立回归测试;将现有配对检查移到体积快捷返回之前。不新增权限模型,不改提示词、奖励政策、MCP OAuth、支付或部署逻辑。合法完整对话的输出保持不变。此前被静默接受的小型非法工具交换现在返回错误。

这个局部问题不是已证实的越权、付费、数据外传或确认绕过。实际用户输入能否把这种结构送入应用,以及模型、执行器和数据库的完整链路,均未验证。

测试与修复分开提交:

  • a53fd01dfcd96b2c445a5c6c3150d18e6ca517b5:仅回归测试。
  • a3ff114f1299c268f01533244590d5910140090a:仅移动现有检查位置。

与上游的关系 / Upstream relationship

  • LMM API 独有变更 / LMM API-specific change
  • 上游尚未合并的修复或功能 / Change not yet merged upstream
  • 同步或移植上游变更 / Upstream sync or backport
  • 不适用 / Not applicable

上游参考 / Upstream reference:本仓库内置助手上下文处理。保留已有版权和协议声明。

关联 Issue / Related issue

Related to #711。不关闭审计,不宣称 RT14 完成。

变更类型 / Type of change

  • Bug 修复 / Bug fix
  • 新功能 / Feature
  • 重构或性能优化 / Refactor or performance
  • 前端或交互 / Frontend or UX
  • 部署、CI 或构建 / Deployment, CI, or build
  • 文档或仓库维护 / Documentation or maintenance

验证 / Verification

实际环境:Go 1.23.2,离线。项目要求 Go 1.25.1;容器无法解析 GitHub 和 Go 依赖代理域名,无法取得完整可构建仓库和依赖。因此只运行下面这些原始源码文件,不是完整包、控制器或应用测试;未修改项目 go.mod。

原始源码均校验 Git blob:

  • context.go 基线 463438bef9ee4683fc68a45aa9c3b688d22cee79
  • protocol.go 基线 ff15face0cf32ea427387f76cca8299ff6c4fca8

提交后读回的修复源码与本机已测试内容一致:

  • context.go:0f3916688d39669b342eb10f123603bc268d2908
  • 新测试:f49e575e65e8fe4ead4197582724379d69b178c2
# 在包含这三个文件的独立临时目录中执行;不下载依赖。
GO111MODULE=off GOTOOLCHAIN=local GOPROXY=off GOSUMDB=off \
  go test -count=1 -v context.go protocol.go rt14_context_protocol_test.go

基线源码 + 新测试:exit 1,14 个失败子用例。
修复源码 + 相同测试:exit 0,全部通过。
正常完整交换、空历史及超过上限时原有拒绝行为均保留。
gofmt -l:本次修改和新测试无输出。

另有两项本机补充检查:工具结果中的 JSON 控制字段不会自动变成结构化调用;失败记录在压缩后不会变成成功。它们只检查真实上下文函数,没有调用模型或实际工具执行器,不代表四类外部入口都已测试。

RT14 主验收状态:

证据层 本轮状态
模型或模型替身提出结构合法但未经授权的调用 未执行
真实 executeAssistantAgentTool → executeAssistantTool 接受/拒绝 未执行;仅定位源码
独立数据库记录是否改变 未执行
本机外部哨兵是否收到假秘密 未执行

搜索、MCP、文档模拟服务,四类外部内容入口,跨账号资料读取、超范围 Key、接收人替换,以及金额/接收人/工具/安装版本/参数变更后的旧确认重放,均未完成动态验证。没有实际本地模型测试,模型抗诱导行为未验证。不能把上表的“未执行”写成“被成功拦截”。

后续验收仍须通过实际执行器和独立数据库,并分别记录四层结果。本次源码中的角色与会话检查,不等于已验证本轮用户意图绑定。

截图或日志 / Screenshots or logs

完整本机修复前后日志、源码校验值及离线复跑脚本通过会话附件交付。公开 PR 仅保留不含真实秘密的结构回归用例;没有上传可利用的业务攻击载荷。无界面改动。

提交检查 / Checklist

  • 已完整排除所有并行审计分支中的重复工作;仅确认提交前 main 相关源码仍未修改。
  • 此 PR 仅包含本次局部缺陷的测试和修复,无其他格式化或业务变更。
  • 已说明兼容影响并保留来源、版权及许可证信息。
  • 完整应用兼容性和业务测试已通过;尚未执行。
  • 已记录实际本机测试与未执行项目。
  • 无用户文案、配置或文档接口变化,无需翻译。
  • 提交不含真实 API Key、Cookie、Token、密码或 DSN。

已核对 .github/workflows 在基线及提交前 main 的目录树一致;已读触发块均为 workflow_dispatch。未触发远程 CI,未访问生产,未使用真实资金或通知,未发布、部署或合并。

Related to #711, RT14 partial work at 2f41649. Covers protocol structure only, not model injection resistance or executor authorization. Local selected-file baseline run reproduces 14 failing subcases. No remote CI.
…p ci]

Related to #711, RT14 partial work. Reuse the existing protocol validator for small contexts as well. Preserve valid conversations and existing compaction behavior. Selected-file offline regressions pass; full executor, confirmation, database and local-model testing remain unverified.
@LIghtJUNction
LIghtJUNction marked this pull request as ready for review October 11, 2026 12:40
Copilot AI balanced review requested due to automatic review settings October 11, 2026 12:40

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 reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-11T12:44:26.788132Z a3ff114 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

2 participants