Files
smart-compact/docs/devlog/20261116-smart-compact-status-overlay-panel-fanout-audit_log.md
T
AlexKucera ea51a574c1 feat(status): render state as centered overlay
Replace the /smart-compact notify() text with a ctx.ui.custom overlay
panel (the /dcp context look): usage bar, threshold rows with crossed
indicators, cycle flags, esc/enter/q/ctrl+c dismissal (keybindings-aware
with a raw kitty/legacy fallback set), and notify() fallback for
print/RPC mode.

Hardened by a fresh-context reviewer fanout (ponytail/security/general):
kitty explicit-modifier close forms added, render() now honors the
requested width exactly with a degenerate-narrow fallback, label width
simplified. Harness gains a ctx.ui.custom mock; 22 tests green.
2026-11-16 12:29:47 +01:00

5.3 KiB

/smart-compact status overlay panel + reviewer-fanout audit

Date: 2026-11-16 Type: generic Reference: None

Goal

Replace the /smart-compact status command's plain notify() output with a centered bordered overlay panel (the /dcp context look) — current tokens, usage bar, effective thresholds, cycle flags — then audit the session's diff with a fresh-context reviewer fanout (ponytail / security / general) and fix every accepted finding.

What Was Done

  • Overlay panel (index.ts): new StatusRow type, CLOSE_KEYS raw close-key set (legacy + Kitty CSI-u forms), and showStatusPanel() — a ctx.ui.custom component with a width-cached renderer (bordered box, dark 234-background slab, themed border, dim footer hint), invalidate() for theme changes, and handleInput close detection. Falls back to notify() where ctx.ui.custom is unavailable (print/RPC mode).
  • Command handler (index.ts): rows with label alignment, threshold-colored usage bar (24 cells, only when window is known), warn/force thresholds with crossed indicators and warning/error colors, cycle flags.
  • Tests (harness.ts): ctx.ui.custom mock in makeCtx (captures overlay options, instantiates component, resolves on done()); overlay-mode, bordered-width, close-keys (legacy + kitty), keybindings-remap preference, notify-fallback, and unknown-window tests.
  • Reviewer fanout (workflow 43c1076a, 3 fresh-context reviewers): security STRIDE clean; ponytail 1 finding; general 3 findings. All 4 accepted, 0 withdrawn, fixed in-session:
    • Added Kitty explicit-modifier close forms \x1b[13;1u (enter) and \x1b[113;1u (q) to CLOSE_KEYS + close-key loop test.
    • render() now honors the requested width exactly; widths < 6 (border+padding floor) degrade to plain truncated lines never wider than requested (was: Math.max(20, width) floor that violated the contract at narrow widths).
    • labelWidth replaced Math.max(...duplicated label list.map(...)) with "warned this cycle".length (longest label literal).
    • New tests: "overlay honors requested width, including degenerate narrow" and "render cache: same-width hit, width-change and invalidate rebuild".
  • README.md: command section updated for overlay + fallback behavior.
  • GitNexus: re-indexed after the changes (44 → 107 nodes, 141 edges).

Decisions & Rationale

Decision Rationale
Primary close detection via keybindings.matches("tui.select.cancel"/"confirm"), CLOSE_KEYS raw set as fallback matches() protocol-normalizes every Kitty form and honors user remaps; raw set covers hosts without keybindings. Reviewer-confirmed gap (explicit-modifier forms) fixed by adding encodings, not a protocol parser — smallest fix.
Truncate/pad rows as plain text before theming No ANSI-aware width math needed; panel content is single-width only.
Raw 256-color background (\x1b[48;5;234m) for the slab instead of a theme API Reads as a distinct panel on every shipped theme; no theme dependency for the background.
Render cache keyed by width + invalidate() on theme change Re-render is pure string assembly; cache avoids rebuild per frame, invalidate() rebuilds themed strings after theme switches.
Degenerate-width fallback (plain truncation below width 6) instead of a width floor render(width) must never emit lines wider than requested; below the border floor a bordered layout is impossible, so degrade content, not the contract.
Kept fanout results despite wrong model pin Reviewers ran on openai-codex/gpt-6.1-sol (from pi model output); user confirmed session model is zai/glm-5.3 and chose to keep the results. Correction saved to persistent memory.

Gotchas & Fixes

Problem Root Cause Fix
Reviewer children pinned to wrong model pi model CLI reported openai-codex/gpt-6.1-sol while settings.json says zai/glm-5.3 Trust settings.json over pi model when pinning children; memory saved
Kitty q/enter with explicit modifier (\x1b[113;1u, \x1b[13;1u) didn't close CLOSE_KEYS had \x1b[27;1u (esc) but not the enter/q modifier forms Added both forms
render(10) emitted 20-wide lines Math.max(20, width) floor overrode the requested width Honor width exactly; < 6 → plain truncated lines
showStatusPanel missing from GitNexus impact analysis Index predated the session's new symbols node .gitnexus/run.cjs analyze (44 → 107 nodes)

Files Changed

File Change Summary
index.ts Overlay panel (StatusRow, CLOSE_KEYS, showStatusPanel), status handler rows/usage bar, audit fixes
harness.ts ctx.ui.custom mock; 6 overlay tests pre-audit + 2 audit tests (width contract, cache/invalidate)
README.md Command section describes overlay + fallback
docs/devlog/ This log + INDEX.md row
_code_review/ (untracked) Materialized diffs + cumulative ledger for the fanout

Open Items & Next Steps

  • Optional: verification fanout round on zai/glm-5.3 (ledger at _code_review/ledger.md ready to paste as "already fixed")
  • Decide whether _code_review/ should be gitignored (currently untracked)
  • No CHANGELOG.md exists in this repo — skipped per commit skill

Log written by write-log skill