mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-06 06:18:40 +02:00
tab guardrail (50/200 thresholds) + sidebar action toast
Server side (browser-manager.ts):
Idempotent threshold tracker fires an activity entry exactly once at
each upward crossing of 50 (soft warn) and 200 (hard warn). Re-arms
when the count drops below. Activity-feed surface gives the
audit-trail invariant even with the sidebar closed; the toast UX
lives in the sidebar.
Sidebar side (extension/sidepanel.{html,css,js}):
Every /memory poll evaluates two trigger conditions:
- Any single tab > 4 GB JS heap (catches the WebGL/video runaway
case Codex flagged on the eng review).
- Tab count >= 200.
Toast shows top 5 tabs ranked by max(jsHeap, nodes*1KB + listeners*200)
so a WebGL-heavy tab with small JS heap still surfaces. Default-selected
checkboxes + "Close selected" run \`\$B closetab <id>\` through the
existing /command path — no chrome.tabs.remove bridge needed. "Snooze"
bumps tabsAbove/heapAbove thresholds in chrome.storage.session so the
toast stays hidden until the user accumulates more tabs OR one tab
grows another 2 GB.
Tests: browse/test/tab-guardrail.test.ts pins the server-side
fires-once + re-arms invariants without spinning up Chromium.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
78afd75e72
commit
50387c350c
@@ -159,6 +159,19 @@
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Tab guardrail toast (hidden until /memory poll trips a threshold) -->
|
||||
<div class="mem-toast" id="mem-toast" role="dialog" aria-label="Memory pressure warning" style="display:none">
|
||||
<div class="mem-toast-header">
|
||||
<strong id="mem-toast-title">High memory pressure</strong>
|
||||
<button class="mem-toast-close" id="mem-toast-close" aria-label="Dismiss">×</button>
|
||||
</div>
|
||||
<div class="mem-toast-body" id="mem-toast-body"></div>
|
||||
<div class="mem-toast-actions">
|
||||
<button class="mem-toast-btn primary" id="mem-toast-close-selected">Close selected</button>
|
||||
<button class="mem-toast-btn" id="mem-toast-snooze">Snooze</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer with connection + debug toggle -->
|
||||
<footer>
|
||||
<div class="footer-left">
|
||||
|
||||
Reference in New Issue
Block a user