Skip to content

feat(mod): hide the Ping button while an automatic ping fires before the cache expires - #773

Merged
amiddavid merged 8 commits into
mainfrom
feat/ping-button-when-needed
Oct 29, 2026
Merged

amiddavid merged 8 commits into
mainfrom
feat/ping-button-when-needed

Conversation

@amiddavid

@amiddavid amiddavid commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior change

  • Who: mod users (band and pane). Part 2 and 3 also reach users with keep-alive none and users whose thread the proxy stopped.
  • 1. The Ping button hides while an automatic ping fires before the cache expires. The band shows ↻ next ping m:ss in its place. Old: it showed whenever the cache was warm.
  • 2. The /ping slash command is removed. The Ping button and cg.py ping stay. Old: /context-guru:ping pressed the same ping from the prompt.
  • 3. After a miss, a refused ping or a route failure (stopped), the button shows while the cache is warm and the proxy still holds the request copy. Old: it was hidden.
  • 4. A press on a stopped thread re-checks the route breaker and the dead-credential mark (the checks the scheduled ping runs before it sends). While either holds, the button stays hidden and the band says ping off: upstream failing. When the mark clears, the button shows again.
  • 5. Text only: when the planned ping time has passed and no new plan came yet, the hint reads ↻ pinging… instead of 0:00. The button stays hidden.
  • How to turn it off: no option for any of the 5.
  • Decided by: the owner on 2026-10-29 (see below).

Data dependence

  • Metadata only. One new response field, next_ping_ms (a time). Nothing new is stored.
  • Off / metadata only / everything: no difference. The field comes from the keep-alive plan. It is absent when no ping is planned.
  • docs/data-dependence.md: one sentence added to the Keep-alive row.

Summary

The Ping button now shows only when no automatic ping keeps the cache warm.

What changed

  • dash/cachestate.go: next_ping_ms on the session and on each thread with a plan (omitempty, additive).
  • context-guru-plugin/hooks/model.ts: one rule, showPing, and one text helper, nextPingWords. Hide when pings_left > 0 && next_ping_ms > 0 && next_ping_ms < cache expiry. The expiry is the one the cache clock uses (remS).
  • register.tsx: the band and the pane both call these 2 helpers, so they cannot disagree.
  • An old proxy sends no next_ping_ms: the old rule applies (fail open).
  • pingable: false is unchanged: the ping off text wins.
  • The redraw check includes the new state.
  • Status line and cg.py ping: no change. They show no Ping hint.
  • /ping removed from register.tsx, install.sh, settings.py and comments.
  • Docs: docs/dashboard.md, docs/data-dependence.md.

Decided by the owner (2026-10-29)

  1. No override. Remove the /ping command. "no. and remove that command. too many commands to maintain is a nightmare." Removed from the mod, the install text and the comments. cg.py ping stays (both buttons call it).
  2. The pane follows the same rule as the band. One helper, used by both.
  3. stopped shows the button when the cache is about to expire. "the fact it was refused might not mean it will be refused again". A held copy is still required.
    • Before: the keeper reported a stopped thread as not pingable (stopped), and PingNow refused it.
    • Now: a stopped thread that still holds its copy is pingable, and a press works. After the keeper lets go of the copy, the reason is still stopped and the button stays hidden.
    • A stopped thread plans no automatic ping, so the rule shows the button.
    • Route and credential first. The owner chose "your recommendation": a press on a stopped thread refuses while the route breaker is tripped or the credential is marked dead. PingStates reports reason unavailable (the existing reason; the mod already words it as ping off: upstream failing). A miss-stopped or refused-ping-stopped thread still shows the button. Change: keepalive/manualhold.go (PingStates) and keepalive/manual.go (PingNow).

Small points fixed with it (owner, 2026-10-29)

  • The pane's ↻ next ping m:ss now counts each second, like the band.
  • A 409 "not held" carries ping_reason (the keeper's own, read at the press). cg.py ping prefers it over the cache-state copy, which can be 15 s old. The Codex copy of cg.py is updated.
  • The 59:59 width is covered by a test.

How it was tested

Run Result
claude plugin test on the mod, before the change 80 pass
claude plugin test on the mod, after 89 pass, 0 fail
Same tests on the old mod code 3 new tests fail (hidden case, hint text, 60-column row)
Mutation: flip < to > in the expiry check 4 tests fail
Mutation: drop the pings_left > 0 check 2 tests fail
Mutation: drop the nextPingS check in showPing 3 tests fail
Mutation: drop the next_ping_ms > 0 check 1 test fails
go test -race ./dash/... (box) ok, 505 s
go test -race ./context-guru-plugin ./keepalive/... (box) ok, 369 s and 84 s
go vet on those packages, gofmt -l clean
Go mutation: remove the NextPingMS assignment TestCacheStateShowsTheKeepAlivePlan fails
claude plugin test after commit 2 91 pass (includes: only context-guru is registered; stopped with a copy shows the button; stopped after release does not)
go test -race ./keepalive/..., ./context-guru-plugin after commit 2 (box) ok, 83 s and 374 s
Go mutation: put back e.stopped in PingNow, or the stopped case in PingStates 2 keepalive tests fail each time
go test -race ./keepalive/... ./context-guru-plugin ./dash/... after commit 4 (box) ok: 81 s, 357 s, 508 s
claude plugin test after commit 4 94 pass
claude plugin test after the small points 96 pass
go test -race ./keepalive/... ./proxy/... ./context-guru-plugin ./dash/... (box) ok
Mutations: remove the pane tick; remove the pinging… branch; remove ping_reason from the 409; make cg.py ignore it each fails its own test
Go mutations: drop the route check; drop the credential check; drop both each fails its own sub-test (route, credential, both)

Test cases: ping before expiry (hidden), none left, keep-alive off, next ping after expiry, next_ping_ms: 0, old proxy (all shown). Band and pane are checked together in each. Band row 1 fits 60 columns with the hint.

Known limits

  • The rule uses the proxy's plan at the last poll (15 s). A plan change shows at the next poll.
  • No live run. No plugin version bump.

Fixes #771

🤖 Generated with Claude Code

…the cache expires (#771)

The cachestate answer now carries next_ping_ms (metadata only). The band and
the pane use one rule, showPing: hide the button when pings_left > 0 and the
next ping fires before the cache expires. The band shows "next ping m:ss"
in its place. An old proxy that sends no next_ping_ms keeps the old rule.

Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…ead (#771)

- Remove the /ping slash command and its mentions. The Ping button and
  cg.py ping stay.
- A thread the keeper stopped (a miss, a refused ping, a route failure)
  keeps its copy until the hold ends. A press now works on it, and the
  server reports it pingable. After the keeper lets go, the reason is
  still "stopped".

Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 524b7da6f360 approve

Verdict: approve

Findings

None.

Non-blocking

  • context-guru-plugin/hooks/register.tsx:519 — the pane's ↻ next ping m:ss does not tick. The pane render never reads tick, so only the band redraws once a second (register.tsx:316). The pane refreshes its countdown only when the snapshot or paneData changes, about once a minute. The band is right; the pane can lag up to ~60 s. The pane already shows coarse times ("about 4m left"), so this is a small mismatch, not wrong data.
  • keepalive/manual.go:88 — a press on a thread stopped for a tripped route or a dead credential now sends. The sweep stops a thread when the route breaker trips or the credential is marked dead (keeper.go:1198-1201). PingNow does not re-check either, so a press sends one request on a failing route. It is bounded: one request, the 30-second gap, the cost ceiling, and the user sees the failure toast. The PR names this behavior ("the refusal may not repeat"), so I read it as accepted.
  • context-guru-plugin/hooks/register.test.tsx:174 — no plan test case sets held_until_ms. A real document always carries held_until_ms together with pings_left. The rule's key choice — compare next_ping_ms against the entry's own expiry (remS), not the plan horizon — is only pinned without the horizon present. One extra case with both fields would lock it in.

What I checked

  • Read the full diff of both commits and the code around every change: model.ts, register.tsx, register.test.tsx, dash/cachestate.go, keepalive/manual.go, keepalive/manualhold.go, and their tests.
  • Traced the hiding rule end to end. Plans (keeper.go:1886) excludes stopped entries and manual-only holds, so a stopped or manual-hold thread sends no next_ping_ms and the button shows. nextPingIn compares the next ping against the entry's own expiry, which is the right bound: a ping that fires after it misses, and a press would miss the same way.
  • Checked fail-open on old data: an old proxy sends no next_ping_ms, nextPingIn returns undefined, and the old rule (button shows) applies. next_ping_ms: 0 and pings_left: 0 also fail open to the button.
  • Checked the redraw chain: the anchor now includes pings_left and next_ping_ms, so a plan change replaces the stored clock; signature includes the hint's presence; ticked redraws the band once a second whenever nextPingS is defined (a defined nextPingS implies a defined cacheClock, so the tick fires).
  • Traced the stopped-thread change. PingStates reports a held stopped entry as pingable; after the sweep or the hard timer releases it, the reason map answers stopped and the button hides. A press that reads moves startedAt, which delays only the sweep's eager release; the one-shot hard timer (K+1) x Idle (keeper.go:920) still bounds how long the body and credential are held. A press cannot revive the schedule (due requires !e.stopped).
  • Checked the /ping removal: no leftover references in the mod, the install text, settings.py, or the skills. cg.py ping stays and serves the button.
  • Checked the docs and process rules: docs/dashboard.md and docs/data-dependence.md match the new behavior; the PR names the three behavior changes at the top with the owner's decision and the data-dependence statement.
  • Did not run tests (not approved). The PR's test table covers the mod, dash, and keepalive runs on the box, plus mutation checks on the new conditions.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 524b7da6f360 approve

Verdict: approve

Findings

None blocking. I traced every changed line and could not prove a wrong behavior. See Non-blocking for the edges I did find.

Non-blocking

  1. keepalive/manual.go:80 — a press does not re-check the route breaker or the dead-credential mark. The scheduled path checks both again right before it sends (keepalive/keeper.go:1205-1208), because they can trip while an entry sits idle. The press path (PingNow) now runs on a stopped entry, and "stopped" is often exactly a tripped route or a dead credential. So a press can send one ping into a route the keeper itself marked failing. The press fails cleanly (UpstreamError, no breaker effect, no stop), and the 30-second gap plus the per-ping ceiling bound the cost. Worth a guard in a later PR, not a merge blocker.
  2. proxy/manualping.go:132 — a 409 "not held" carries no ping_reason, so a press that races the release of a stopped thread's copy can toast a wrong reason. The keeper releases a stopped entry at startedAt + Idle (240 s), while the cache stays warm to refresh + ttl (300 s). In that tail the button can still show from a poll up to 15 s old. A press then gets 409 "not held"; cg.py ping reads the reason from the shared cachestate cache, which serves a copy up to 10 s old (CACHESTATE_TTL_SECONDS), still says pingable: true, so the toast falls back to "keep-alive is off for this account" — false. The same race existed before this PR for "pings used" threads, so I do not count it as new. The next poll corrects the button.
  3. context-guru-plugin/hooks/model.ts:128 — after a planned ping's moment passes, the band shows ↻ next ping 0:00 with the button hidden until the next poll (up to 15 s) brings the new plan. The PR names this as a known limit. Cosmetic.
  4. context-guru-plugin/hooks/register.tsx:349 — the 60-column row fit is tested with a ~100 s hint (↻ ping 1:40). A 1-hour-tier plan can show ↻ ping 59:59, one character wider. Row 1 can then wrap at exactly 60 columns. flexWrap handles the wrap, so nothing breaks.

What I checked

  • Read the full diff of both commits (16 files) and the code around each hunk: model.ts, register.tsx, register.test.tsx, dash/cachestate.go, keepalive/manual.go, keepalive/manualhold.go, and their tests.
  • Traced next_ping_ms end to end: Keeper.Plans → proxy/keepalive.go (KeepAlivePlans) → dash.KeepAlivePlan → CacheState/ThreadCache → cg.py cachestate → the mod. Both dash loops (threads and session level) read the same plan key ("" = main thread), so the two fields cannot disagree.
  • Checked the mod's rule nextPingIn against all six plan cases in the new tests, including the old-proxy and next_ping_ms: 0 fail-open cases. Units are right: at and now in ms, rem in seconds.
  • Checked the per-second redraw: ticked bumps the tick while cacheClock is defined, and a defined nextPingS implies a defined cacheClock, so the ↻ next ping m:ss countdown counts. The signature and anchor changes force a snapshot update when the plan appears, changes or disappears.
  • Checked mainEntry: pings_left and next_ping_ms come from the main thread or the session entry, which the dash fills from the same plan, so the merge cannot keep a stale plan.
  • Verified that keep-alive pings that read the cache move the thread's last_ts in the dash DB (withKeepAlive includes ping rows in cacheThreadsQuery), so the mod's remS advances with the plan. Without this, the button would show while a ping is planned.
  • Checked the stopped-thread change: Plans excludes stopped entries, so a stopped thread sends no next_ping_ms and the button shows; PingStates marks a live stopped entry Pingable; after the sweep releases it, k.reasons gives stopped and the button hides. The hard deadline (MaxPings+1) × Idle, set at record time and not moved by a press, bounds how long presses can keep a stopped entry's body and credential held.
  • Checked that the removed /ping slash command leaves nothing behind: no doc, skill, or code reference remains; the cg.py ping helper subcommand stays (both buttons call it) and the command.run handler for it is gone with its registration.
  • Checked the behavior-change rules in CLAUDE.md: the PR names all three behavior changes at the top, says who they affect, old and new behavior, and cites the owner's decision of 2026-10-29 with the owner's own words. docs/data-dependence.md gains the one-sentence metadata note for next_ping_ms; nothing new is stored.
  • Did not run Go builds or tests (not approved for this review). The PR reports go test -race on ./dash/..., ./keepalive/... and ./context-guru-plugin on the box, plus mod tests, all passing.

amiddavid and others added 2 commits October 29, 2026 16:27
…59:59 hint width (#771)

Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
One conflict, in docs/data-dependence.md: #770 added the session state row
next to the Keep-alive row. Both changes stay.

Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Merged origin/main into this branch (merge commit, the reviewed commits stay).

amiddavid and others added 4 commits October 29, 2026 19:54
…credential first (#771)

The scheduled ping checks the route breaker and the dead-credential mark right
before it sends. A press on a stopped thread now runs the same two checks. If
either holds, the press is refused and the thread is reported not pingable,
reason "unavailable", so the button stays hidden. When the mark clears, the
thread is pingable again while its copy is held. A thread stopped by a miss or
a refused ping is not blocked.

Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
…show "pinging" at 0:00 (#771)

- The pane reads the band's tick, so its "next ping m:ss" counts each second.
- A 409 "not held" now carries ping_reason (the keeper's own, read at the
  press). cg.py ping prefers it over the cache-state copy, which can be 15 s old.
- When the planned ping time has passed and no new plan came, the hint reads
  "pinging…" instead of 0:00. The button stays hidden.

Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 32ae313fa860 approve

Verdict: approve

Findings

None blocking. Every fix commit is correct, and I could not prove a wrong behavior in the new code. One new non-blocking note below.

Earlier findings

Mine (round 1):

  1. A press does not re-check the route breaker or the dead-credential mark — fixed by 0bfa968. stoppedAndBlockedLocked (keepalive/manualhold.go:170) runs the same two checks the sweep runs, in both PingStates and PingNow, under k.mu. A blocked thread answers unavailable, so the button hides and the toast says why. I checked the empty-credential case: credIsDeadLocked returns false for "" (keepalive/breaker.go:92), so a server-held key is never blocked. A miss- or refusal-stopped thread stays pressable, pinned by the new test.
  2. A 409 "not held" with no ping_reason can toast a wrong reason — fixed by aa0f82f. The proxy now reads the keeper's own reason at the press (proxy/manualping.go:138-140), and cg.py ping prefers the 409 body's reason over the cachestate copy, which can be 10 s old. The new TestPingPrefersTheReasonInThe409 pins the preference with a fake server that disagrees with the cache.
  3. ↻ next ping 0:00 after the planned time passes — fixed by aa0f82f. nextPingWords returns ↻ pinging… when nextPingS < 1, and the button stays hidden. The narrow and wide band and the pane are all pinned by the new test.
  4. The 60-column fit was untested for the 59:5x hint — fixed by 3bcb805. The new case uses the 1-hour tier (ttl_s: 3600, ping at +3,599 s) and asserts the row still fits 56 columns with ↻ ping 59:5x.

Reviewer 2 (round 1), checked myself:

  1. The pane's hint does not tick — fixed by aa0f82f (register.tsx:472, the pane render reads tick), pinned by 41b8a6c's test that keeps the pane mounted across one tick. See my new non-blocking note for the one case it does not cover.
  2. Press on a tripped-route or dead-credential thread — fixed, same commit as my finding 1.
  3. No plan test case with held_until_ms set — fixed by 3bcb805. The new case (held_until_ms: NOW + 3_600_000, ping after the entry's own expiry) pins that the rule uses remS, not the plan horizon.

The author rejected nothing.

Non-blocking

  • context-guru-plugin/hooks/register.tsx:139 — the pane's ↻ next ping m:ss freezes while the band is hidden. ticked returns early when isHidden is set, so the tick atom stops bumping, and the pane (which now reads tick) re-renders only when the snapshot signature changes — at best once a minute, when the coarse left word moves. The user must hide the band and keep the pane open to see it. The button state itself stays correct: it follows the poll, not the tick. Cosmetic.
  • keepalive/manualhold.go:170 — stoppedAndBlockedLocked guards only stopped entries. A live, not-yet-stopped entry on a route that just tripped stays pressable until the next sweep marks it stopped. That window is one sweep, the failure is clean, and the state before this PR was the same for every entry. Residual of the fix, not a regression.

What I checked

  • Last review: round 1, 524b7da, 2026-10-29T14:26:16Z.
  • New commits read: 6 — 3bcb805 (test: held_until case, 59:5x width), bf8a9c3 (merge of origin/main), 0bfa968 (press checks route and credential), aa0f82f (pane tick, 409 reason, "pinging…"), 41b8a6c (test tweaks), 32ae313 (codex cg.py copy). 8cc5b84 is main's own #770, which the merge brought in; I did not re-review it here.
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from .review-in-reviews.txt, .review-in-comments.txt, .review-in-inline.txt).
  • New items since my last review, and what I did about them:
    • Reviewer 2's round-1 review (posted before mine, unread in round 1 by rule): read it, checked each of its three non-blocking notes myself, confirmed all three are fixed.
    • The author's merge comment: verified its claims. git diff of the merge against each parent shows the merge kept both sides whole; the only hand-resolved file is docs/data-dependence.md, where the #770 row and this PR's next_ping_ms sentence both stay. Nothing else changed in the merge.
    • The six commits above: read every changed line and the code around it.
  • Checked stoppedAndBlockedLocked for lock discipline (called under k.mu in both callers, plain map reads inside) and for the empty-credential and manual-only cases (both can never be blocked).
  • Checked the 409 reason end to end: PingStates(...).For(thread) uses the same tenant and scoped session as the PingNow key; a nil keeper or an empty reason degrades to the old body without ping_reason, and cg.py then falls back to the cachestate copy. PingStateMap.For is nil-map safe.
  • Checked the pane tick fix: the pane render reads tick, so it re-renders on the band's once-a-second bump; the test keeps the pane mounted across one tick and sees the hint change. Found the hidden-band gap noted above.
  • Checked the new tests for what they pin: the plan case with held_until_ms (mutation target: using untilColdS instead of remS), the 59:5x row width at 60 columns, the "pinging…" text in band and pane, the unavailable round trip (hide, then show again after the mark clears, through a mutated poll document), and the 409-reason preference in both the Go helper test and the proxy test.
  • Checked the codex copy: codex-marketplace/plugins/context-guru/scripts/cg.py is byte-identical to context-guru-plugin/scripts/cg.py after 32ae313.
  • Did not run Go builds or tests (not approved). The author reports mod tests 93 pass and go test -race on ./keepalive/... and ./context-guru-plugin ok on the box after each fix.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (glm, user of @amiddavid) GLM rits/zai-org/glm-5-3 via Claude Code 2.1.312 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 32ae313fa860 approve

Verdict: approve

Findings

None.

Earlier findings, all fixed

  • Mine, pane does not tick (register.tsx pane render): fixed in aa0f82f. The pane now reads tick (register.tsx:472), and 41b8a6c strengthens the test to one mount that redraws on the tick, not a re-mount.
  • Mine and reviewer 1's, a press on a thread stopped for a tripped route or a dead credential sends: fixed in 0bfa968. stoppedAndBlockedLocked (keepalive/manualhold.go:170) runs the same two checks the sweep runs, in both PingNow (refuses with ErrNotHeld) and PingStates (reason unavailable, so the button hides and the band says ping off: upstream failing). A miss-stopped or refused-ping-stopped thread stays pingable. Both call sites hold k.mu, which the breaker helpers require. Tests cover route, credential, both cleared, and miss-stopped.
  • Mine, no plan test case with held_until_ms: fixed in 3bcb805. The new case pins the choice to the entry's own expiry, not the plan horizon.
  • Reviewer 1's, a 409 "not held" carries no ping_reason so the toast can lie: fixed in aa0f82f. I checked it myself. proxy/manualping.go:140 reads the keeper's own reason at the press, with the same tenant, session and thread the press used. cg.py ping prefers it over the cache-state copy, and the copy in the Codex plugin is synced (byte-identical; TestCGScriptsAreVendoredIntoCodex enforces it). The fallback chain stays sound: the server's own reason, then the cached copy, then none.
  • Reviewer 1's, 0:00 after the planned time passes: fixed in aa0f82f. nextPingWords returns ↻ pinging… below one second, and the button stays hidden. Tested in band and pane.
  • Reviewer 1's, the 60-column row was not tested at 59:59: fixed in 3bcb805. The test pins the 1-hour-tier hint width at 60 columns.
  • No earlier finding was rejected by the author.

Non-blocking

  • context-guru-plugin/hooks/register.tsx:140 — with the band hidden, the pane's ↻ next ping still does not tick. ticked returns early when isHidden is set, so no tick reaches the pane. The pane then refreshes its countdown only from snapshot or paneData changes, about once a minute. Edge case: the band is hidden while the pane is open. The value shown is correct at render time and self-corrects.
  • context-guru-plugin/hooks/model.ts:145 — ↻ pinging… can appear up to one second early. The branch is s < 1, so a hint at 0.6 s reads pinging… before the planned moment. Cosmetic.

What I checked

  • Last review: round 1, 524b7da, 2026-10-29T14:25:03Z.
  • New commits read: 6 — 3bcb805 (test: held_until_ms case, 59:59 width), bf8a9c3 (merge of origin/main), 0bfa968 (route and credential guard on a stopped-thread press), aa0f82f (pane tick, 409 ping_reason, pinging…), 41b8a6c (test: same-mount pane tick, 409 test alignment), 32ae313 (sync cg.py to the Codex plugin).
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files).
  • New items since my last review: the author's merge comment (14:36) — verified the merge resolution: git show bf8a9c3e --stat lists only #770's files plus the docs/data-dependence.md conflict, and both rows (Session state table, Keep-alive pings) are present and correct in the merged file. The updated PR body — verified it names behavior changes 4 and 5 at the top with the owner's decision, and reports go test -race on ./keepalive/..., ./proxy/..., ./context-guru-plugin, ./dash/... plus 96 mod tests and mutation checks.
  • Traced the route/credential guard: stoppedAndBlockedLocked requires e.stopped, so a live entry with a tripped route is untouched (the sweep stops it, then the guard applies). Manual-only entries are never stopped, so the manual hold is unaffected.
  • Traced the 409 reason end to end: PingNow's three ErrNotHeld causes each have a matching reason in PingStates at the same moment — manualExpired gives expired, stopped-and-blocked gives unavailable, a released entry gives its recorded reason, and an unknown thread gives no entry. For() never returns an empty reason, so the st.Reason != "" gate always passes and the client always gets a reason.
  • Checked cg.py's new precedence: the server's own ping_reason first, the cached copy only when the server sent none, and the fixture path unchanged. The JSON merge order keeps the resolved reason on top of the raw document.
  • Checked the pinging… rule against the hiding rule: showPing still requires nextPingS === undefined, so the button stays hidden while the hint shows pinging….
  • Did not run tests (not approved). The PR body's test table covers the new code on the box, with mutation checks on each new condition.

@amiddavid
amiddavid merged commit 85919a8 into main Oct 29, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 29, 2026
amiddavid added a commit that referenced this pull request Oct 29, 2026
Main moved ahead through #773 (the mod's Ping-button change), which
conflicted with this branch in one place: docs/data-dependence.md, where
#773 grew the keep-alive row next to the row this branch edits.

The resolution keeps both: main's keep-alive row (the sentence about the
cache-state answer carrying the next planned ping) and this branch's
session-state row (an eviction or an archive can end a row before its 30
days). Nothing else was changed; every other file merged cleanly.

No behavior change: the merge only combines docs text and already-merged
main code.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
amiddavid added a commit that referenced this pull request Oct 29, 2026
fix(dash): session-state follow-ups from #770

Five follow-ups from the session-state change (#770), none blocking:

1. The janitor's "could not archive, so delete" branch now has a test
   (TestEvictFallbackDeletesSessionAndAliasState), mutation-checked.
2. Deleting or archiving a session now removes the state rows under its
   content-derived alias too (cg:seen:, cg:ttl: are keyed by the alias), so
   they no longer outlive the session until the 30-day retention. An alias
   another live session still uses — by its session_alias column or by a
   headerless session whose own id IS the alias — is kept.
3. DropOldestSessions picks its victims once and removes exactly that set.
   The delete used to re-run the ordering subquery itself, so a request
   landing between the pick and the delete could change the order, and the
   state cleanup then acted on a set other than the one deleted.
4. DeleteSessionState checks rows.Err(): a scan that fails midway now
   returns the error instead of silently deleting less.
5. docs/data-dependence.md: extract_llm_sweep removed from "Rows to
   confirm"; both confirmations are recorded on #770.

Data dependence: no change (this deletes more, it stores nothing new).
Behavior change: none that a user sees, apart from fewer leftover rows.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
fix(dash): state cleanup on every session-delete path (#775 review)

Both round-1 reviews on #775 were blocking; this answers them.

1. A victim's own id gets the same in-use guard as its aliases. A
   headerless session (its session_id IS an alias) evicted while the
   header session sharing that alias is live used to lose cg:seen: and
   cg:ttl: that the live session still reads. Now both halves are checked
   before any state key goes: rows carrying it as session_alias, or a
   live session whose own id IS it.
2. DropOldestSessionsOfTenant deletes state with the rows, through the
   same guard. The tenant row-quota trim was the one session-delete path
   that left state behind.
3. The in-use check is no longer one full-table scan per alias on the
   writer goroutine. idx_requests_session_alias is added on open (old
   databases get it too, like idx_requests_project), and one pass answers
   all its in-use checks with TWO queries over the whole key list, not
   one query per key.
4. Every IN (...) list is bound in batches of 500 ids: the disk rule can
   ask for a tenth of all sessions at once, past SQLite's 32,766-variable
   statement limit.
5. A failed victim pick or alias read now returns its error instead of
   reading as "nothing left to evict", and stateRowsFor-style checks match
   exact keys. docs/data-dependence.md says an eviction or an archive can
   end a state row before its 30 days.

Data dependence: no change (this deletes more, it stores nothing new).
Behavior change: none that a user sees, apart from fewer leftover rows.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
merge: origin/main into chore/session-state-followups

Main moved ahead through #773 (the mod's Ping-button change), which
conflicted with this branch in one place: docs/data-dependence.md, where
#773 grew the keep-alive row next to the row this branch edits.

The resolution keeps both: main's keep-alive row (the sentence about the
cache-state answer carrying the next planned ping) and this branch's
session-state row (an eviction or an archive can end a row before its 30
days). Nothing else was changed; every other file merged cleanly.

No behavior change: the merge only combines docs text and already-merged
main code.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
fix(dash): an unreadable in-use answer keeps all state (#775 round 2)

Both round-2 reviews blocked on one finding: inUseIDs closed its rows
without checking rows.Err(), and skipped a failed Scan silently. A scan
that fails midway ends the loop early, so the keys it did not reach read
as unused, and deleteSessionState then deleted state a live session
still reads — the unsafe direction, and the one the function's own
contract forbids.

Both failure modes now take the same path as a query that fails to
open: log once, mark every key in use, return. Two fake-driver tests
cover them; each fails at 434b232 and catches its own mutation.

Also: DropOldestSessions' comment no longer says "one statement, so one
transaction" — the delete is chunked, and a failed chunk returns before
the state cleanup, so earlier chunks' victims keep their state until
retention (the safe direction).

Left as is, said on the PR: the age-rule archiver runs on its own
goroutine, so its delete can interleave with the janitor's in-use count.
That window is old, self-healing within one turn, and state cleanup is
best-effort by contract.

Data dependence: no change (this deletes less on a failure, it stores
nothing new). Behavior change: none that a user sees.

Written by GLM (rits/zai-org/glm-5-3) through Claude Code

Assisted-By: GLM
Signed-off-by: DAVID AMID <[email protected]>
amiddavid added a commit that referenced this pull request Oct 30, 2026
…0.2.8) (#780)

chore(plugin): bump the plugins for v0.6.4 (Claude Code 0.6.4, Codex 0.2.8)

Both plugins changed since v0.6.3.

- Claude Code plugin: 0.6.3 to 0.6.4. The Ping button hides while an
  automatic ping fires before the cache expires, and the /ping command
  is removed (#773).
- Codex plugin: 0.2.7 to 0.2.8. Its vendored cg.py changed in #773
  (the 409 reason for a refused ping).

Assisted-By: Claude Opus 5.5 (1M context)
Signed-off-by: DAVID AMID <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Ping button: show it only when no automatic ping is scheduled before the cache expires

1 participant