← Back to Pull requests

Chat: finish hiding compaction reminders (follow-up to #526) (bugfix) #542

Closed
unknown closed this pull request without merging on Nov 27, 2026 02:50 UTC
View on GitHub
unknown unknown commented on Nov 27, 2026 00:51 UTC
Author

Follow-up to #526.

After a context compression, hermes-agent v0.23.4 often folds the task list into the last real user row instead of storing it as a row of its own. A reloaded chat showed it under the person's own prompt, under a bot's message and under a scheduled result. #526 hid a reminder only when its header was the row's first line, so it missed all of these. The three review fixes for #526 (9a83c52a, 9a757aa6, 5e3fb8c8) never reached master. This PR ports them, adapted to what the author added after the review.

| Before (master, v0.23.4) | After (v0.23.4) |
|---|---|
| <img src="https://raw.githubusercontent.com/Giton22/kyllene/9f7df5d5a833a9e76ee8b565ab41db0ffecb4eb1/before-v0234.png" width="300"> | <img src="https://raw.githubusercontent.com/Giton22/kyllene/9f7df5d5a833a9e76ee8b565ab41db0ffecb4eb1/after-v0234.png" width="300"> |

What each case fixes

  • List folded into a prompt. The list after a blank line is cut, CRLF included, and the skill reload notice after it goes too. Sending the prompt again sends only the person's text.

  • List beside a picture. The list comes as a text part of its own and is dropped. A picture-only prompt now shows its picture; before, the whole row was hidden.

  • List folded into a bot's message or a scheduled result. It is cut before the row is read. A scheduled result still wins over every reminder match, as in #526's scheduledResultWithCompactionReminderHeaderRemainsARoutine.

  • A prompt that opens with the header line. A row is a task-list reminder only when the list's first - item follows the header (tools/todo_tool.py format_for_injection never writes the header alone). So a prompt that starts with the header and goes on in its own words stays.

  • The skill reload notice on its own row. It is hidden. This path is defensive: in v0.23.4 the notice is always written after the list.

  • History pages. A hidden reminder row no longer counts as the first prompt of a page.

  • /branch N. It now counts messages the way the chat shows them (taken from historyToMessages). Reminder rows and a restatement whose original is loaded are skipped, and a reply's step after one of them adds to that reply. Before, the branch ended a message early.
  • The ROADMAP line is ticked, and the "compaction reminders" row in docs/bot-mode-integration.md is updated.

    Dropped on purpose

    The review fix hid every row flagged compaction_inflight_task_restatement. That is left out. v0.23.4 writes the flag only on the standalone replay row, and that row always starts with the restatement header (agent/context_compressor.py). The same code removes the original row, so the replay is often the only copy. Master (36e79dcb) shows that copy without its header while its original isn't loaded, and hiding every flagged row would undo it. The test is rewritten to cover master's behaviour: a flagged restatement with the list folded into it shows as "Draft them" when it is the only copy, and is left out once its original is loaded.

    Testing

  • HistoryToMessagesTest gets three tests ported from the review fixes, one rewritten as above, plus a scheduled result with the list folded in. HistoryPagesTest and ChatSessionTest each get the ported test. On master, all of them fail.

  • :shared:core:testAndroidHostTest passes, and so does :desktopApp:compileKotlinJvm.

  • I tested on the emulator against a local test gateway with a fake model. The fake model makes no tool calls, so it can't run the todo tool. I wrote v0.23.4's shape straight into state.db: the list folded into the prompt after a blank line, plus a standalone task-list row and an assistant step after it. Then I reloaded the chat.
  • | Gateway | Mode | master | this branch |
    |---|---|---|---|
    | v0.23.4 | authority (webapp listener) | list shown under the prompt | prompt alone; the standalone row is hidden and its step joins the reply; a follow-up still sends and gets its reply |
    | v0.23.4 | legacy (hermes dashboard) | (same rows) | prompt alone |
    | v0.22.0 | legacy (hermes dashboard) | list shown under the prompt | prompt alone |

    v0.22.3 and v0.22.7 were not tested. The stored rows have the same columns as v0.22.0 and v0.23.4.

    <details><summary>v0.22.0 legacy, and v0.23.4 legacy</summary>

    | v0.22.0 before | v0.22.0 after | v0.23.4 legacy after |
    |---|---|---|
    | <img src="https://raw.githubusercontent.com/Giton22/kyllene/9f7df5d5a833a9e76ee8b565ab41db0ffecb4eb1/before-v0220-legacy.png" width="240"> | <img src="https://raw.githubusercontent.com/Giton22/kyllene/9f7df5d5a833a9e76ee8b565ab41db0ffecb4eb1/after-v0220-legacy.png" width="240"> | <img src="https://raw.githubusercontent.com/Giton22/kyllene/9f7df5d5a833a9e76ee8b565ab41db0ffecb4eb1/after-v0234-legacy.png" width="240"> |

    </details>

    Not checked on a device: pictures and bot messages with the list folded in. The fake model can't produce those rows, so unit tests cover them.

    Created with Claude Opus 5.5 in Claude Code.

    Diff: 628 lines (+471 / -157) across 7 files Reviewer: Giton22 Review duration: 118m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.50) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 628 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.386
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #542"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.3% (MEDIUM) · Higher = larger blast radius
    50.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.8% · Safe to merge
    21.8%