Pinky W: cheap poll cycles — response cache, delta memo, visibility pause (v1.27.0) #53

Merged
ClaudiuSchuster merged 1 commit from oss-oo/pinky-w-cpu into main 2026-09-26 08:29:19 +00:00
Owner

Owner top blocker: one open dashboard pegged a core (~170 % CPU, station 90–95 °C). Three layers, semantics untouched.

R1 — response cache: both poll endpoints serve cached bodies behind a change key over EVERY source (DB stat incl. -wal/-shm + data_version probe, tasks index, ledgers, contract, questions side-channel, state file, provider config, live /proc digests). Any source mutation rebuilds on the NEXT poll; TTL 8 s refreshes time-derived fields; ONE fetch per cycle shared by both endpoints; ZDO_CACHE=0 opts out.

R2 — hot-path memo: per-session facts keyed on session.time_updated (flushes with parts/turns — verified live 2026-09-26), re-derived only for changed/new/hot sessions; doorbell scan rowid-incremental. Measured on the station snapshot (340 sessions, 164k parts): idle rebuild 45 ms vs 2189 ms before; old-vs-new payloads IDENTICAL (normalized diff).

R3 — visibility governor: hidden tab pauses main/drawer/modal/dock timers; visible re-arms + immediate refresh. Default cadence unchanged (3000 ms).

Evidence: 67/67 unittests (15 new, one per source class incl. second-writer inserts, running→terminal + webhook-once, tasks flip, ledger rewrites, TTL, dedupe, busy-raises-not-stale, doorbell memo pickup); Super-Linter green (BASH/BASH_EXEC/MARKDOWN/PYTHON_PYLINT/PYTHON_RUFF/YAML); fixture rig E2E PASS: new session + running→terminal each visible in ~1.03 s (≤ 2 cycles budget 8 s), cache-hit bytes identical, CDP probes green (table, usage SVG, drawer + steer console, R3 pause/resume in the live page). Live G1/G2 measurements run after merge+install (dossier follows).

Owner top blocker: one open dashboard pegged a core (~170 % CPU, station 90–95 °C). Three layers, semantics untouched. **R1 — response cache**: both poll endpoints serve cached bodies behind a change key over EVERY source (DB stat incl. -wal/-shm + data_version probe, tasks index, ledgers, contract, questions side-channel, state file, provider config, live /proc digests). Any source mutation rebuilds on the NEXT poll; TTL 8 s refreshes time-derived fields; ONE fetch per cycle shared by both endpoints; ZDO_CACHE=0 opts out. **R2 — hot-path memo**: per-session facts keyed on session.time_updated (flushes with parts/turns — verified live 2026-09-26), re-derived only for changed/new/hot sessions; doorbell scan rowid-incremental. Measured on the station snapshot (340 sessions, 164k parts): idle rebuild 45 ms vs 2189 ms before; old-vs-new payloads IDENTICAL (normalized diff). **R3 — visibility governor**: hidden tab pauses main/drawer/modal/dock timers; visible re-arms + immediate refresh. Default cadence unchanged (3000 ms). Evidence: 67/67 unittests (15 new, one per source class incl. second-writer inserts, running→terminal + webhook-once, tasks flip, ledger rewrites, TTL, dedupe, busy-raises-not-stale, doorbell memo pickup); Super-Linter green (BASH/BASH_EXEC/MARKDOWN/PYTHON_PYLINT/PYTHON_RUFF/YAML); fixture rig E2E PASS: new session + running→terminal each visible in ~1.03 s (≤ 2 cycles budget 8 s), cache-hit bytes identical, CDP probes green (table, usage SVG, drawer + steer console, R3 pause/resume in the live page). Live G1/G2 measurements run after merge+install (dossier follows).
Pinky W: cheap poll cycles — response cache, delta memo, visibility pause (v1.27.0)
All checks were successful
Checks / Functional checks (pull_request) Successful in 18s
8e5564feb8
The dashboard's 3 s poll recomputed the full station scan twice per
cycle (~4.4 s CPU per 3 s ≈ 170 % of one core with one tab open).
Three layers, semantics untouched:

- Response cache (R1): /api/sessions and /api/usage serve byte-identical
  cached bodies while a change key over EVERY source is stable — session
  DB + tasks index (stat incl. -wal/-shm + PRAGMA data_version probe),
  dispatcher ledgers (bells/queue/dispatches/contract), questions
  side-channel, observatory state, provider config, live /proc digests
  (spawn linkage, cwd locks, in-flight steers). Any mutation rebuilds on
  the next poll; a TTL (ZDO_CACHE_TTL_S, 8 s) refreshes time-derived
  fields; both endpoints share ONE fetch per cycle; ZDO_CACHE=0 opts
  out. Invalidated per source class in tests/test_poll_cache.py (15
  tests: second-writer inserts, running→terminal + webhook-once, tasks
  archive flip, ledger rewrites, contract, state, questions dir, live
  digest, TTL, dedupe, busy-raises-not-stale, doorbell memo pickup).
- Hot-path memo (R2): per-session facts (context, pending questions,
  activity, hydration, models) keyed on session.time_updated (flushes
  together with parts/turns — verified live), re-derived only for
  changed/new/hot sessions; doorbell lineage scan rowid-incremental.
  Idle rebuild 45 ms (was 2189 ms measured on the station snapshot);
  old-vs-new payloads proven identical.
- Visibility governor (R3): a hidden tab pauses the main/drawer/modal/
  dock timers, visible re-arms + one immediate refresh (CDP-verified in
  the live page). Default cadence stays 3000 ms.

Also: SERVER_VERSION v1.27.0 marker in the startup line and the
sessions payload; README section + env knobs documented.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
OSS-Singularity/zcode-dispatch-observatory!53
No description provided.