Skip to content

Studio: mark where a chat was compacted with an inline divider - #13502

Merged
mahiatlinux merged 5 commits into
unslothai:mainfrom
oobabooga:worktree-compaction-divider
Oct 13, 2026
Merged

mahiatlinux merged 5 commits into
unslothai:mainfrom
oobabooga:worktree-compaction-divider

Conversation

@oobabooga

@oobabooga oobabooga commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

When Studio compacts a chat, the transcript now shows a one-line "Context compacted" divider where the compaction happened, directly above the prompt whose request compacted. It replaces the four-sentence box that opened the reply. The explanation and the numbers (messages dropped, passages recalled, prompt tokens before and after) move into a tooltip on the label. The divider uses the same style as the existing "Continued from chat" rule.

Screenshots

Merge base vs this branch, Qwen3.5-0.8B GGUF at a 2,048 token window, same prompts. The first compaction fires on turn 6 on both sides.

1-before-after

The detail behind the label:

2-divider-tooltip

Placement

  • Where it goes: each compaction draws one divider, in the row slot above the prompt its request answered. If no prompt precedes the reply, for example a continuation round, the divider goes above the reply itself.
  • Under the default checkpoint policy: this is also where the kept context begins, because a reset evicts everything ahead of the newest user turn.
  • Under the rolling window: the divider marks when compaction happened, not how far back the kept context reaches.
  • What was not changed: which replies count as a compaction (compactionNoticeMessageIds). So the context meter count (Studio: show the compaction count in the context meter #13355) equals the number of dividers on screen.
  • What it is built from: the existing persisted contextTruncation record. Nothing new is stored, and nothing reaches the model or the export.

At a 2,048 window a marker appears on almost every turn on both main and this branch: 9 boxes vs 8 dividers over 16 turns. Each marker is now a 13 px line instead of a 77 px box.

The label has a padded touch target (33 px tall) without changing the drawn line. Studio's tooltip opens on tap as well as hover and focus.

Validation

  • Live A/B on two installs. Before: the box sits inside the reply. After: the divider sits between rows, directly above the prompt, and is redrawn in the same place after a reload.
  • Frontend: tsc -b is clean. npm test passes 11,707 of 11,719; the 12 failures also fail on the merge base. New tests cover divider placement and that the divider count equals the meter count.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T03:39:00.193203Z 988b60d Manual request
ℹ️ 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.

@oobabooga

Copy link
Copy Markdown
Member Author

Reached Codex review convergence at oobabooga#360.

@mahiatlinux mahiatlinux self-assigned this Oct 13, 2026
@carlitogwapito

Copy link
Copy Markdown
Contributor

Small test-only companion for 3c1ac4fd98:
three divider-state tests.

These extend the divider placement checks to three metadata/revision cases:

  • An explicit saved boundary with fits: false still draws its divider. A legacy
    failed-fit record without a boundary, and metadata carried on a user message,
    do not suppress a later valid divider.
  • A checkpoint notice still draws above its prompt when its boundary is lower
    than a prior one; a later rolling boundary below the existing high-water mark
    does not create an extra divider.
  • A new streamed message-array revision gets the updated metadata and a new map,
    while the prior revision retains its original map and metadata object.

All three pass on Windows with Node 24.15.0 and the unchanged source module and
its imports, using the project's exact marked 17.0.6 dependency. Each case also
checks divider-count parity with compactionNoticeMessageIds. No failing product
behavior observed; this is additional coverage, not a bug report.

On the companion commit, from studio/frontend:

node --experimental-strip-types --test --test-concurrency=1 tests/compaction-divider-state.test.ts

Result: 3 passed, 0 failed, 0 cancelled, 0 skipped. Only the new test file is in
the commit. Full frontend CI, type-checking, formatting checks and live UI/model
validation were not run. Kept as an optional companion commit rather than opening
a second PR against this feature's not-yet-merged implementation.

@mahiatlinux

Copy link
Copy Markdown
Contributor

Review and verification evidence

Reviewed and repaired at 988b60d4506cb33375411adffcbc893b57562b0a against merge base 85c2b9c2f17940ea1f5faf238c47799fb8fc3039.

Repairs

  • e576782270a2c124da3859dfebafe87b6d4c3eb8 routes the new compaction metadata imports through the chat feature's public API and fixes the new test's formatter delta.
  • 988b60d4506cb33375411adffcbc893b57562b0a trims PR-scoped comments; the comment-only structural gate passed for every retained cleanup hunk.

Executed verification

  • Independent A/B assertion: merge base fails because compactionDividerRows is absent; original head and its merge ref pass.
  • Mutation check: forcing every divider onto the assistant row fails the targeted assertion (u1 expected, a1 observed), proving the new test detects the placement regression.
  • Focused regression suite: 51/51 passed on the repaired head and 51/51 passed on current merge ref 7e1f3c96665679a02e27034952f3201edbd04f6a.
  • Full frontend suite: merge base 11,749/11,749 passed; repaired head 11,750/11,750 passed.
  • TypeScript project and test typecheck: passed on the repaired head and current merge ref.
  • Production frontend build: passed.
  • Targeted Biome and ESLint checks for the repaired files: passed. Unchanged repository diagnostics reproduced at the merge base and were not attributed to this PR.
  • git diff --check, commit checks, and a credential-pattern scan of the final PR diff: passed.

Environment: Ubuntu Linux 7.0 x86_64, Node 26.8.2, npm 11.19.1, Python 3.11.15. All PR code and UI installs ran in task-local sandboxes without user credentials.

UI evidence

Two isolated Studio installs were pinned to the exact merge base and repaired head. At 1440×900, Chromium 151, Firefox 153, and WebKit 26.5 each persisted one divider after reload with no horizontal overflow. At 390×844, touch interaction also exposed the detail tooltip with no overflow. The old four-sentence notice inside the assistant response becomes a single divider above the triggering prompt; keyboard focus and touch reveal 8 dropped messages, 3 recalled passages, and the 2,450 → 980 prompt-token change.

Chromium, default state

Chromium before and after

Chromium, keyboard tooltip

Chromium tooltip before and after

Firefox, WebKit, and 390 px touch evidence

Firefox before and after

WebKit before and after

Mobile touch before and after

@mahiatlinux

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 988b60d450

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

@mahiatlinux mahiatlinux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Ready to merge, all manually checked.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants