feat(web): surface remaining context-window utilization - #4
Merged
Conversation
Two surfaces, both fed from SessionUsage.lastTurnInputTokens against
the daemon's Session.CONTEXT_WINDOW constant (1_000_000 today):
- StatusBar: compact `ctx N%` pill, color-cued green/warn/danger.
Hover shows the raw `tokens / window (xx.x%)`.
- SessionHeader UsageStrip: a dedicated "Context" tile leading the
row, with a thin progress bar showing headroom at a glance. Grid
grows from 7 to 8 columns so the existing tiles stay readable.
If the daemon ever emits per-session context_window on the wire (today
it's a hardcoded constant), swap the client constant for that field —
no other code change needed. Bundle / tests unchanged.
saucam
added a commit
that referenced
this pull request
Jun 14, 2026
…scaling) (#12) Adversarially-verified high-severity findings from a full-codebase audit. (The scarier "stuck-status" race claims were refuted on verification and are not touched here.) #1 Dropped message after interrupt-then-fast-send (session.ts). The consumer `finally` nulled #inputQueue/#consumerTask without the identity guard it already used for #query/#abortController, so an un-awaited interrupt() + a fast send() let the stale loop clobber the new loop's queue/task and the next push was silently dropped. Capture a loop-local queue/task snapshot and guard the nulls by identity. #2 Token never re-verified after handshake (auth.ts/server.ts/types.ts). An open socket honored an expired/revoked token forever. Carry `exp` into AuthContext, reject missing/expired exp in verifyToken (60s skew), and close 4003 on a per-message expiry check. (Instant revocation of a still -valid token still needs a periodic re-verify — tracked separately.) #3 Web reconnect replayed the dead JWT forever (ws.ts/connection.ts). Add a getToken() supplier called on every (re)connect open that re-exchanges the stored zid_sk_ key for a fresh JWT; fall back to the last token if none. +2 tests. #4 Vector recall had no cache despite the comment (memory/store.ts). Every recall re-read + re-decoded all embeddings and brute-forced cosine. Memoize the decoded matrix per workspace; invalidate on insert-with -embedding / setEmbedding. #5 Memory init was all-or-nothing (engine.ts). An embedder download hiccup nulled the whole engine, also killing FTS recall + usage persistence. Wrap embedder.init() in try/catch and run FTS-only (vector signal off) on failure; recall and the embed pump guard on the ready flag. #6 Unbounded session resume blocked startup (session-manager.ts, issue #6). Sort newest-first, cap to RESUME_MAX_SESSIONS, time-box to RESUME_DEADLINE_MS, and log what was left on disk. Typecheck clean; 554 daemon tests + 95 web tests pass; build OK; live smoke (auth+exp accepted, session.list) verified against the dev daemon. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
saucam
added a commit
that referenced
this pull request
Jul 16, 2026
…abel (#188) Settings follow-ups (originally scoped as #2 + #4 + #5): - #4 web: `/settings` (aliases `/config`, `/prefs`) opens the settings drawer, mirroring `/agents` etc. Wired through @codeoid/core slash → PromptBox showSettings → openSettings; added to the HelpModal catalog + slash tests. - #5 telegram: a read-only `/settings` command that summarizes the current NON-default configuration (secret VALUES never shown — only which are set) plus the config.json/.env paths for editing. Reads the store in-process. - #2: on inspection, the "hot" env knobs (context-strategy, seed-budget, codex approval/sandbox) already hot-apply to new sessions/turns via live process.env, so promoting them into config.json would make them restart-only — a regression. Kept env-backed; fixed the one real bug: the codex approval/sandbox policies were mislabeled `restart` in the manifest when they hot-apply → `next-session`. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two daemon-fed surfaces: status bar pill + UsageStrip tile with progress bar. Numbers from SessionUsage.lastTurnInputTokens against Session.CONTEXT_WINDOW = 1_000_000.