Skip to content
This repository was archived by the owner on Apr 30, 2026. It is now read-only.

[Backlog Discovery] feat(backlog): llm-context-window-budgeting-and-auto-summarization#118

Open
bestony wants to merge 2 commits intomainfrom
backlog/20260221091313-llm-context-window-budgeting-and-auto-summarization-llm-cont
Open

[Backlog Discovery] feat(backlog): llm-context-window-budgeting-and-auto-summarization#118
bestony wants to merge 2 commits intomainfrom
backlog/20260221091313-llm-context-window-budgeting-and-auto-summarization-llm-cont

Conversation

@bestony
Copy link
Copy Markdown
Owner

@bestony bestony commented Feb 21, 2026

[Backlog Discovery]

  • Requirement title: 为LLM调用引入上下文长度预算与自动压缩
  • Priority: P1
  • Requirement file: backlog/20260221091313-llm-context-window-budgeting-and-auto-summarization.md
  • Dedupe key: llm-context-window-budgeting-and-auto-summarization
  • Source run: https://github.com/bestony/self/actions/runs/22254150241

[Backlog Discovery]

Update Record 2026-02-21 17:15:50 +08:00

Update summary:

  • Refined user problems into three concrete pain points: lack of token budget/compression, late-stage failures, and inconsistent truncation strategies.

  • Added a placeholder external evidence item to capture 30-day context-length failure counts, rerun cost, and affected workflows.

  • Introduced a Scope section clarifying in-scope workflows (backlog-discovery, reviewer/product reviewer, fixer) and out-of-scope items.

  • Expanded acceptance criteria with ordered default compression rules, token change reporting in job summaries, feature flags/rollback, and a minimum output quality baseline.

  • Status: committed

  • Commit: e02ce756a645ac1b46a038445dd1707a27e384a7

  • Trigger: workflow_run.completed

  • Comment: https://github.com/bestony/self/actions/runs/22254205260

  • Actor: @github-actions[bot]

  • Updated At (Asia/Shanghai): 2026-02-21 17:15:50 +08:00

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @bestony, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求的核心是引入一个详细的需求文档,旨在解决在LLM(大型语言模型)调用中常见的上下文长度限制问题。通过提出统一的token计量、预算和自动压缩策略,该方案旨在提高LLM工作流的稳定性、降低失败率并优化成本。它概述了当前面临的挑战,并为未来的开发奠定了基础,以确保LLM调用能够更有效地处理大量输入数据。

Highlights

  • 新增需求文档: 此PR引入了一个新的需求文档,详细阐述了为LLM调用引入上下文长度预算和自动压缩的必要性、目标用户、核心场景、用户问题、解决方案假设、优先级和验收标准。
  • 解决LLM上下文超限问题: 该需求旨在解决在多个工作流中,LLM提示词因内容过长而超出模型上下文长度限制,导致API错误、隐式截断、运行失败和成本浪费的问题。
  • 提出通用解决方案: 文档提出了新增通用的token预算与压缩模块的解决方案,该模块将作为所有LLM调用的前置步骤,并支持可配置的压缩策略。
Changelog
  • backlog/20260221091313-llm-context-window-budgeting-and-auto-summarization.md
    • 新增了关于LLM上下文窗口预算和自动压缩的需求文档。
Activity
  • 未检测到任何评论、审查或活动。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

本次 PR 新增了一个关于“为LLM调用引入上下文长度预算与自动压缩”的需求文档。该文档结构清晰,内容详实,明确了问题的背景、目标用户、核心场景、解决方案假设以及验收标准。我发现文档中的“需求摘要”和“用户问题”两个部分内容完全重复,这可能导致信息冗余。为了提高文档的清晰度和可读性,我已在具体代码行提出了修改建议,对这两部分内容进行区分。总体而言,这是一个高质量的需求文档,为后续的设计和开发奠定了良好的基础。

Comment on lines +26 to +27
## 4. User Problems
- self 的多个工作流会把 issue/PR/计划/日志等内容直接拼接进 LLM 提示词,但当前实现没有统一的 token 计量、上下文预算或自动压缩策略。输入一旦超过模型上下文长度就会触发 API 错误或隐式截断,导致 schedule 运行失败、成本浪费和不可复现的输出差异。
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

“用户问题” (User Problems) 部分的内容与“需求摘要” (Requirement Summary) 部分(第14行)完全相同,这造成了信息冗余。

建议区分这两个部分的内容,使文档更清晰:

  • 需求摘要 (Requirement Summary): 应简明扼要地概括需求的核心目标,即“做什么”。
  • 用户问题 (User Problems): 应详细描述当前用户遇到的具体痛点,即“为什么要做”。

此问题可能源于文档生成脚本,但直接在文档中修正能显著提升其作为独立需求文件的可读性。

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

[Backlog Discovery]
Reviewer: Product Manager

  • 范围不清:文档提到“所有 LLM 调用”作为前置步骤,但未列出具体工作流/入口,难以验收覆盖面。建议在需求中明确 in-scope 的工作流清单(如 backlog-discovery、reviewer、fixer 等)与 out-of-scope 说明。
  • 压缩策略缺少默认行为定义:验收标准只写“可配置”,但未说明默认策略、保留优先级和质量护栏,影响可测试性与一致性。建议补充默认策略与保留顺序(标题/摘要/最近 N 条等),并定义最小可接受输出质量。
  • 交付风险:新增 fail-fast 可能提升失败率但缺少回滚/开关策略。建议加入按工作流或仓库的 feature flag/分阶段启用计划,并在验收标准中注明。

@github-actions
Copy link
Copy Markdown

[Reviewer Workflow]
Reviewer: Product Manager

需求价值评估

  • 是否有价值: 有价值
  • 优先级: P1
  • Reviewer 视角结论: 该需求能显著降低因上下文超限导致的 LLM 工作流失败率,并提升结果稳定性与成本可控性。

价值点

  • 直接解决长 issue/PR/日志导致的 context length exceeded 失败,提升自动化工作流可用性与可靠性
  • 统一的预算与压缩机制降低不确定截断引发的输出差异,提升结果可复现性
  • 运行级 token 统计与记录支持容量规划与成本优化,利于平台治理

风险与建议

  • 证据偏技术说明与社区讨论,缺少 self 现网失败率/成本损失数据;建议补充最近 30 天超限失败与重跑成本
  • 压缩策略可能影响结论质量;建议明确关键字段保留规则与质量回归基线

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant