Skip to content

fix(chat): remove doubled gap under assistant messages - #5926

Merged
M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
graycyrus:fix/assistant-message-action-bar-spacing
Sep 1, 2026
Merged

fix(chat): remove doubled gap under assistant messages#5926
M3gA-Mind merged 2 commits into
tinyhumansai:mainfrom
graycyrus:fix/assistant-message-action-bar-spacing

Conversation

@graycyrus

@graycyrus graycyrus commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Consecutive assistant messages in chat sat ~54px apart, because the action bar's height reservation lost the negative margin that hands it back to the flow.
  • Restores that -mb onto the footer that carries min-h-7.5, sized to the message group's gap so the bar is drawn inside the gap instead of stacking on top of it. Assistant turns go from ~54px apart to 30px.
  • Adds a regression test pinning the relationship (amount pulled back === the group's gap-y-*), which fails in both directions.
  • No change to the action bar's own appearance, and none to user-message spacing.

Problem

AssistantMessage reserves the action bar's height with min-h-7.5 so a bar revealed on hover does not shift the transcript. That reservation is meant to be cancelled immediately by a matching -mb-7.5 on the same element, so it costs nothing in flow — the pattern is still intact in pages/dev/assistant-ui-demo/BaseDemo.tsx:599, comment included:

// reserves space for action bar and compensates with `-mb` for consistent msg spacing
const ACTION_BAR_HEIGHT = `-mb-7.5 min-h-7.5 ${ACTION_BAR_PT}`;

In thread.tsx the two halves had drifted apart. -mb-7.5 ended up on the message root, paired with a pb-7.5 added so content-visibility: auto (which implies contain: paint) would not clip the bar. On the root those two simply cancel each other and reclaim nothing, leaving the footer's min-h-7.5 uncompensated:

Reserved Compensated Net flow cost
BaseDemo.tsx footer min-h-7.5 -mb-7.5 0px
thread.tsx footer (before) min-h-7.5 30px
thread.tsx root pb-7.5 -mb-7.5 0px (paint-only)

Result: 30px of dead space under every assistant turn, stacked on the message group's gap-y-6 (24px) — so ~54px between consecutive replies, and the same band between a reply and a following tool group.

Solution

Put the compensation back on the element that reserves the height, sized to the gap it is being pulled into:

-const ACTION_BAR_HEIGHT = `min-h-7.5 ${ACTION_BAR_PT}`;
+const ACTION_BAR_HEIGHT = `-mb-6 min-h-7.5 ${ACTION_BAR_PT}`;

Assistant turns now sit 30px apart, down from ~54px.

Why -mb-6 and not the full -mb-7.5. Full compensation is what upstream prescribes (BaseDemo.tsx:599, "for pt-[n] use -mb-[n + 6]"), and it was the first form of this fix — Codex caught it in review. The bar is pt-1.5 plus a size-6 button, so it is exactly 30px, while gap-y-6 makes the gap only 24px. Pulling back all 30px drags the bar 6px deeper than the gap is tall, and the bar (ms-2) and the next message's content (px-2) share an 8px left inset — so the tail lands on the following reply's first line rather than beside it. Handing back the gap instead makes the bar fill it exactly:

-mb step Flow cost Turn spacing Bar vs. gap
absent (before) 30px ~54px fits, but 30px is wasted below it
-mb-7.5 (full) 0px 24px 6px overflow onto the next message
-mb-6 (this PR) 6px 30px fills the gap exactly

Notes on what deliberately did not change:

  • The root's -mb-7.5 pb-7.5 stays. It is paint-only and is load-bearing again: with the footer's -mb restored the bar paints past the root's content box, and contain: paint would clip it without that padding. Both pairs are now commented so a future reader does not conflate the paint allowance with the spacing compensation.
  • gap-y-6 is untouched. It also governs user↔assistant spacing, so retuning it is a separate design call rather than part of this fix.
  • The bar still reserves its height, so a hover-revealed bar does not shift the transcript. This restores the intended behaviour rather than trading it away.

The test reads the -mb-* step off the footer and the gap-y-* step off aui_message-group and asserts they match, so it pins the relationship rather than either literal — retuning either stays free, breaking their correspondence does not. Verified non-vacuous in both directions before landing: no -mb fails with expected null to be 6, and -mb-7.5 fails with expected 7.5 to be 6.

Submission Checklist

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategythread.actionBarSpacing.test.tsx, covering both failure directions (no compensation → dead band; over-compensation → overlap), each confirmed failing before landing. jsdom performs no layout, so the utilities are the only observable; they are read as a relationship between two elements rather than asserted as class-string literals.
  • Diff coverage ≥ 80% — the one changed executable line (the ACTION_BAR_HEIGHT assignment) is hit by the new test; thread.tsx went from 0% to ~67% statements. The rest of the diff is comments.
  • Coverage matrix updated — N/A: behaviour-only change, no feature row added, removed or renamed.
  • All affected feature IDs from the matrix are listed in the PR description under ## RelatedN/A: no matrix feature IDs affected.
  • No new external network dependencies introduced — none added; the test renders against an in-memory useExternalStoreRuntime.
  • Manual smoke checklist updated if this touches release-cut surfaces — N/A: CSS-only spacing fix, no release-cut surface changed.
  • Linked issue closed via Closes #NNNN/A: no tracking issue; reported directly.

Impact

  • Platform: desktop chat UI only. No core, RPC, or Tauri change.
  • Visual: consecutive assistant messages tighten from ~54px to 30px, with the action bar sitting flush in the gap. User-message spacing is unchanged.
  • Performance / security / migration: none.

Related

  • Closes: N/A — no tracking issue; reported directly.
  • Follow-up PR(s)/TODOs: gap-y-6 at thread.tsx:248 is the remaining knob if 30px still reads loose — note it now sets both the turn spacing and the space the action bar is drawn into, and it also moves user↔assistant spacing, so it is left as a separate design call. BaseDemo.tsx:599 still carries the fully-compensated form and the same latent overlap; left alone as it is a dev-only demo page.

AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/assistant-message-action-bar-spacing
  • Commit SHA: 4dae492 (review fix) on 884d66d

Validation Run

  • pnpm --filter openhuman-app format:check — prettier clean on both touched files; eslint clean.
  • pnpm typecheck
  • Focused tests: vitest run src/components/assistant-ui/ src/features/conversations/components/ — 27 files, 248 tests passed.
  • Rust fmt/check (if changed): N/A — no Rust changed.
  • Tauri fmt/check (if changed): N/A — no Tauri changed.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: the assistant action bar's height reservation is drawn into the existing inter-message gap instead of stacking on top of it.
  • User-visible effect: the gap between consecutive assistant messages drops from ~54px to 30px.

Parity Contract

  • Legacy behavior preserved: the bar still reserves its height, so a hover-revealed bar does not shift the transcript; the root's paint-box padding still prevents contain: paint from clipping it; the bar stays clear of neighbouring messages.
  • Guard/fallback/dispatch parity checks: N/A — no guards, fallbacks or dispatch involved.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this one
  • Resolution: N/A

Summary by CodeRabbit

  • Bug Fixes

    • Reduced unnecessary blank space beneath assistant messages when action controls are displayed.
    • Improved spacing and visual alignment between assistant responses.
    • Ensured action bar spacing integrates cleanly with the surrounding message layout.
  • Tests

    • Added automated coverage to verify consistent footer spacing and action bar alignment across assistant messages.

The assistant action bar reserves its own height with `min-h-7.5` so a bar
revealed on hover does not shift the transcript, and cancels that reservation
with a matching `-mb-7.5` so it costs nothing in flow.

The two halves had been separated: `-mb-7.5` sat on the message root, paired
with a `pb-7.5` added for `content-visibility: auto`'s implied `contain: paint`.
There the two merely cancel each other, leaving the footer's `min-h-7.5`
uncompensated — a dead 30px band under every assistant turn, on top of the
message group's `gap-y-6`. Consecutive replies sat ~54px apart instead of 24px.

Put the compensation back on the element that reserves the height, and comment
both pairs so they are not conflated again. The root's paint-box pair is
unchanged and still required: with the footer's `-mb` restored, the bar paints
past the content box and `contain: paint` would otherwise clip it.

Adds a regression test asserting the invariant (reserved === compensated,
on the same element) rather than the literal value, so retuning the bar's
height stays free while decoupling the halves does not.
@graycyrus
graycyrus requested a review from a team September 1, 2026 09:24
@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Sep 1, 2026

@tinysweeper tinysweeper 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.

tinysweeper found nothing blocking. Approving.

             $0.0053 · 63,707 in / 563 out · 0 cached (0%) · openrouter/openai/text-embedding-3-small, deepseek/deepseek-v4-flash · 265 embedded
critique:    $0.0019 · 22,958 in / 146 out · 0 cached (0%) · deepseek/deepseek-v4-flash
security:    $0.0019 · 22,916 in / 248 out · 0 cached (0%) · deepseek/deepseek-v4-flash
tests:       $0.0010 · 12,093 in / 82 out  · 0 cached (0%) · deepseek/deepseek-v4-flash
description: $0.0005 · 5,740 in  / 87 out  · 0 cached (0%) · deepseek/deepseek-v4-flash

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 2583395d-d653-44e2-b034-008651e2165f

📥 Commits

Reviewing files that changed from the base of the PR and between 884d66d and 4dae492.

📒 Files selected for processing (2)
  • app/src/components/assistant-ui/thread.actionBarSpacing.test.tsx
  • app/src/components/assistant-ui/thread.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The assistant message action bar now uses the message-group gap to compensate for its reserved height. A Vitest test verifies this spacing relationship for multiple assistant replies.

Changes

Assistant action bar spacing

Layer / File(s) Summary
Reserve and compensate action bar space
app/src/components/assistant-ui/thread.tsx, app/src/components/assistant-ui/thread.actionBarSpacing.test.tsx
AssistantMessage changes the pull margin to -mb-6 while retaining the min-h-7.5 reservation. The test checks the message-group gap, footer reservation, and pull margin relationship.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 4dae4

This localized chat spacing fix preserves action-bar behavior and adds regression coverage; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: al629176

Poem

A rabbit checks the footer line
The reserved space now fits just fine
The gap and margin hop in place
Tests watch each reply with care
Clean spacing marks the trail

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing excessive spacing beneath consecutive assistant messages.
  • Fix all pre-merge checks with AI

Comment @coderabbitai help to get the list of available commands.

@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: 884d66db30

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread app/src/components/assistant-ui/thread.tsx Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 1, 2026
Codex review on the previous commit: compensating the footer's full `min-h-7.5`
pulls the bar 30px into a gap that `gap-y-6` only makes 24px tall, so the bar's
bottom 6px paint over the next message's first line — at the same left inset
(`ms-2` on the bar, `px-2` on the content). The bar is `pt-1.5` plus a `size-6`
button, so it is exactly 30px and the overflow is real, not marginal.

Hand back the gap rather than the whole reservation: `-mb-6 min-h-7.5`. The bar
now fills the 24px gap exactly and consecutive assistant turns sit 30px apart —
still well down from the 54px the uncompensated reservation produced, with no
overlap.

Retargets the regression test at the property that actually matters: the amount
pulled back equals the message group's `gap-y-*`, read off both elements rather
than hard-coded. That fails in both directions — pulling back nothing (the
original dead-band bug) and pulling back more than the gap (this overlap) — and
both were verified to fail before restoring the fix.
@tinysweeper

tinysweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown

How this change flows

0 changed behaviours across 8 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 34 further behaviours left out to keep the diagram readable.

flowchart LR
  n0["ThreadRoot"]:::impacted
  n1["Composer"]:::impacted
  n2["ThreadComponentsContext"]:::impacted
  n3["Thread"]:::impacted
  n4["ComposerAction"]:::impacted
  n5["AssistantMessage"]:::impacted
  n0 -->|uses| n1
  n0 -->|uses| n2
  n1 -->|uses| n2
  n1 -->|uses| n4
  n3 -->|uses| n0
  n3 -->|uses| n2
  n4 -->|uses| n2
  n5 -->|uses| n2
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading

Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge.

tinysweeper 0.1.0

@graycyrus

Copy link
Copy Markdown
Contributor Author

@codex review

The P2 you raised on 884d66db30 (action bar overflowing the inter-message gap) is addressed in 4dae492d7 — the footer now hands back -mb-6 (the message group's gap-y-6) rather than the full min-h-7.5, so the 30px bar fills the 24px gap exactly instead of overhanging it by 6px. Please re-review the follow-up commit.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 4dae492d74

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@M3gA-Mind
M3gA-Mind merged commit 827f740 into tinyhumansai:main Sep 1, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants