Skip to content

feat(agents): a log summary is frozen sections and one open one (ADR 0174) - #5215

Merged
matthiasn merged 2 commits into
mainfrom
feat/agent-summary-sections
Nov 29, 2026
Merged

matthiasn merged 2 commits into
mainfrom
feat/agent-summary-sections

Conversation

@matthiasn

Copy link
Copy Markdown
Owner

Why

A task, project or Daily OS agent keeps one summary of everything older than its recent entries, and every fold handed the whole of it back to the model to be written again. Two consequences, both measured in the long-log run behind #5204: the text grows with the log (56–97 words a fold, with nothing to stop it), and a rewrite of everything is where history is lost. #5204 refuses a cut or collapsed result, which turns loss into a stall once the summary outgrows the completion cap.

What (ADR 0174)

  • A summary is sections: frozen ones, oldest first, and one open section.
  • A fold rewrites only the open section, a batch of at most 12,000 tokens of entries at a time. Frozen sections are carried from checkpoint to checkpoint by code and are never handed to a model again.
  • An open section past 600 words is frozen, stamped with the days its entries span.
  • A prompt shows the newest frozen sections that fit 3,000 tokens, then the open one, each under its days. When older ones do not fit, one line says how many there are, what days they cover, and that search_memory (feat(agents): task and project agents can search their own history (ADR 0173) #5211) reaches them.
  • Nothing changes until a section is frozen: with none, the summary is byte for byte the running summary it was.
  • One checkpoint, as before. Coverage, selection and invalidation (ADRs 0017, 0071) are untouched; only the text has structure. summaryText stays the rendered text, so an older build reads a new checkpoint as always, and an older checkpoint is one open section.

New: lib/features/agents/projection/summary_sections.dart (foldIntoSections, renderSummarySections), called from AgentLogCompactor.maybeCompact.

Live result (12 folds, 120 planted decisions, production fold path)

Model Decisions held Shown to a wake First section frozen Folds refused
glm-5.3 120 of 120 120 of 120 eighth fold 0
DeepSeek Flash v4.1 1017 120 of 120 120 of 120 seventh fold 0
Mistral Large 4 120 of 120 120 of 120 tenth fold 0

Twelve folds freeze one section, which fits the prompt, so this run does not reach the point where an old section leaves it. That behaviour is held by summary_sections_test.dart.

What this trades

  • Old sections leave the prompt. A decision in one is in the agent's view only if it searches. The index line says there is something to search; nothing keeps an early decision always in view. If that proves to matter, ADR 0174 points at a small keyed store of standing decisions, not a summary of summaries.
  • A checkpoint invalidated by a late-arriving event is rebuilt from the whole log, sections included, as it was before.

Not measured

  • Whether the models search when a decision sits in a section they are not shown.
  • A log long enough to hide a section, live.

Tests

summary_sections_test (13): extending, freezing with its days, batching a large fold, a refusing writer, rendering order and labels, the hidden-sections line and its budget, the legacy payload and round trip. agent_log_compactor_test: a frozen section carried untouched with the model given only the open one — fails when frozen text is fed back — and a pre-sections checkpoint taken as one open section. Ran agents/projection, agents/sync, agents/service, agents/workflow, daily_os_next/agents, test/architecture (4,340 pass). Analyzer clean on the whole package; make knowledge_check and make changelog_check pass.

Screenshots

No surface changes: the text of an agent's summary block.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T21:52:57.192770Z 1cd0085 PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 360ecffb-56bd-4c5b-a822-c4f6cf246dcf
Commits

Reviewing files that changed from the base of the PR and between f0b6add and a274bd9.

Files selected for processing: 10

  • changelog.d/2026-11-29-agent-history-summary-bounded.md
  • docs/adr/0174-a-log-summary-is-frozen-sections-and-one-open-one.md
  • docs/evaluations/agent_log_summarizer.md
  • knowledge/features/agents/memory-and-compaction.md
  • lib/features/agents/projection/summary_sections.dart
  • lib/features/agents/sync/agent_log_compactor.dart
  • scripts/agent_log_summary_eval.sh
  • test/features/agents/projection/summary_sections_test.dart
  • test/features/agents/service/agent_log_summarizer_eval_live_test.dart
  • test/features/agents/sync/agent_log_compactor_test.dart
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1cd0085d18

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.04762% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.89%. Comparing base (a0f1d3e) to head (a274bd9).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lib/features/agents/sync/agent_log_compactor.dart 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5215      +/-   ##
==========================================
- Coverage   99.90%   99.89%   -0.01%     
==========================================
  Files        2898     2899       +1     
  Lines      222619   222722     +103     
==========================================
+ Hits       222397   222499     +102     
- Misses        222      223       +1     
Flag Coverage Δ
glados 13.97% <0.95%> (-0.01%) ⬇️
standard 99.80% <99.04%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@matthiasn
matthiasn merged commit 5b9905a into main Nov 29, 2026
31 checks passed
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.

1 participant