Keep original materials and cleared results reachable across turns (quality P2-I1) #112

Merged
weichen merged 3 commits from feature/agent-quality-phase02 into main 2026-10-09 15:22:46 +00:00
Owner

摘要

P2 上下文保真 · 增量 I1(主记录:Documents 2026-10-09-agent-quality-improvement-plan.md §4;Dev 任务卡 feature/agent-quality-phase02)。

phase01 证据显示:后续轮 0 次读原件、32000 字符硬默认让长材料任务第一个请求就触发清理、被清内容只留「见会话记录」而模型无工具可读、MiniMax 要求历史回传 <think> 而我们跨轮丢弃。

本增量四项:

  1. 窗口 token 化:models.chat.contextWindow/outputReserve/contextBuffer(token,默认 128k/16k/4k)换算为内核清理阈值(×3.35 字符),替换 32000 字符硬默认。
  2. 被清理结果落盘:ResultsDir=<sandbox>/.agent/results,占位写可读路径(模型可 cat 回看)。
  3. inputs 持久化 + 跨轮列出:附件解析文本写 inputs/<原名>.md(>200 字才写、文本类跳过、不覆盖);环境段每轮列出工作区全部文件而非仅本轮上传。
  4. <think> 回放:context.thinkReplay(auto|on|off;auto=MiniMax)——请求侧历史 assistant 原样带思考块,落库不变。

Evidence

  • 单测:TestContextWindowScalesFromTokens、TestThinkReplayEnabled、TestThinkReplayWrapsAssistantHistory、TestPersistInputTextsAndListWorkspaceInputs 全绿;go test ./internal/... 通过。
  • 组合 make test(Dev worktree)通过——任务卡 evidence 行(SELF)。
  • 真实模型 before/after:before = phase01-after 报告(backend b68833f = 当前 main),after = 本构建(golden 任务集同口径)——随 Dev PR 记录在任务卡。

Impact

  • 行为变化:长材料任务不再第一请求即清理;清理后内容可取回;后续轮可读原件解析文本;MiniMax 后续轮带思考历史。
  • 无契约/存储变更。I2(内核会话记录为权威 + 压缩接线 + 会话树映射)续卡实施。
## 摘要 P2 上下文保真 · 增量 I1(主记录:Documents `2026-10-09-agent-quality-improvement-plan.md` §4;Dev 任务卡 feature/agent-quality-phase02)。 phase01 证据显示:后续轮 0 次读原件、32000 字符硬默认让长材料任务第一个请求就触发清理、被清内容只留「见会话记录」而模型无工具可读、MiniMax 要求历史回传 `<think>` 而我们跨轮丢弃。 本增量四项: 1. **窗口 token 化**:`models.chat.contextWindow/outputReserve/contextBuffer`(token,默认 128k/16k/4k)换算为内核清理阈值(×3.35 字符),替换 32000 字符硬默认。 2. **被清理结果落盘**:`ResultsDir=<sandbox>/.agent/results`,占位写可读路径(模型可 cat 回看)。 3. **inputs 持久化 + 跨轮列出**:附件解析文本写 `inputs/<原名>.md`(>200 字才写、文本类跳过、不覆盖);环境段每轮列出工作区全部文件而非仅本轮上传。 4. **`<think>` 回放**:`context.thinkReplay`(auto|on|off;auto=MiniMax)——请求侧历史 assistant 原样带思考块,落库不变。 ## Evidence - 单测:`TestContextWindowScalesFromTokens`、`TestThinkReplayEnabled`、`TestThinkReplayWrapsAssistantHistory`、`TestPersistInputTextsAndListWorkspaceInputs` 全绿;`go test ./internal/...` 通过。 - 组合 `make test`(Dev worktree)通过——任务卡 evidence 行(SELF)。 - 真实模型 before/after:before = phase01-after 报告(backend b68833f = 当前 main),after = 本构建(golden 任务集同口径)——随 Dev PR 记录在任务卡。 ## Impact - 行为变化:长材料任务不再第一请求即清理;清理后内容可取回;后续轮可读原件解析文本;MiniMax 后续轮带思考历史。 - 无契约/存储变更。I2(内核会话记录为权威 + 压缩接线 + 会话树映射)续卡实施。
weichen added 1 commit 2026-10-09 14:35:47 +00:00
Keep original materials and cleared results reachable across turns
ci / vet-and-test (pull_request) Successful in 48s
43297795f5
Why: Real-run before/after evidence (phase01 card) showed later turns never
re-read the uploaded source (0 original reads in plan-followup) because the
attachment only existed in the current turn's injection and the context window
hard default was 32000 chars - a 25k-char transcript tripped the clear-on-first
request, replacing old tool results with a pointer the model has no tool to
follow. MiniMax is an interleaved-thinking model whose docs require <think>
blocks in assistant history; dropping them degrades later turns.

Evidence: SELF - new tests TestThinkReplayWrapsAssistantHistory,
TestContextWindowScalesFromTokens, TestThinkReplayEnabled,
TestPersistInputTextsAndListWorkspaceInputs; go test ./internal/... passes;
live before/after comparison on the golden task set recorded on the phase02
task card per the new policy clause.

Impact: models.chat.contextWindow/outputReserve/contextBuffer (tokens,
defaults 128k/16k/4k) drive the in-run clear threshold, converted to chars;
cleared tool results spill to <sandbox>/.agent/results with readable paths;
attachment parse text persists as inputs/<name>.md and the env section lists
all workspace inputs every turn; context.thinkReplay (auto|on|off, auto =
MiniMax) replays thinking blocks into request-side assistant history only.
weichen added 1 commit 2026-10-09 14:56:36 +00:00
Keep tool-result dumps out of the deliverable gate and cards
ci / vet-and-test (pull_request) Successful in 45s
908fb253d7
Why: The live after-run (golden minutes-pm-tool) showed the truncation spill
artifact tool-run_shell-<call>.txt entering CheckArtifacts as a .txt
deliverable; its non-UTF-8 payload failed the scorer four times in a row.
These files exist to keep oversized tool output reachable - they are context
relief, not deliverables, and must not occupy delivery cards either.

Evidence: SELF - TestLatestDeliverablesKeepsLastPerName extended with a
tool-dump ref and asserts exclusion; go test ./internal/... passes; single-task
live rerun recorded on the phase02 task card.

Impact: latestDeliverables (gate input, verifier refs, reply deliverable list,
final artifact_ref cards) skips kind=data tool- prefixed refs. The spill files
remain artifacts for context backfill.
weichen added 1 commit 2026-10-09 15:12:20 +00:00
Merge origin/main into feature/agent-quality-phase02
ci / vet-and-test (pull_request) Successful in 43s
9fe2a592f3
weichen merged commit 449d8a6943 into main 2026-10-09 15:22:46 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Backend#112