Skip to content

fix(themes): stop SafetyFloor from duplicating the assistant button on the default theme#516

Merged
jaylfc merged 1 commit into
masterfrom
fix/safety-floor-duplicate-assistant
Jun 2, 2026
Merged

fix(themes): stop SafetyFloor from duplicating the assistant button on the default theme#516
jaylfc merged 1 commit into
masterfrom
fix/safety-floor-duplicate-assistant

Conversation

@jaylfc
Copy link
Copy Markdown
Owner

@jaylfc jaylfc commented Jun 2, 2026

Problem

After the Theme Manager landed (#513), the default theme shows two taOS assistant buttons — the normal one top-left (in the TopBar) and a second one top-right. The second is the SafetyFloor escape-hatch button, which was rendering unconditionally.

Fix

SafetyFloor is meant to be a fallback that guarantees assistant access only when a theme hides the standard chrome. It now renders only when the active theme hides the top bar (structure.topBar?.variant === "hidden"), where the normal top-bar button would otherwise be lost.

  • Default / Matrix themes (structure: {}) → SafetyFloor renders nothing → single button top-left. ✅
  • A theme that hides the top bar → SafetyFloor appears top-right → assistant still reachable, honouring the requires: ["assistant"] safety contract. ✅

Tests

Extended safety-regression.test.tsx:

  • new: hidden on the default theme (no duplicate).
  • kept: present after a theme that hides everything.

Both pass; tsc --noEmit and npm run build clean.

Found during live smoke-testing on the Pi after updating to master.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the assistant escape hatch button to intelligently show/hide based on the active theme. The button now only appears when the top bar is hidden, reducing redundancy and improving the user interface contextually.
  • Tests

    • Enhanced test coverage to verify the escape hatch button visibility across different theme configurations.

…des the top bar

The SafetyFloor escape-hatch button rendered unconditionally, so on the
default theme (which already has the top-bar assistant button) a second
assistant button appeared top-right. Render it only when the active theme
hides the top bar (structure.topBar.variant === "hidden"), where the
standard button would otherwise be lost — preserving the requires:
["assistant"] safety contract without duplicating the control.

Adds a regression test for the default-theme case (button absent).
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e125c5f6-9e5d-49f7-be33-798ea48084c4

📥 Commits

Reviewing files that changed from the base of the PR and between 3f04596 and cf965d7.

📒 Files selected for processing (2)
  • desktop/src/components/SafetyFloor.tsx
  • desktop/src/theme/__tests__/safety-regression.test.tsx

📝 Walkthrough

Walkthrough

SafetyFloor transitions from always-rendered to conditionally rendered. The component now consults the active theme via useThemeStore, renders null when the top bar is visible, and only displays the fixed assistant escape-hatch button when the theme hides the top bar. Tests validate both the default case and a hostile theme scenario.

Changes

SafetyFloor Conditional Rendering

Layer / File(s) Summary
SafetyFloor conditional rendering based on theme visibility
desktop/src/components/SafetyFloor.tsx, desktop/src/theme/__tests__/safety-regression.test.tsx
SafetyFloor reads useThemeStore to detect whether the active theme hides the top bar; returns null if top bar is visible, otherwise mounts the assistant button. Tests use beforeEach/afterEach for isolation and verify the button absent on default theme and present after applying a theme that hides the top bar.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 A button hides when bars appear,
Theme-aware and crystal clear!
When top bar vanishes from sight,
Safety floor shines out bright. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: preventing SafetyFloor from rendering when it shouldn't and causing duplicate assistant buttons on the default theme.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/safety-floor-duplicate-assistant

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

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

@jaylfc jaylfc merged commit 3ec8ab6 into master Jun 2, 2026
7 of 8 checks passed
@jaylfc jaylfc deleted the fix/safety-floor-duplicate-assistant branch June 2, 2026 17:55
@github-project-automation github-project-automation Bot moved this from Todo to Done in TinyAgentOS Roadmap Jun 2, 2026
jaylfc added a commit that referenced this pull request Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant