Chat: add model-aware history budgets and safe compaction for replay/recovery

未关闭
#430 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
12/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
go

调研方向

This is design work spanning chat prompt construction, transcript persistence, branch/edit invalidation and native-session recovery, and the payload names no specific files or tests. Start by locating where the chat prompt and history are assembled for the selected model, and read the related transport fix in #429. Done would need a settled budget/compaction design and the listed acceptance tests (oversized draft, pending confirmations, branch invalidation, missing native transcript, multibyte UTF-8) passing against a fixture provider.

由索引模型根据 Issue 内容生成。

描述

Related transport fix: #429.

Moving a chat prompt from argv to stdin avoids the operating system's per-argument limit, but does not enforce the selected model's context window. Long authoritative transcripts, including saved operation drafts, can still grow indefinitely. Branches, edited histories, executor changes and missing native sessions require full-history reconstruction, which may exceed the model budget even when normal incremental continuation works.

Please consider a separate context-management change:

  • Define provider/model-aware input budgets with room for system instructions, tool schemas and expected output. Track serialized UTF-8 bytes separately from estimated/model token counts; do not treat a 128 KiB OS argument threshold as a model context limit.
  • Build a bounded model-facing projection while preserving the authoritative user-visible transcript. Summaries should retain user constraints, pending approvals and operation receipts, and must not turn historical instructions into current authorization.
  • Use a persisted, revision-bound summary/checkpoint plus recent turns; invalidate it correctly when editing or branching. Keep the current question intact and expose a clear diagnostic when even the current turn cannot fit.
  • Ensure initial chat, long-history branches and native-session recovery use the same budget/compaction policy. Coordinate with provider-native compaction instead of replaying unbounded history after a cache miss.
  • Return structured, redacted failure codes for input budget/context overflow, distinct from process-launch E2BIG, provider quota failures and malformed tool JSON. Log byte/token counts and correlation IDs rather than complete prompts or credentials.

Acceptance tests should cover an oversized historical draft, preservation of pending confirmations, edited/branched history invalidation, missing native transcript recovery, and multibyte UTF-8 budgeting. These tests should use synthetic transcripts and a local fixture provider.

No deployment-specific transcripts, addresses or credentials are needed to reproduce or test this behavior.

主要语言
Go
星标
141
派生
28
平均合并
1 天 15 小时
30 天内合并 PR
113

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Tencent/LoopForge 的其他 Issue

查看 Tencent/LoopForge 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。