Skip to content

fix(plugin): tell the truth about unsupported pings and keep band row 1 on one line - #698

Merged
OsherElhadad merged 3 commits into
mainfrom
fix/band-ping-reason
Oct 25, 2026
Merged

OsherElhadad merged 3 commits into
mainfrom
fix/band-ping-reason

Conversation

@OsherElhadad

Copy link
Copy Markdown
Collaborator

Summary

Four small fixes to the band and pane from #694. A live test found them. Part of #687.

Data dependence: none. Display only. No new reads, no new stored data.

What we found

  • The server sets the ping reason unsupported for extended thinking, which real Claude Code sends. It also sets it for gateway routes. The band said ping off: not on this route. That is false for most users.
  • At 60 columns, row 1 of the band wrapped when a ping-off reason showed. The fit test did not count the band padding or the terminal margin.
  • The pane showed $x lost today twice: under CACHE HITS and under MISSES BY HOUR.
  • The band can wait for a slow first cache-state document. Five seconds of retries was too short.

What changed

  • unsupported reads ping off: not supported in the band. The pane and the toast read "Ping can't hold this session (extended thinking, or a gateway route)". model.ts, both cg.py copies, tests and docs agree.
  • Below 80 columns the band shows only ping off, with no reason.
  • $x lost today shows once, under CACHE HITS.
  • The first-document retry runs 12 times, 1.5 s apart (about 15 s). The reads are local (cg.py, the on-disk cache).
  • No version bump. 0.6.0 is not released.

How it was tested

  • claude plugin validate .: passed.
  • claude plugin test .: 66 pass, 0 fail.
    • New: row 1 fits width minus 4 at 60 columns for every reason code, warm and cold, and shows only ping off below 80 columns.
    • New: $x lost today shows once, under CACHE HITS.
    • New: a first document that arrives about 9 s in shows in the band before the 15 s poll.
  • go test ./context-guru-plugin/... with a private TMPDIR and CLAUDE_* and ANTHROPIC_* unset: ok, 358 s.
  • python3 -m unittest test_tv test_costly: OK.
  • I did not run this in a real Claude Code session.

🤖 Generated with Claude Code

… 1 on one line

- Reword the `unsupported` ping reason. The server also sets it for
  extended thinking, so "not on this route" was false for most users.
- Below 80 columns the band shows only `ping off`, and a test checks
  the row against width minus 4 for every reason, warm and cold.
- Show `$x lost today` once in the pane, under CACHE HITS.
- Retry the first cache-state read for about 15 s, not 5 s.

Part of #687

Assisted-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Osher Elhadad <[email protected]>

@OsherElhadad OsherElhadad 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 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session fresh 2 of 2 1 of 2 db3df73e8ea2 approve

Verdict: approve

Findings

None.

Non-blocking

  • cg.py:1393 (both copies) — the "gateway route" text is narrower than the server rule. keepalive/keeper.go:754 sets unsupported when eligible() is false. That also covers a provider that is not Anthropic, Bedrock, Vertex or OpenAI, and OpenAI on a route that is not /v1/responses or a model before GPT-5.6 (keepalive/ping.go:82). Those are not gateways. The Codex copy is the same file, so a Codex user on chat completions sees "extended thinking, or a gateway route", and neither is true for them. docs/dashboard.md:144 says "a route that cannot be pinged cheaply", which is more exact. You could write "(extended thinking, or a route Ping does not support)".
  • register.tsx:63 — more helper runs when the proxy is down. With no last_ts (proxy not answering), each turn.complete now starts 12 cg.py runs over about 18 s, not 6. If the pane is open, each run also loads the pane data. Turns closer than 18 s apart overlap the loops. The reads are local and fail open, so this is cost only. A guard that lets only one refreshSoon run at a time would fix it.
  • cg.py:345 — pane_heat still computes lost. The pane no longer draws heat.lost. The field is now unused. You can remove it, or keep it for other readers.

What I checked

  • I read the full diff: 1 commit, 7 files, every changed line.
  • model.ts: unsupported short text is not supported, 13 characters. That fits the 17-character test at register.test.tsx:323. REASONS and both PING_REASONS copies have the same full text. The two cg.py copies are byte-identical (cmp).
  • register.tsx:212,240-242: narrow is bodyColumns < 80. Below 80 the band shows only ping off. At 80 or more it shows ping off: <short reason>. The tests at 100 columns (register.test.tsx:303-331, :494) still cover the wide form.
  • register.test.tsx:555-576: the fit test now runs warm and cold, limits row 1 to 56 characters, and checks that the reason is gone at 60 columns. For the cold cache it checks that neither Ping nor ping off shows, which matches register.tsx:230,240.
  • register.tsx:369,380: lost today now shows only under CACHE HITS. The new test (:578) checks exactly one line, between CACHE HITS and MISSES BY HOUR. docs/plugin/statusline.md matches.
  • register.tsx:63-72 and the new slow-document test (:591): I traced the timing by hand. Old code (6 tries, 1 s apart) stops at about 5 s, so the band would not show at 12 s and the test fails. New code tries at 0, 1.5, … 9 s and 10.5 s. The try at 10.5 s sees the document, so the test passes. The test proves the change.
  • ping_test.go:240: the Go test now expects the new words.
  • Fail open: refreshSoon and refresh keep their try/catch. The change is display only. It adds no proxy path and no stored data, so docs/data-dependence.md needs no change.
  • I ran no tests. Live tests are not approved.

@OsherElhadad OsherElhadad 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 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session fresh 1 of 2 1 of 2 db3df73e8ea2 approve

Verdict: approve

Findings

None.

Non-blocking

  • register.tsx:369 — $x lost today now depends on the CACHE HITS section. Before, the figure also showed under MISSES BY HOUR (data.heat.lost). pane_strip (cg.py:318-333) returns None when /api/requests fails or the session has no main-thread request yet. Then the pane drops the CACHE HITS section, and the day's lost dollars disappear too, although pane_heat still has the same value. Proposal: show it under CACHE HITS, and fall back to data.heat.lost under MISSES BY HOUR only when data.strip is absent. A small test with strip removed from paneDoc would cover it.
  • Placement meaning. CACHE HITS says "last 20 requests" of this session. lost_today is the whole day, all sessions (/api/spend/explain since midnight). MISSES BY HOUR is also day-wide, so it matches the figure better. This is a design choice. I note it only so the choice is deliberate.
  • cg.py:345 — heat.lost is now unused. Both cg.py copies still compute and send it. Remove it, or keep it for the fallback above.
  • register.tsx:63-72 — more processes when no document ever arrives. Each turn.complete starts a new refreshSoon loop. When the proxy is down, the loop never sees last_ts, so each turn now runs cg.py 12 times over about 18 s (before: 6 times over about 6 s). The loops can overlap on fast turns. This is not new behavior, only twice the count. A guard so only one loop runs at a time would cap it.
  • Wording. The new reason text uses "can't". ASD-STE100 prefers "cannot". It is user-facing text, so this is optional.

What I checked

  • Read the full diff 6db6832a..db3df73e (1 commit, 7 files) and the code around each change.
  • model.ts REASONS and SHORT_REASONS: the new unsupported text matches in model.ts, both cg.py copies (I ran diff on the two copies: identical), ping_test.go, register.test.tsx and docs/plugin/statusline.md. The text matches the server meaning in keepalive/manualhold.go:56 (thinking enabled, or an unsupported route) and docs/dashboard.md:144.
  • register.tsx:240-242: below 80 columns the band shows ping off with no reason. At 80 columns and up the reason still shows. The tests at register.test.tsx:303-332 still check the wide form at the default 100 columns. At 80+ columns the longest row (17-character reason, if cold prices, hide) is about 71 characters plus padding, so it fits.
  • New band test (register.test.tsx:555-576): it runs warm and cold, every REASON_CODES entry, '' and an unknown code. The assertions match the render logic: cold shows no ping off and no Ping; warm no entry and unknown codes show nothing; other codes show ping off then hide.
  • New pane test (register.test.tsx:578-589): it checks one lost today line, between CACHE HITS and MISSES BY HOUR. The fixture has strip.lost: 1.4, so the line renders.
  • New slow-document test (register.test.tsx:591-614): with the old loop (6 tries, 1 s apart, ending near 6 s), no document reaches the band before 12 s, so the test fails on old code and passes on new code (a try lands at 10.5 s at the latest). It proves the change.
  • refreshSoon stays fail-open: the loop is in try/catch, and refresh and helper catch their own errors.
  • Docs: statusline.md drops the duplicate $1.40 lost today under MISSES BY HOUR and the stale "27 characters" claim. The model.ts:172 comment about 27 characters at 60 columns is now out of date (60 columns shows no reason), but it is harmless.
  • Data dependence: display only. No new reads or stored data. The PR states this. No docs/data-dependence.md change is needed.
  • I did not run tests. Live tests are not approved, and Go is not installed.

…e ping text exact

- Run only one first-document retry loop at a time.
- Show `$x lost today` under MISSES BY HOUR when CACHE HITS has no data.
- Say "Ping cannot hold this session (extended thinking, or a route
  Ping does not support)". It is true for Codex and OpenAI routes too.

Part of #687

Assisted-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Osher Elhadad <[email protected]>
@OsherElhadad

Copy link
Copy Markdown
Collaborator Author

The notes from both reviewers are done in the next commit.

  • More helper runs when the proxy is down (both). One retry loop runs at a time. A second turn while it runs returns at once. A test runs two turns in a row with no document and checks that the helper reads are more than 1 and at most 12, not 24.
  • $x lost today depends on CACHE HITS (one reviewer). It shows under CACHE HITS. When that section has no data, it shows under MISSES BY HOUR, so the day's figure does not disappear. A test removes strip and checks it shows once. This keeps heat.lost in use. The placement is a choice: the figure covers the whole day, and the CACHE HITS text covers the last 20 requests.
  • Gateway wording (one reviewer). The server also sets unsupported for other providers and for OpenAI on some routes. The full text is now "Ping cannot hold this session (extended thinking, or a route Ping does not support)". It uses "cannot". model.ts, both cg.py copies, the tests and the docs agree.

Tests: claude plugin validate . passed. claude plugin test .: 68 pass. The full Go suite: ok. The Python unittests: OK.

@OsherElhadad OsherElhadad 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 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session resumed 2 of 2 2 of 2 4a40d6a1753f approve

Verdict: approve

Findings

None.

Earlier notes (round 1, both reviewers; all were non-blocking)

  • Reviewer 2: the "gateway route" text was too narrow. Fixed. All copies now say "Ping cannot hold this session (extended thinking, or a route Ping does not support)". This text is true for every case where keepalive/keeper.go:754,775 sets unsupported. model.ts:164, both cg.py:1393 copies (byte-identical), register.test.tsx:375, ping_test.go:240 and statusline.md:200 agree.
  • Reviewers 1 and 2: overlapping retry loops. Fixed. register.tsx:63-78 has a module-level soon flag, and finally always clears it. A second call while a loop runs returns at once.
  • Reviewer 2: heat.lost was unused. Fixed by use. It is now the fallback (next point).
  • Reviewer 1: $x lost today disappeared when CACHE HITS had no data. Fixed. register.tsx:387 shows heat.lost under MISSES BY HOUR only when data.strip is absent. When both sections are present, the line shows once.
  • Reviewer 1: placement meaning. The author kept the placement as a choice, and gave the reason (the figure covers the day). I accept it.
  • Reviewer 1: "can't". Fixed ("cannot").
  • Reviewer 1: stale comment at model.ts:172 (27 characters at 60 columns). Not changed. It is harmless and was not a finding.

Non-blocking

  • docs/plugin/statusline.md:229-236 does not describe the new fallback. The pane sample shows $1.40 lost today only under CACHE HITS. One sentence could say that it moves under MISSES BY HOUR when CACHE HITS has no data.
  • register.tsx:63 — the guard can skip a quick refresh. This applies only while no document exists. Suppose a loop is near its last try and a turn completes. That turn starts no new loop, so the band can wait for the next 15 s poll. This is the intended trade, and the 15 s poll still runs, so nothing is lost.

What I checked

  • Last review: round 1, db3df73, 2026-10-25T14:01:25Z
  • New commits read: 1 (4a40d6a1 fix(plugin): run one retry loop, keep the day's lost dollars, make the ping text exact)
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 1, round 1 review (14:01:46Z): I checked each of its 5 notes against the new commit (see above).
    • The author's reply comment (14:11:35Z): it says it fixed 3 points. I checked each one in the code and the tests. All 3 are fixed as stated.
  • register.tsx:63-78: the soon flag is set before the try, and the finally clears it on return, break and throw. A return inside the loop (document found) also clears it. Fail-open does not change: errors still fall into the catch.
  • New retry test (register.test.tsx:640-658): session.start starts the loop at time 0. The two turn.complete calls return at once. In 14 s the loop makes about 10 reads. The 15 s poll does not fire yet. Without the guard, three loops would make about 30 reads, more than 12. So the test proves the guard.
  • New fallback test (register.test.tsx:626-638): paneDoc has no strip. The test checks that there is no CACHE HITS, exactly one $1.40 lost today, and that it is under MISSES BY HOUR. It resets paneDoc at the end, as the other tests at :392,:428 do. The earlier "shows once, under CACHE HITS" test (:578) still covers the case where both sections are present.
  • The long text appears only in the pane and the toast. The band short text (not supported) did not change, so the band fit test still holds.
  • Data dependence: display only. No new reads and no stored data.
  • I ran no tests. Live tests are not approved.

@OsherElhadad OsherElhadad 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 (claude, user of @OsherElhadad) Claude Code 2.1.310 offload-review skill, @OsherElhadad's session resumed 1 of 2 2 of 2 4a40d6a1753f approve

Verdict: approve

Findings

None.

Status of earlier notes

Both reviewers approved in round 1, with non-blocking notes only.

  • Reviewer 1: lost today depends on CACHE HITS. Fixed. register.tsx:387 shows the figure under MISSES BY HOUR only when data.strip is absent. With strip present it shows once, under CACHE HITS (:374). The new test at register.test.tsx:626-638 removes strip and checks one line, below MISSES BY HOUR.
  • Reviewer 1: placement meaning. The author kept the placement as a deliberate choice and gave the reason. I accept it.
  • Reviewer 1 and reviewer 2: heat.lost unused. Fixed by the fallback. The field is now in use.
  • Reviewer 1 and reviewer 2: more helper runs when the proxy is down. Fixed. register.tsx:63-78 adds a soon flag. A second call returns at once while a loop runs. finally clears the flag on a normal exit, on the early return, and on a throw.
  • Reviewer 1: "can't". Fixed. The text now uses "cannot".
  • Reviewer 2: "gateway route" too narrow. Fixed. The text is now "Ping cannot hold this session (extended thinking, or a route Ping does not support)". It is the same in model.ts:164, both cg.py copies (byte-identical in the diff), ping_test.go:240, register.test.tsx:375 and docs/plugin/statusline.md:200. It matches keepalive/manualhold.go:56.

Non-blocking

  • register.test.tsx:652-653 — the guard test can pass without the guard if turn.complete never reaches the hook. The calls end in .catch(() => undefined). If the harness rejects the call before it runs the turn.complete hook, only the session.start loop runs. That gives 10 reads in 14 s, which also passes <= 12. When the hook does run, code without the guard gives about 30 reads (3 loops × 10), and the test fails, as it should. Proposal: remove the .catch, or record that the hook ran and assert it. This is test strength only. The guard code itself is correct.
  • register.tsx:63 — soon is module state. If a loop is still sleeping when a new session.start comes (for example after /clear), the new session's first loop returns at once. The new session then waits up to about 18 s for the old loop to end, or for the 15 s poll. This is small and fails open.

What I checked

  • Last review: round 1, db3df73e8ea28e8ad810fe3c07a28204a65b47ef, 2026-10-25T14:01:46Z
  • New commits read: 1 — 4a40d6a1 fix(plugin): run one retry loop, keep the day's lost dollars, make the ping text exact (7 files, +46 −6)
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
  • New items since my last review:
    • Comment by OsherElhadad at 2026-10-25T14:11:35Z. It answers both reviewers' notes. I checked each answer against the commit (see "Status of earlier notes").
    • Commit 4a40d6a1. I read every changed line and the code around it.
  • Reviewer 2's round-1 review (14:01:25Z, before mine): I read it in full. Its notes are covered above.
  • refreshSoon trace: the flag is set before try, and finally clears it on all three exit paths. refresh and helper still catch their own errors, so the band stays fail-open.
  • Guard test timing: with the guard, one loop reads at 0, 1.5 … 13.5 s, which is 10 reads at most in 14 s. The 15 s poll does not fire. Without the guard, 3 loops give about 30 reads. So the test proves the guard when the hook runs (see the non-blocking note).
  • Fallback test: paneDoc is set to {heat, spark}, and the test resets it at the end. This is the same pattern as register.test.tsx:419-428.
  • Data dependence: no change. The changes are display text, one render condition, and a local retry guard. There are no new reads and no stored data.
  • I did not run tests. Live tests are not approved, and Go is not installed.

A mod command has no plugin prefix. /context-guru:context-guru gives
"Unknown command". Fix the comment, the skill, the retired-layout
message and the docs.

Part of #687

Assisted-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Osher Elhadad <[email protected]>
@OsherElhadad

Copy link
Copy Markdown
Collaborator Author

The pane command is /context-guru. A mod command has no plugin prefix, so /context-guru:context-guru gave "Unknown command". I fixed all 5 places: the register.tsx header comment, SKILL.md, the retired-layout message in statusline.py, and two lines in statusline.md. A grep finds no other copy.

Tests: claude plugin test . 68 pass. The status line, docs and skill Go tests pass.

@OsherElhadad
OsherElhadad merged commit 0a22b9c into main Oct 25, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Oct 25, 2026
OsherElhadad pushed a commit that referenced this pull request Oct 25, 2026
…0.2.5)

Both plugins changed in this release, so installed plugins must update.

- Claude Code plugin: 0.6.0 was set in #694. No change here.
- Codex plugin: 0.2.4 to 0.2.5. The vendored cg.py and costly.py
  and one skill changed in #512, #681, #683, #691, #694 and #698.

Assisted-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Osher Elhadad <[email protected]>
amiddavid pushed a commit that referenced this pull request Oct 26, 2026
…0.2.5) (#701)

chore(plugin): bump the plugins for v0.6.0 (Claude Code 0.6.0, Codex 0.2.5)

Both plugins changed in this release, so installed plugins must update.

- Claude Code plugin: 0.6.0 was set in #694. No change here.
- Codex plugin: 0.2.4 to 0.2.5. The vendored cg.py and costly.py
  and one skill changed in #512, #681, #683, #691, #694 and #698.

Assisted-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: Osher Elhadad <[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.

1 participant