Skip to content

feat(bob-plugin): add the IBM Bob plugin and its status bar - #968

Merged
amiddavid merged 6 commits into
mainfrom
feat/bob-plugin
Nov 9, 2026
Merged

amiddavid merged 6 commits into
mainfrom
feat/bob-plugin

Conversation

@vz-ibm

@vz-ibm vz-ibm commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #967. Review and merge #967 first. This PR's own changes are the last commit, feat(bob-plugin): add the IBM Bob plugin and its status bar.

No behavior change for existing users. Everything here is new and opt-in: the files are under bob-plugin/, and nothing runs until a Bob user runs setup and says yes.

Summary

This PR adds a context-guru plugin for IBM Bob: the Bob IDE (a VS Code fork) and Bob Shell. It does for Bob what the Claude Code plugin does for Claude Code:

  • It routes Bob's model calls through a local context-guru proxy.
  • It gives Bob 7 skills to control CG.
  • A status bar item in Bob shows CG's state.

macOS only.

What changed

Plugin (bob-plugin/context-guru/)

Skill What it does
setup Shows the plan, asks for consent, routes Bob, adds 2 hooks, starts the proxy. Rolls back on any failure
status Routed? Proxy up? Recent Bob traffic?
doctor Checks each part, and that the installed Bob version still has what CG needs
update Updates the proxy binary, with rollback
uninstall Undoes all of it. Both files come back byte for byte
preset-picker off or lossless
cache-strategy-picker none only. Keep-alive does not pay on Bob

How it routes:

  • Shell file: one guarded block in ~/.zshrc or ~/.bash_profile.
    • It sets VITE_GATEWAY_BASE_URL (Bob IDE) and BOB_GATEWAY_URL (Bob Shell).
    • The IDE line is guarded by __CFBundleIdentifier, so only Bob reads it.
  • Hooks: a Bob plugin cannot carry hooks. So setup writes 2 into ~/.bob/settings/settings.json.
    • SessionStart: start the proxy.
    • UserPromptSubmit: warn when the proxy is down.
    • Each hook is tagged, so uninstall removes only ours.
  • Proxy: a launchd agent on 127.0.0.1, ports 8891–8990. It is never bound to other interfaces.
  • reset.sh: an emergency undo that works even with no install record.

Status bar (bob-plugin/statusbar/)

A small VS Code extension, because Bob has no statusLine setting. It shows:

CG ✓ ctx 21k/270k · cache 1h 54:18 · saved 0

  • It calls only 127.0.0.1 and refuses any other host.
  • It never shows or logs prompts, answers or tokens.
  • make bob-statusbar builds the .vsix. The .vsix is gitignored.

Other files

  • Makefile: the bob-statusbar target.
  • docs/data-dependence.md: a row for the Bob plugin.

Data dependence

New row: "Bob plugin". Metadata only.

  • The hooks read only the session id, the event name and the SessionStart source.
  • They never read the prompt.
  • The status bar reads counts and times from the local API.
Storage level What it does
Off Works. status cannot see recent Bob traffic
Metadata only Works
Everything Same as metadata only

components/all/datadep_test.go passes.

How it was tested

  • go test ./bob-plugin/: OK. It runs the 167 Python plugin tests and the status bar build check.
    • Every test runs in a temp HOME with a fake launchctl and bobide.
  • Status bar: npm test, 47 of 47 pass.
  • go vet and gofmt: clean.
  • Live, on a real Mac with the real Bob IDE (2026-11-08 and 11-09):
    • setup → Bob routed → a chat through CG → CG ✓ in the status bar → /context-guru-status gives result=ok → uninstall.
    • After uninstall, .bash_profile and settings.json matched their SHA-256 from before.

Known limits

  • CG saves 0% on Bob today. Bob's tool definitions and system prompt are about 95% of each call. Tool deferral for Bob is the next step.
  • Bob keeps its login per backend address. So Bob asks for one login after setup, and one after uninstall.
  • With no folder open, Bob uses ~/.bob/playground, and Bob does not create that folder. Without it, the skills cannot run a command. The installer PR creates the folder.

@vz-ibm vz-ibm 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 @vz-ibm) Claude Code 2.1.316 offload-review skill, @vz-ibm's session fresh 2 of 2 1 of 2 ae7fb838cb2c blocking

Verdict: blocking

The code is careful. I found no defect in the Go changes, the plugin scripts, reset.sh or the status bar code. The one finding is a missing data-dependence statement for the status bar, which the repo rules require.

Findings

  1. docs/data-dependence.md:180 — the "Bob plugin" row does not cover the status bar, a new feature of this PR
    • What fails: CLAUDE.md says every PR that adds a feature states its data dependence and its behavior at each storage level, in docs/data-dependence.md. The row names only "routing block, hooks, status". It says "status reads only the time and agent of the newest Bob request".
    • The status bar reads more than that:
      • /api/sessions?agent=bob&limit=1: the newest Bob session id and its saved token count (bob-plugin/statusbar/src/client.ts:86-91).
      • /api/cachestate?session=<id>: end_ts, ttl_s, prefix_tokens, window, priced, money (client.ts:92-94, model.ts:20-30).
    • doctor also reads /api/requests?agent=bob (bob_plugin.py:1144, 1172-1177). The row does not name doctor either.
    • The row does not say what the status bar shows at the "off" level. From the code: the reads fail, poll catches the error, and the bar shows CG ✓ ctx —/270k · cache — · saved 0 (client.ts:95-97, model.ts:146-151). So a user sees "saved 0" and no clock, and cannot tell "no data" from "nothing saved".
    • The PR body says "The status bar reads counts and times from the local API". The doc row does not say it. The rule asks for the doc.
    • Fix: add the status bar and doctor to the row's name and reason. Name the fields each one reads (session id, saved tokens, cache times, prefix size). Say that all of them are metadata, and what the bar shows when the dashboard has no rows. Optional: show saved — in place of saved 0 when /api/sessions fails, so "no data" does not read as "zero".

Non-blocking

  • bob-plugin/context-guru/README.md:248 says "No status bar yet." Lines 55-70 of the same README describe the status bar that this PR ships. Delete line 248.
  • bob-plugin/statusbar_test.go:19-21 skips when npm is absent. bobplugin_test.go:15-18 fails when python3 is absent, with the comment "a skip looks like a pass in CI output". The two choices disagree. In CI, npm is present, so the suite runs. It needs the npm registry on each CI run because node_modules is not cached. This adds a network dependency to make cover. Consider a cache step, or say so in the test comment.
  • TestBobStatusbarSuite writes node_modules/ and out/ into the source tree during go test. Both are gitignored, so this is only a side effect. Worth one line in the comment.
  • MINIMUM_BOB_RELEASE = (0, 3, 1) (bob_plugin.py:47). The X-Task-Id session and Bob cache-write fixes (#967, the first 4 commits here) are not in any release yet. A user who runs setup before the next release gets a binary that routes Bob, but still hashes sessions and counts cache writes as fresh input. The status bar clock then says 5 minutes for a 1-hour cache. Consider raising the minimum to the release that ships #967, when it exists.
  • first_free_port (bob_plugin.py:245-255) binds and closes a port, then launchd binds it later. Another process can take it in between. Setup then fails on /healthz and rolls back, so this fails closed. Only a note.

What I checked

  • Read CLAUDE.md, the session and Bob-route parts of docs/design.md, and the PR body. I also read the body of #967 for the behavior change of the first 4 commits.
  • Read the full diff of all 5 commits: Makefile, apply/*, dash/capture_test.go, docs/*, proxy/* (proxy.go, bobusage.go, recctx.go, dashcapture.go and all new tests), session/*, and every file under bob-plugin/. I did not read every line of package-lock.json. I checked that all 296 resolved URLs point to registry.npmjs.org.
  • Session id (explicitSessionOf): it reads X-Task-Id only when upPath == bobModelPath. Every caller passes the route's static path: chat line 1293, observe shadow line 1989. upstreamFor keeps static.path (tenancy.go:716). The host id comes after the header and the metadata fields (session.go:534-545). It goes through safeExplicit, so ../../x and over-long ids fall back to the derived hash. On the Bob route, apply gets an id that is already resolved, and ExplicitSession(resolved, body) gives the same id back. The grace alias and the dash AliasFn still pass "", so the alias stays the content hash, as the comments say. Hosted mode scopes the id per tenant through session.Scoped.
  • Bob usage (bobUsage): it runs only when up.path == bobModelPath, on the stream path (streamRecOn, both calls) and on the buffered path (proxy.go:2305-2308). It is fail open: the code returns base unchanged for a non-object block, a missing or non-integer count, write1h > write, or read + write > prompt. providerusage.Parse is unchanged. No other caller of responseUsageWhy exists outside tests.
  • Plugin scripts: rc-block ownership, the one-hop symlink rule, atomic writes that keep the file mode, and the exact-restore rule of bob_hooks. I also checked the parity of reset.sh with them (perl regex = block(), the "exact"/"existed" checks), setup's Undo order, change_and_restart restore and Ctrl-C handling, and the state lock. Hooks always exit 0 (|| true, </dev/null, the check output only). signal sends only 3 fields, only for SessionStart. The proxy's /signal accepts the session_id/hook_event_name/source names (clientsignal.go:139-157).
  • Security: valid_upstream allows only https://*.bob.ibm.com. The proxy listens on 127.0.0.1 only. The release download is checked against checksums.txt. Tar extraction takes one regular-file member by base name, so no path traversal is possible. Presets are an allow-list. The status bar refuses any host but 127.0.0.1, has a total deadline and a 1 MiB cap, and does not follow redirects.
  • Presets: lossless = format, toon, cachesplit. All three are Reformat components. cachesplit is a no-op on OpenAI chat. A config with pipeline: and no preset: loads (config.go:438-441).
  • Keep-alive: strategies and the predictive campaign skip provider == OpenAI (keepalive.go:377, 461, 487). So none is the only strategy that means something for Bob, as the plugin says.
  • Status bar API shapes: they match the server. /api/sessions rows have session_id and saved (dash/query.go:538, 559). /api/cachestate has end_ts, now_ms, ttl_s, prefix_tokens, window (dash/cachestate.go:19-61). /api/requests gives requests[].ts. agent=bob goes through filterFrom.
  • I did not run the tests. Live tests are not approved, and Go is not installed here.

@vz-ibm vz-ibm 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 @vz-ibm) Claude Code 2.1.316 offload-review skill, @vz-ibm's session fresh 1 of 2 1 of 2 ae7fb838cb2c blocking

Verdict: blocking

Findings

  1. bob-plugin/statusbar/src/client.ts:41-66 — getJson never settles when the proxy closes the connection in the middle of a reply. Then the status bar stops polling and keeps showing CG ✓.
    • What fails: the proxy sends the status line and headers, then closes the socket before the body ends. A proxy restart can do this: configure, update, a launchd restart after a crash, or uninstall. Node then emits aborted and close on the response. It emits no end, and the request emits no error. So no listener calls resolve or reject. The deadline timer fires, but request.destroy(...) on a socket that is already closed emits nothing. The promise stays pending forever.
    • Effect: tick() in extension.ts:30-40 waits on poll() forever, so it never schedules the next setTimeout. The status bar stops polling until Bob restarts. clockTimer keeps redrawing the last snapshot. So the user sees CG ✓ … cache 1h 54:10 count down while the proxy is down and Bob cannot reach its backend. The status bar exists to show exactly that state (CG ✗).
    • Proof: I wrote a copy of the same promise logic, against a raw server that sends HTTP/1.1 200 OK\r\nContent-Length: 100\r\n\r\n{"a": and then destroys the socket. The deadline was 500 ms (node v24.2.0):
      RES ABORTED
      RES CLOSE complete= false
      HUNG: promise never settled        (after 2000 ms)
      
      The current tests do not cover this case. "a server that drips bytes" keeps the socket open, so its destroy still emits error.
    • Fix: make the deadline itself call fail(new Error('timeout')). Also add response.on('aborted' | 'error' | 'close') handlers that reject when response.complete is false, and use a settle-once guard. Add a test: the server writes the headers and part of the body, then destroys the socket, and getJson must reject within the deadline.

Non-blocking

  • The signal hook does nothing for Bob today. The README says that after a compaction, the proxy drops the old cache entries (README.md, "Two hooks"). But the keeper never tracks Bob's route: proxy/keepalive.go:377 and :428 exclude bschemas.OpenAI, and Bob's model route is OpenAI chat. Also, nothing shows that Bob's hook session_id is the same as the X-Task-Id session key. Fix the README claim, or drop the handler until keep-alive covers Bob.
  • The README contradicts itself. "Known gaps" still says "No status bar yet.", and the "Status bar" section above it describes the status bar.
  • MINIMUM_BOB_RELEASE = (0, 3, 1) and find_binary do not gate on what the plugin uses. binary_problem accepts any binary with --bob-upstream, and v0.2.0 already has that flag. The status bar reads /api/cachestate, which first ships in v0.6.0. The X-Task-Id session (#967) is not in any release yet (v0.6.7 has no X-Task-Id). An older brew binary on PATH passes doctor binary=ok, and the status bar then shows — for every field. Consider a version floor for a PATH binary, or a doctor warning.
  • CI now runs npm install scripts. TestBobStatusbarSuite runs npm ci with no --ignore-scripts. So every CI run executes the install scripts of @vscode/vsce-sign and keytar (both hasInstallScript in the lock file). The tests need only typescript and the @types packages. Add --ignore-scripts to the test's npm ci to make the supply-chain surface smaller. The make bob-statusbar packaging may still need the scripts. The npm registry is also a new network dependency for go test in CI, and with CI set, an npm outage fails the build.
  • The PR body says 167 Python tests. I count 161 def test_ (116 + 45). Subtests or a skip count may explain the difference. Please check the number.

What I checked

  • CLAUDE.md, the docs/design.md session section, and the PR body. I also read the #967 body, because its commits are in this diff.
  • The full Go diff: session.Explicit host ids (last in order, sanitized by ExplicitID), apply.ExplicitSession, and explicitSessionOf. I checked every caller of the session id on the chat path: the pipeline opts, the expand repair, the observe RecordBilledInput, and newRecCtx. Every other route still reads only the session header. /compact and GET /expand stay unchanged on purpose.
  • bobUsage and bobResponseUsage: the fail-open returns (missing, negative, fractional, or 1h > write, read + write > prompt), and both stream paths plus the JSON path in serve. I found no other responseUsageWhy call site that skips the correction.
  • The tests: session_test, bobsession_test, bobusage_test, bobprofile_test, sessionrec_test, dash_test, capture_test (by name and shape).
  • bob_plugin.py in full: setup consent, the refusals before the lock, the Undo order and re-run safety, change_and_restart rollback, update staging and checksum (the tar member is read with extractfile, so there is no path traversal), doctor bundle checks, the status and hook handlers (they exit 0 and do not read the prompt), and uninstall.
  • bob_route.py: block ownership states, the symlink rule, byte-exact remove, and the probe env.
  • bob_hooks.py: tag matching, the duplicate-key refusal, and the exact-restore conditions on install, re-install, and remove.
  • reset.sh: the perl block regex is the same as bob_route.block. The hooks exact restore follows the same rule as bob_hooks.remove. The osascript fallback, and the launchd ownership check.
  • The status bar: model.ts, client.ts, extension.ts, package.json, .vscodeignore, the lock file registry (all from registry.npmjs.org), and the Go wrappers bobplugin_test.go and statusbar_test.go.
  • The 7 skills, the README, the data-dependence rows (the new "Bob plugin" row and the session and usage additions), docs/design.md, and the Makefile target.
  • The plugin scripts parse as Python 3.9 (/usr/bin/python3 on macOS). The CI checks on the PR are green.
  • I did not run Go, Python or npm tests (live tests are not approved). The only thing I ran is the standalone Node repro for finding 1.

@vz-ibm

vz-ibm commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

Round 1: replies

Both findings are fixed in 2bf2b267. I also acted on 4 non-blocking notes.

R1-1: getJson never settles on a reply cut off mid-body. Fixed. Thank you for the proof.

  • getJson now settles once. Its deadline calls fail itself, and fail destroys the request. Before, the deadline only called request.destroy(), which emits nothing on a socket that is already closed.
  • New handlers: aborted, error, and close with response.complete === false. Each one rejects.
  • New test a reply cut off mid-body fails within the total deadline: a raw server sends the headers and {"a":, then destroys the socket. Before the fix, the test timed out after 3,000 ms. Now it rejects within the 300 ms deadline.

R2-1: the data-dependence row does not cover the status bar. Fixed.

  • The row now names status, doctor and the status bar.
  • It names the fields each one reads: the newest Bob request time; the newest Bob session id and its saved tokens; that session's cache times, prefix size and context window.
  • All are counts, times and ids, so the level stays metadata. The row also says what the bar shows with the dashboard off.
  • I also took your option: the bar shows saved — when there is no data, not saved 0. A real zero still shows saved 0. I changed 4 test expectations and 1 test input for this. Each now asserts the new output, and each failed before the code change.

Non-blocking, fixed:

  • README "No status bar yet": removed (R1, R2).
  • The signal hook claim (R1): you were right. The keeper skips the OpenAI provider (proxy/keepalive.go, provider == bschemas.OpenAI), so SessionStart compact retires nothing on Bob. The README now says that signal is recorded and changes nothing else on Bob today.
  • npm ci runs install scripts in CI (R1): fixed. npm ci --ignore-scripts in the Makefile and in TestBobStatusbarSuite. I checked it from a clean node_modules: install, build, 48 tests and the .vsix package all work without the scripts.

Non-blocking, no change:

  • The test count (R1): python3 -m unittest discover runs 167 tests. The 161 def test_ lines plus subtests give that number.
  • MINIMUM_BOB_RELEASE (R1, R2): correct, it should name the first release with feat(proxy): Bob chat sessions and cache-write usage, Bob route only #967. That release does not exist yet. I will raise it when it is tagged.
  • npm skip against python3 fail (R2): the status bar test skips only when npm is absent, and fails when npm ci fails under CI. The CI runner has Node, so it runs there.
  • first_free_port race (R2): it fails closed (setup rolls back on /healthz). Note only.

Checks

  • go test ./bob-plugin/: OK from a clean npm ci --ignore-scripts. That covers 167 Python tests and 48 status bar tests.
  • go vet, gofmt: clean. components/all data-dependence test: OK.

@vz-ibm vz-ibm 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 @vz-ibm) Claude Code 2.1.316 offload-review skill, @vz-ibm's session resumed 1 of 2 2 of 2 2bf2b2677bbb approve

Verdict: approve

Findings

None.

Earlier findings

  • Reviewer 1, finding 1 (getJson never settles on a cut-off reply): fixed.
    • fail now settles once, clears the deadline and destroys the request. The deadline calls fail itself. New aborted, error and close (!response.complete) handlers reject. end checks settled.
    • I ran the new logic as a standalone copy (node v24.2.0), with a 300 ms deadline:
      cut            rejected reply cut off   27ms
      ok             resolved {"a":1}          2ms
      chunkedok      resolved {"a":2}          1ms
      s500           rejected status 500       1ms
      headersonly    rejected timeout        306ms
      closebeforehdr rejected socket hang up   3ms
      
    • The "too large" path now goes through fail, so it also settles once.
    • The new test a reply cut off mid-body fails within the total deadline has the same shape as my repro. It has a 3,000 ms test timeout, so a hang fails the test and does not block the suite.
  • Reviewer 2, finding 1 (the data-dependence row does not cover the status bar): fixed. The row now names status, doctor and the status bar. It names each field they read (all counts, times and ids), and what the bar shows with the dashboard off. I checked this against client.ts: a failed /api/sessions read leaves snap.saved undefined, so the bar shows saved —. A real saved: 0 still shows saved 0 (client.test.ts:93, :237).

Earlier non-blocking notes

  • signal hook claim: fixed. The README now says that the hook changes nothing on Bob today. This agrees with proxy/keepalive.go:428.
  • "No status bar yet.": removed.
  • npm ci install scripts: fixed in both places (the Makefile and statusbar_test.go). The author reports that build, tests and .vsix packaging work without the scripts. I did not run them.
  • Test count: I accept the reply. 161 def test_ plus subtests gives 167.
  • MINIMUM_BOB_RELEASE: deferred until the release with #967 exists. I accept this. That release does not exist yet, so a floor cannot name it.

Non-blocking

  • Makefile:58: the new # --ignore-scripts … line sits inside the recipe, with a tab before it. So make prints it and passes it to the shell, where it does nothing. Above the target, as a make comment, it would not print. It is cosmetic only.

What I checked

  • Last review: round 1, ae7fb838cb2c7d8c9e0b16d76a08a9e43b1821cf, 2026-11-09T08:56:34Z
  • New commits read: 1 (2bf2b267 fix(bob-plugin): status bar never hangs on a cut-off reply; review fixes)
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
  • New items since my last review:
    • Commit 2bf2b267: I read the full diff and the whole getJson in client.ts. I ran the new logic against 6 server behaviors (see above).
    • Comment by vz-ibm at 2026-11-09T09:18:12Z (the round 1 replies): I checked each reply against the code. Each one is accepted above.
  • Older items, read again: reviewer 2's round-1 review (08:32:00Z). I checked its finding against the new data-dependence row and client.ts. Its non-blocking notes on the npm skip and first_free_port got replies, and I accept both.
  • formatSaved and poll: undefined now means "no data", and 0 still means zero. I checked every changed test expectation. Each one asserts a specific string.
  • docs/data-dependence.md Bob plugin row: it says metadata at every level, and it matches what the code reads.
  • I did not run Go, Python or npm tests (live tests are not approved). The only thing I ran is the standalone Node copy of getJson.

@vz-ibm vz-ibm 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 @vz-ibm) Claude Code 2.1.316 offload-review skill, @vz-ibm's session resumed 2 of 2 2 of 2 2bf2b2677bbb approve

Verdict: approve

Both round-1 findings are fixed. The new commit adds no defect.

Findings

None.

Status of earlier findings

  • Reviewer 1, finding 1 (getJson never settles on a reply cut off mid-body): fixed. I traced the new code in bob-plugin/statusbar/src/client.ts:38-82:
    • fail is guarded by settled, clears the deadline, destroys the request and rejects. The deadline timer now calls fail itself. So the promise settles at the deadline at the latest, even when destroy() emits nothing.
    • A cut-off reply now rejects on aborted, or on close with response.complete === false. end sets settled, so the close that follows a good reply does nothing.
    • fail reads deadline and request before their const lines. This is safe: only timers and events call fail, and those run after both names are set.
    • The new test a reply cut off mid-body fails within the total deadline reproduces the reviewer's case: headers plus {"a":, then the socket is destroyed. It has a 3 s test timeout, so the old code fails it.
    • So tick() in extension.ts always reaches its next setTimeout, and a down proxy shows CG ✗.
  • Reviewer 2 (me), finding 1 (data-dependence row did not cover the status bar): fixed. docs/data-dependence.md:233 now names status, doctor and the status bar. It lists the fields each one reads and says what the bar shows at the "off" level. I checked the claims against the code:
    • status and doctor read only requests[0].ts (bob_plugin.py:1172-1177).
    • The status bar reads session_id and saved from /api/sessions, then /api/cachestate (client.ts:95-103).
    • With no rows, or a failed read, snap.saved stays undefined. formatSaved then gives saved — (model.ts:95-98), and cache stays unset, so the clock shows —. A real 0 still shows saved 0.
  • Non-blocking notes from round 1:
    • README "No status bar yet": removed.
    • The signal hook claim (reviewer 1): the README now says that signal changes nothing else on Bob today. This matches proxy/keepalive.go:377, 428.
    • npm ci install scripts (reviewer 1): --ignore-scripts was added to the Makefile and to TestBobStatusbarSuite. The tests need only typescript and @types/*, which have no install scripts.
    • MINIMUM_BOB_RELEASE (both reviewers): the author defers the change until the release with #967 is tagged. I accept this: no such tag exists yet.
    • Test count, the npm skip against the python3 fail, and the first_free_port race: the author kept them, with reasons. I accept the reasons. The skip applies only when npm is absent, and CI has Node. The port race fails closed.

Non-blocking

  • docs/data-dependence.md:233 says the status bar reads "counts, times and ids". It also reads priced and money.*.saved_usd from /api/cachestate (model.ts:99-102). These are numbers too, so the level stays metadata. Consider naming them, for a full list.
  • Track the MINIMUM_BOB_RELEASE raise in an issue, so it is not lost when #967 ships.

What I checked

  • Last review: round 1, ae7fb83, 2026-11-09T08:32:00Z
  • New commits read: 1 (2bf2b267 fix(bob-plugin): status bar never hangs on a cut-off reply; review fixes)
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 1's round-1 review (08:56:34Z): I read it in full. I checked its finding 1 against the new code (fixed, see above), and its 5 non-blocking notes against the author's replies.
    • The author's comment "Round 1: replies" (09:18:12Z): I checked each reply against the diff and the code. All the claimed changes are in 2bf2b267.
    • Commit 2bf2b267: I read all 8 files of the diff in full: Makefile, README.md, client.ts, model.ts, both test files, statusbar_test.go and docs/data-dependence.md. I also read the code around each change: getJson, poll, formatSaved, render, and the README "Two hooks" section.
  • I read the 4 changed test expectations and the 1 changed test input (saved: 0 in "an expired cache renders cold"). Each asserts the new output, and none is weaker than before.
  • I did not run the tests. Live tests are not approved, and Go is not installed here.

@vz-ibm

vz-ibm commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

New fixes after round 2

The review of #973 found 3 real bugs in code this PR adds. They are fixed in b234116e. This PR was approved in round 2, so that approval was for an earlier head.

  1. Calls to 127.0.0.1 went through the user's HTTP_PROXY. On a corporate Mac with no NO_PROXY for 127.0.0.1, healthz failed, and the signal hook sent the Bob session id to the corporate proxy. Local calls now use an opener with no proxy. GitHub downloads keep the user's proxy.
  2. The rc block broke .zshrc under setopt nounset. zsh stopped reading the file at the block. The block now uses ${VAR:-}. The legacy form is still recognized: setup upgrades it, and uninstall and reset remove it byte for byte.
  3. reset.sh deleted a proxy config the user wrote. It now checks our marker line first, as uninstall does.

Each fix has tests that fail on the old code. Details: #973 (comment).

@vz-ibm vz-ibm 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 @vz-ibm) Claude Code 2.1.316 offload-review skill, @vz-ibm's session resumed 2 of 2 3 of 3 b234116ed8d0 approve

Verdict: approve

The 3 fixes in b234116e are correct. Each one has a test that fails on the old code. I found no new defect.

Findings

None.

Status of earlier findings

  • Reviewer 1, round 1, finding 1 (getJson cut-off reply): fixed in 2bf2b267. The new commit does not touch it.
  • Reviewer 2 (me), round 1, finding 1 (data-dependence row): fixed in 2bf2b267. The new commit does not change what the plugin reads, so the row is still correct.
  • Reviewer 1, round 2, non-blocking (Makefile comment line inside the recipe): not changed. It is cosmetic only.
  • MINIMUM_BOB_RELEASE: still deferred, with a reason. I accept the reason.

New commit b234116e

  1. Local calls skip HTTP_PROXY: correct.
    • LOOPBACK = build_opener(ProxyHandler({})) (bob_plugin.py:232). An empty ProxyHandler mapping turns off the proxies from the environment for that opener.
    • All 3 loopback calls use it: healthy (:236), last_bob_request_ms (:1181), signal_hook (:1280). I found no other urlopen to 127.0.0.1. The 2 calls that stay on urllib.request.urlopen go to GitHub (:325, :333), as the comment says.
    • The new test class sets HTTP_PROXY, removes NO_PROXY, and checks that the fake corporate proxy got no path and no signal. It covers status and signal. status runs healthy and last_bob_request_ms.
  2. The rc block is safe under nounset: correct.
    • block() now writes ${VAR:-} (bob_route.py:44-60). our_blocks() returns the new form and the legacy form, and ownership accepts both (:87).
    • _present picks the form the file holds. ownership accepts exactly one block, so the pick has one match. _writable_state, install and remove all use it. So a legacy block is removed byte for byte, and a re-run of setup replaces it with the new form (install returns "already" only when the new form is present, :238).
    • reset.sh:103: the perl regex accepts both forms. The groups it adds are (?:…), so $1 and $2 are still the 2 ports.
    • Tests: the legacy round trip, install over a legacy block, reset of a legacy block, and a real zsh run with setopt nounset. The zsh run checks that the user's line after the block still runs.
  3. reset.sh keeps a config the user wrote: correct.
    • It deletes bob-PORT.yaml only when line 1 is the marker (reset.sh:245). This is the same rule as uninstall (bob_plugin.py:1342). The $(head …) inside [ ] does not stop the script under set -e when the file is absent.
    • A test pins the marker text in reset.sh to CONFIG_MARKER, so the two cannot drift.

Non-blocking

  • The perl regex is wider than Python. It accepts each variable in either form, one at a time. So it also removes a mixed block (one bare $VAR, one ${VAR:-}). Python calls that block cannot_tell and leaves it. Setup never wrote a mixed block, and the emergency reset should remove more, not less. Only a note.
  • The probe is not nounset-safe (old code). _PROBE (bob_route.py:292) reads "$VITE_GATEWAY_BASE_URL" bare. Under setopt nounset, the terminal probe fails, because that variable is unset there. Then terminal_ide is "", so rc_probe=ok still holds, but terminal_shell is empty. Use ${VAR:-} in the probe too, for the same reason as the block.
  • The README nounset note. The README now shows the new block. It could also say that an old block still works, and that setup upgrades it.

What I checked

  • Last review: round 2, 2bf2b26, 2026-11-09T09:30:16Z
  • New commits read: 1 (b234116e fix(bob-plugin): local calls skip HTTP_PROXY; rc block is nounset-safe)
  • Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 1's round-2 review (09:30:12Z, approve). I read it in full. Its one non-blocking note (the Makefile comment) is still open and is cosmetic.
    • The author's comment "New fixes after round 2" (11:03:06Z). It names 3 bugs found in the review of #973. I checked each fix against the diff and the code (see "New commit" above). I did not open the linked #973 comment. The commit message, this comment and the tests give the full change.
    • Commit b234116e: I read the full diff of all 5 files (README.md, bob_plugin.py, bob_route.py, reset.sh, test_bob_plugin.py). I also read the code around each change: all urlopen/LOOPBACK call sites, ownership, install, remove, _writable_state, probe, and the reset perl block.
  • I checked that nothing else in the repo holds the old block text. Only bob_route.py, reset.sh, the README and the tests contain it.
  • I did not run the tests. Live tests are not approved, and Go is not installed here.

@vz-ibm vz-ibm 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 @vz-ibm) Claude Code 2.1.316 offload-review skill, @vz-ibm's session resumed 1 of 2 3 of 3 b234116ed8d0 approve

Verdict: approve

Findings

None.

The 3 fixes in b234116e

  1. Local calls skip HTTP_PROXY: fixed.
    • healthy, last_bob_request_ms and signal_hook now use LOOPBACK, an opener with ProxyHandler({}).
    • Only latest_release_tag and fetch still use urllib.request.urlopen. Both go to GitHub, so they keep the user's proxy, as intended.
    • Proof (/usr/bin/python3 3.9, HTTP_PROXY set, no NO_PROXY): urlopen to 127.0.0.1 reached the fake corporate proxy. LOOPBACK.open reached the local server directly:
      [('corp', 'http://127.0.0.1:52519/a'), ('local', '/b')]
      
  2. The rc block works under setopt nounset: fixed. I ran real zsh with setopt nounset in .zshrc, then the block, then a user line:
    new block, terminal:   USER-LINE-RAN | url=http://127.0.0.1:8891
    new block, Bob env:    USER-LINE-RAN | ide=http://127.0.0.1:8891
    legacy, terminal:      .zshrc:5: VSCODE_RESOLVING_ENVIRONMENT: parameter not set | url=unset
    
    • The legacy block stopped the file in a terminal, and the new block does not. The Bob-env guard still sets the IDE address.
    • ownership accepts both exact forms through our_blocks. _present picks the form that is in the file. install replaces a legacy block on the same port, and does not return already. remove takes out either form byte for byte.
    • reset.sh perl regex: I ran the program from reset.sh on 3 files: the new block, the legacy block, and a block with one character edited. The results were exit 0, exit 0 and exit 4. Both good forms leave alias g=gittail, the exact user bytes. The edited block is refused.
  3. reset.sh keeps a config the user wrote: fixed. It now deletes bob-PORT.yaml only when line 1 is the marker. A missing file is safe under set -eu: the command substitution is inside an if test. A test pins the marker string to PLUGIN.CONFIG_MARKER, so the two cannot drift apart.

Earlier findings

  • Reviewer 1, round 1, finding 1 (getJson hang): still fixed. b234116e does not change the status bar.
  • Reviewer 2, round 1, finding 1 (data-dependence row): still fixed. b234116e does not change the docs.

Non-blocking

  • doctor reports rc_block=ok for a legacy block. That block still breaks .zshrc for a user with setopt nounset. Only Macs that ran setup from this branch have the legacy form, so the risk is small. A warn with "run setup again" would move those users to the new form.
  • Reviewer 2's round-2 notes (name priced and money in the data-dependence row, and track the MINIMUM_BOB_RELEASE raise in an issue) have no reply yet. Both are non-blocking.

What I checked

  • Last review: round 2, 2bf2b2677bbbb6d6d3510e379b80eabafb2378d0, 2026-11-09T09:30:12Z
  • New commits read: 1 (b234116e fix(bob-plugin): local calls skip HTTP_PROXY; rc block is nounset-safe)
  • Read in full: 4 reviews, 2 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 2's round-2 review (09:30:16Z): I read it in full. It approves and has 2 non-blocking notes. Neither note is answered yet (see above).
    • Comment by vz-ibm at 2026-11-09T11:03:06Z ("New fixes after round 2"). It names 3 bugs that the review of #973 found. I checked each fix in the code, and ran each one where I could (see above). I did not open the linked #973 comment, because the 3 bugs are stated in full here.
    • Commit b234116e: I read all 5 files of the diff, and the code around each change in bob_route.py (ownership, _writable_state, install, remove, is_routed) and bob_plugin.py. I also read the new tests: LoopbackNeverUsesTheUserProxyTest, the nounset zsh test, the legacy-block tests, and the 4 reset.sh tests. Each one asserts specific bytes or paths.
  • I did not run the Go, Python or npm test suites (live tests are not approved). I ran standalone checks only: the Python opener, zsh on both block forms, and the reset.sh perl program on 3 files.

vz-ibm and others added 5 commits November 9, 2026 17:17
The plugin routes the Bob IDE and Bob Shell through a local
context-guru proxy, and gives Bob 7 skills to control it: setup,
status, doctor, update, uninstall, preset picker and cache strategy
picker.

- setup adds one guarded block to the shell startup file and two
  hooks to Bob's settings, after the user's explicit consent. It
  shows the plan first and rolls back on any failure.
- uninstall gives back both files byte for byte.
- The proxy runs as a launchd service on 127.0.0.1, ports 8891-8990.
- The status bar extension shows CG health, context fill and the
  cache clock. It calls only the local proxy.

Bob plugins cannot carry hooks, so setup writes them. The plugin is
macOS only.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
- getJson settles once, and its deadline rejects by itself. A reply
  cut off mid-body (a proxy restart) emits no end and no error, so the
  status bar stopped polling and kept showing CG ✓ while the proxy was
  down. A new test fails without the fix.
- With no data, the status bar shows "saved —", not "saved 0".
- npm ci runs with --ignore-scripts. The build, tests and .vsix do not
  need a dependency's install script.
- docs/data-dependence.md: the Bob plugin row names the status bar and
  doctor, and the fields they read.
- README: the signal hook changes nothing on Bob today, and the stale
  "No status bar yet" line is gone.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
- Calls to the local proxy (healthz, the newest Bob request, the signal
  hook) went through the user's HTTP_PROXY. On a corporate Mac with no
  NO_PROXY for 127.0.0.1 they failed, and the signal hook sent the Bob
  session id to the corporate proxy. They now use an opener with no
  proxy. Downloads from GitHub keep the user's proxy.
- The rc block read $VSCODE_RESOLVING_ENVIRONMENT and
  $__CFBundleIdentifier bare. Under setopt nounset (or set -u) zsh
  stopped reading .zshrc at the block, so every user line after it was
  skipped. The block now uses ${VAR:-}. The legacy form is still ours:
  setup upgrades it, and uninstall and reset remove it byte for byte.
- reset.sh deleted bob-PORT.yaml even when the user wrote it. It now
  deletes it only when the first line is our marker, as uninstall does.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
Setup under bash wrote the block to ~/.bash_profile. Setup again under
zsh wrote a new block to ~/.zshrc and kept only the new file in the
record, so uninstall removed one block, said result=removed, and left
~/.bash_profile routing Bob to a proxy that was gone. rc_created was
also kept from the old file and applied to the new one.

Setup now removes our exact block from the old file once the new block
is in place, so Bob stays routed throughout. An edited old block is left
alone and reported. rc_created is kept only for the same file.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
Three tests ran setup under SHELL=/bin/zsh and expected exit 0.
Setup then ran the real zsh rc probe. The test home is not a macOS
home, so the probe saw nothing. Setup reported installed_not_verified
and exited 1. This failed on the Linux CI runner, which has /bin/zsh.

The tests are about the old rc block, not the probe. They now stub
bob_route.probe, as test_a_probe_miss_is_reported_plainly does.
The product code is unchanged.

Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator

Summary

PR #968 is rebased on main. CI is green.

What changed

Why the tests failed

  • The 3 tests run setup with SHELL=/bin/zsh and expect exit 0.
  • setup then ran the real zsh rc probe. The test home is not a macOS home, so the probe saw nothing.
  • setup returned installed_not_verified and exit 1.
  • Other probe tests skip or stub the probe. These 3 did neither.

How it was tested

  • Python suite on macOS: 179 tests pass.
  • TestBobPluginPythonSuite with -race on the Linux box: pass.
  • go vet ./... on the box: clean.
  • CI: all checks pass, CodeQL included.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

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 @amiddavid) Claude Code 2.1.319 offload-review skill, @amiddavid's session fresh 1 of 2 4 of 4 6fa1627e64ed blocking

Verdict: blocking

The new commit 62d2a91e fixes the shell-change leak on the success path. But a setup that fails after the shell change now removes the route from both files and still reports rolled_back=true.

Findings

  1. bob-plugin/context-guru/scripts/bob_plugin.py:653-654 — a failed re-run after a change of shell leaves Bob routed nowhere, and says rolled_back=true
    • What fails: setup ran under bash, so ~/.bash_profile has our block. The user switches to zsh and runs setup again. _remove_old_rc_block deletes the old block (and the file, if setup created it) right after the new block goes in. A later step then fails (bob_hooks.install, install_escape_hatch, or the final write_record). Undo.run removes the new .zshrc block, because had["rc"] is about the new file only. Nothing puts the old block back. Result: no file routes Bob. The old service is back and healthy, and the record (write_record(self.old_record)) still names .bash_profile. doctor then reports a missing block.
    • This breaks the rule in the code itself: "What was already in place before this run. A failed re-run must not undo it." (bob_plugin.py:624).
    • Proof: a scratch test on TempHome (in /tmp, not in the worktree). Setup under bash, then setup under SHELL=/bin/zsh with bob_hooks.install patched to raise OSError("disk full"):
      before: bash_profile routed = True
      exit 1
      old_rc_file=.../home/.bash_profile
      old_rc_block=removed
      result=setup_failed
      detail=disk full
      rolled_back=true
      after: bash_profile exists = False routed = False
      after: zshrc routed = False
      record rc_file = .../home/.bash_profile
      
    • Fix (pick one):
      • Move the old-block removal to the end of the try, after the final write_record(record). Then any failure leaves the old block in place, and Bob stays routed through the old file.
      • Or add an undo step that restores the old file's bytes (snapshot it first, as old_config does).
    • Add a test for this case: shell change plus a failure after the rc step must leave the old block routed.

Non-blocking

  • The docstring of _remove_old_rc_block (:594) says "uninstall still names the old file in old_rc". No old_rc key goes into the record (:630-632). Uninstall and reset.sh read only rc_file, which is now the new file. So on the OSError branch, the old block stays after uninstall, and uninstall says result=removed. This is the same leak that the commit fixes, on a rare path. Store old_rc_file in the record when the removal fails, and have uninstall and reset.sh remove it too. Or fix the docstring. For an edited block, leaving it is right.
  • 6fa1627e is test-only. The good_probe stub matches what test_a_probe_miss_is_reported_plainly does. The 3 tests still check the old block, the user's .zshrc bytes, and old_rc_block= output. None is weaker.

Status of earlier findings

  • Reviewer 1, round 1, finding 1 (getJson hang): still fixed. client.ts is unchanged since round 3.
  • Reviewer 2, round 1, finding 1 (data-dependence row): still fixed. The new commits do not change what the plugin reads. The row stays correct.
  • Earlier non-blocking notes (Makefile comment line, MINIMUM_BOB_RELEASE, priced/money in the row, the legacy block in doctor, the probe under nounset): no change. They stay non-blocking.

What I checked

  • Last review: round 3, b234116ed8d0d73068aa8d7a07b24100b276c4c7, 2026-11-09T13:55:40Z
  • New commits read: 2 (62d2a91e fix(bob-plugin): a shell change between setups leaves no old rc block; 6fa1627e test(bob-plugin): stub the rc probe in the shell-change tests)
  • The branch was rebased on main, so b234116e is not an ancestor of HEAD. git range-diff 587a8658..b234116e 682f6a9e..HEAD shows the 3 plugin commits unchanged (=). The 4 #967 commits dropped out; #967 is on main as 682f6a9e. So the new work is git diff 9e2de5d0..HEAD, and I read all of it.
  • Read in full: 6 reviews, 3 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 2's round-3 review (13:55:22Z): read in full. It approves at the old head. Its 3 notes are non-blocking.
    • Comment by amiddavid at 15:46:02Z (rebase and test fix). I checked its claims: the rebase dropped only the #967 commits, and 6fa1627e changes only the test file. This does not mention 62d2a91e, a product-code change. "Product code: unchanged" is true only for 6fa1627e.
    • Commit 62d2a91e: I read the diff, all of _setup_changes, Undo, uninstall, _find_our_rc_file, and bob_route.install/remove/backup_once. I traced rc_created for both files: the new file keeps the old value only when it is the same file. That is correct. The failure path gives finding 1.
    • Commit 6fa1627e: see Non-blocking.
  • I ran one scratch Python test (/usr/bin/python3, imports test_bob_plugin, temp home). I did not run Go, the full Python suite or npm (live tests are not approved).

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

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 @amiddavid) Claude Code 2.1.319 offload-review skill, @amiddavid's session fresh 2 of 2 4 of 4 6fa1627e64ed blocking

Verdict: blocking

The new shell-change fix (62d2a91e) is correct on the success path. It removes the old block before the run can fail, so a failed re-run no longer puts the old route back. The test-stub commit (6fa1627e) is correct.

Findings

  1. bob-plugin/context-guru/scripts/bob_plugin.py:653-654 — a failed re-run after a change of shell leaves Bob with no route, and reports rolled_back=true
    • What fails: the first setup ran under bash and wrote ~/.bash_profile. Setup then runs again under zsh. It installs the block in ~/.zshrc, then _remove_old_rc_block removes the block from ~/.bash_profile. If setup created that file, it also deletes the file. After that, a later step in the same try fails: bob_hooks.install (:656), install_escape_hatch (:657), the last write_record (:664), or Ctrl-C, which the code handles on purpose (:665).
    • Trace of Undo.run for this case:
      • hooks: had["hooks"] is True (the first setup installed them), so nothing changes.
      • rc: had["rc"] checks only the NEW file (:626), so it is False. bob_route.remove(~/.zshrc) removes the new block.
      • service: the old plist goes back. older is True, so write_record(old_record) puts back rc_file=~/.bash_profile.
      • Nothing puts back the old block. The removal is not an undo step.
    • Result: neither file has a block, so Bob is not routed. The output says rolled_back=true. The record names ~/.bash_profile, and that file holds no block. doctor then reports a missing block. Before this commit, the same failure left the old block in place, so Bob stayed routed.
    • This breaks the rule in the code itself: "What was already in place before this run. A failed re-run must not undo it." (:624).
    • Fix: move the _remove_old_rc_block(...) call out of the rc_file is not None branch. Put it after the last write_record(record) (:664), still inside the try, or right after the try. The new block is still in place first, so "Bob is routed throughout" stays true. Add a test: bash setup, then a zsh re-run where bob_hooks.install raises. Then check that ~/.bash_profile still holds the block.

Non-blocking

  • The docstring at :594 names a safety net that does not exist. It says "uninstall still names the old file in old_rc". No code writes old_rc to the record (grep old_rc finds only setup). The record's rc_file now names the new file. So when bob_route.remove fails with OSError on an exact block, uninstall and reset.sh never touch the old file again, and the old bug comes back for that case. Fix the docstring, or store old_rc_file in the record when the removal fails, and have uninstall and reset.sh read it.
  • The rc_created change has no test that fails on the old code. Test 1 puts alias ll=… in ~/.zshrc. bob_route.remove deletes a file only when it is empty after the removal. So the file stays, whatever rc_created is. The case that matters is an empty ~/.zshrc that the user owns: the old code deletes it at uninstall. Use zshrc.write_bytes(b"") in a test, and check that the file still exists after uninstall.
  • A move to a shell with no rc file (fish, for example) still leaves the old block. rc_file is None, so old_rc and not same_rc is never reached. The record then stores rc_file=None. uninstall and reset.sh look only in the candidates for the current $SHELL, which is an empty list for fish. So uninstall says result=removed and leaves ~/.bash_profile with a block. fish does not read that file, so the risk is small. It routes Bob to a stopped proxy only if the user goes back to bash.
  • The author's comment at 15:46 says "Product code: unchanged" and "One new commit". Since round 3 there are two new commits. 62d2a91e changes what setup does. The comment is true only for 6fa1627e. This is not a behavior change for released users, because the plugin is new in this PR.

Status of earlier findings

  • Reviewer 1, round 1, finding 1 (getJson hang): fixed in 2bf2b267. The rebase did not change it (git range-diff shows =).
  • Reviewer 2, round 1, finding 1 (data-dependence row): fixed in 2bf2b267. The new commits do not change what the plugin reads, so the row is still correct.
  • Earlier non-blocking notes (Makefile comment line, MINIMUM_BOB_RELEASE, priced/money in the row, the probe under nounset, a doctor warn for a legacy block): no change and no reply. All are non-blocking. I keep none of them as findings.

What I checked

  • Last review: round 3, b234116ed8d0d73068aa8d7a07b24100b276c4c7, 2026-11-09T13:55:22Z
  • New commits read: 2 (62d2a91e fix(bob-plugin): a shell change between setups leaves no old rc block; 6fa1627e test(bob-plugin): stub the rc probe in the shell-change tests)
    • The branch was rebased, so b234116e is not an ancestor of HEAD. git range-diff shows that the 3 old plugin commits are identical (=) and the 4 #967 commits were dropped (they are on main as 682f6a9e). So I diffed 9e2de5d0..HEAD (the rebased b234116e). It touches only bob_plugin.py and test_bob_plugin.py.
  • Read in full: 6 reviews, 3 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 1's round-3 review (13:55:40Z, approve): read in full. Its non-blocking notes are still open, and none is a defect.
    • Comment by amiddavid (15:46:02Z, the rebase report): I checked the rebase with git range-diff and the test fix in 6fa1627e. Its "product code unchanged" claim is wrong for 62d2a91e (see Non-blocking).
    • Commit 62d2a91e: read the diff, all of setup and _setup_changes, Undo, uninstall, _find_our_rc_file, and bob_route.remove, candidates, rc_candidates, _block. Traced success, edited old block, OSError, a failed later step, and a move to fish. Finding 1 and the notes come from these traces.
    • Commit 6fa1627e: the stub returns ide=http://127.0.0.1:<port> and terminal_ide="", which is what ok needs (:684). The first setup in each test runs under the TempHome default SHELL=/bin/bash, as other passing tests do. The uninstall in test 1 runs inside the stub too.
  • I did not run the tests. Live tests are not approved, and Go is not installed here.

After a change of shell, setup removed the old rc block right after
it wrote the new one. A later step could then fail (hooks, escape
hatch, the last record write, Ctrl-C). The rollback removed the new
block and nothing put the old one back. No file routed Bob, and the
output said rolled_back=true.

Setup now removes the old block as its last step, after the final
record write. A failed run leaves the old block in place.

New test: a bash setup, then a zsh re-run where bob_hooks.install
raises. The old .bash_profile block must stay.

Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator

Round 4: fixed in 04b7f2f

Both reviewers found the same defect. After a change of shell, setup removed the old rc block right after it wrote the new one. A later failure rolled back the new block, and nothing put the old one back. No file routed Bob.

What changed

  • Fix. _remove_old_rc_block now runs as the last step of setup, after the final write_record. A failed run leaves the old block in place.
  • Test. test_a_failed_shell_change_keeps_the_old_rc_block. It runs a bash setup, then a zsh re-run where bob_hooks.install raises OSError. It checks setup_failed and that ~/.bash_profile still routes Bob.
  • Before the fix: the test fails with "the old .bash_profile block was removed".
  • After the fix: the test passes.

How it was tested

  • Python suite on macOS: 180 tests pass.
  • TestBobPluginPythonSuite with -race on the Linux box: pass.

CI

  • CodeQL, DCO, purego, trivy, record: pass.
  • build-test fails on timing tests in packages this PR does not touch: TestStatuslineGoldenWeeklyTip (render took 3.1 s, limit 1 s), then on rerun TestKeepAliveSendsTheSweepQuestionInPlaceOfTheNextPing and TestDashboardAddsNoRequestLatencyWithContentCapture.
  • Docs build fails on main too (569c609): research/compaction-client-vs-server.md is not in the mkdocs nav.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

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.319 offload-review skill, @amiddavid's session fresh 2 of 2 5 of 5 04b7f2f6ae5b approve

Verdict: approve

The round-4 defect is fixed. 04b7f2f6 moves the old-block removal to the last step of setup, after the final write_record. A failed re-run now leaves the old block in place, so Bob stays routed. The new test covers the exact case both reviewers named. I found no new defect.

Findings

None.

Status of earlier findings

  • Reviewer 1, round 4, finding 1, and my round-4 finding 1 (a failed re-run after a shell change leaves Bob routed nowhere): fixed in 04b7f2f6. I traced the failure path in bob_plugin.py:635-671:
    • First setup under bash: record names .bash_profile, rc_created=True. Re-run under zsh: the new block goes into ~/.zshrc, then bob_hooks.install raises.
    • undo.run now runs with the old block untouched: had["hooks"] is True, so hooks stay; had["rc"] is False for the new file, so ~/.zshrc is removed (the run created it with only our block, so rc_created=True deletes it — correct, it did not exist before); the old plist goes back; write_record(old_record) restores rc_file=~/.bash_profile. Every file matches the record.
    • The removal call moved out of the rc_file is not None branch to :665, with the same old_rc and not same_rc guard. The added rc_file is not None check keeps the old meaning. The success path is unchanged: test_a_shell_change_removes_the_bash_profile_setup_had_created (test_bob_plugin.py:618-632) still passes old_rc_block=removed.
    • The probe-miss path (installed_not_verified, exit 1) runs after the try, so the old block is already gone there. That is right: the new route is fully in place, and both blocks name the same port.
    • The new test test_a_failed_shell_change_keeps_the_old_rc_block (test_bob_plugin.py:603-616) fails on the old code, because the old code removed the block before bob_hooks.install ran.
  • Reviewer 1, round 1, finding 1 (getJson hang): still fixed. No commit since round 4 touches the status bar.
  • My round-1 finding 1 (data-dependence row): still fixed. The new commit changes no read.
  • Round-4 non-blocking notes (the :594 docstring, the empty-~/.zshrc rc_created test, the fish case): no change. All still non-blocking.

Non-blocking

  • The docstring at bob_plugin.py:594 still names a safety net that does not exist. It says "uninstall still names the old file in old_rc". No code writes an old_rc key to the record. With the new order, the OSError branch of _remove_old_rc_block can only fire at the very end of a successful setup, and the record then names the new file. Uninstall and reset.sh never touch the old file again. Both round-4 reviews raised this. Fix the docstring, or store old_rc_file in the record when the removal fails. The old block routes to the same port, so the risk stays small.
  • A Ctrl-C during the final removal can still leave no route. KeyboardInterrupt is not caught by _remove_old_rc_block (:598), so it reaches the outer handler, and undo.run removes the new block. If the interrupt lands after bob_route.remove replaced the old file (bob_route.py:264-268), no file routes Bob. The window is one atomic os.replace at the end of a successful run, so this is a note, not a finding. Snapshotting the old file, as old_config does, would close it.
  • CI failures outside this PR. The author reports build-test fails on timing tests in packages this PR does not touch, and the docs build fails on main too. Per the repo rules, these need their own issues, not a fix here. Consider filing them, so they are not lost.

What I checked

  • Last review: round 4, 6fa1627e64ed7ea771b97197bfd9a8162d8e7cce, 2026-11-09T15:51:59Z
  • New commits read: 1 (04b7f2f6 fix(bob-plugin): keep the old rc block until setup succeeds)
  • Read in full: 7 reviews, 4 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Commit 04b7f2f6: I read the full diff and the code around it: all of _setup_changes, _remove_old_rc_block, Undo.run and _undo, and bob_route.install, remove, is_routed, _atomic_write. I traced the failure path (see above), the success path, the probe-miss path, and a first-ever setup.
    • Comment by amiddavid at 16:42:30Z ("Round 4: fixed in 04b7f2f"): each claim matches the diff. The CI failures it reports are in packages this PR does not touch (see Non-blocking).
    • The new test: I checked its shape against the other shell-change tests. The first bash setup expects exit 0 with a real probe, as test_setup_starts_the_service_then_routes_and_verifies does. The zsh re-run stubs the probe, as 6fa1627e taught. The assertion targets the old .bash_profile, the file the defect was about.
  • I did not run the tests. Live tests are not approved, and Go is not installed here.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator

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.319 offload-review skill, @amiddavid's session fresh 1 of 2 5 of 5 04b7f2f6ae5b approve

Verdict: approve

The round-4 defect is fixed. 04b7f2f6 moves the old-block removal to the last step of setup, after the final record write. A failed re-run after a change of shell now leaves the old block in place, and Bob stays routed. The new test pins this.

Findings

None.

The fix in 04b7f2f6

  • Correct placement. _remove_old_rc_block now runs after write_record(record) with record["complete"] = True (bob_plugin.py:663-666). Before, it ran right after bob_route.install, so a later failure rolled back the new block and left no route.
  • Failure trace, verified. A zsh re-run that fails at bob_hooks.install: Undo.run keeps the hooks (had["hooks"] is True from the first setup), removes only the new .zshrc block (had["rc"] is about the new file), puts back the old plist, and restores the old record. That record names .bash_profile, which still holds the block. So the record and the files agree, and Bob stays routed.
  • The new test is right. test_a_failed_shell_change_keeps_the_old_rc_block (test_bob_plugin.py:603): the outer with stubs find_binary and first_free_port for both runs, and FakeProxy stays up, so the second run reaches the hooks step. It asserts exit 1, result=setup_failed, and that .bash_profile still routes. On the old code the removal ran before the hooks step, so the test fails there. The author confirms this.
  • Other paths checked. A failure at the escape hatch, the status bar, or the final write_record now also leaves the old block. The probe-miss path (installed_not_verified) still removes the old block, and that is safe: the new block is in the file. RouteRefused and OSError inside _remove_old_rc_block are caught there, so they do not fail setup.

Non-blocking

  • The docstring at bob_plugin.py:594 still names a safety net that does not exist. It says "uninstall still names the old file in old_rc". No old_rc key goes into the record (grep old_rc finds only setup and the docstring). When the old-block removal fails with OSError, the old block stays, and uninstall and reset.sh never touch it. Same note as round 4, still open. For an edited block, leaving it is right.
  • A Ctrl-C inside _remove_old_rc_block itself can still leave no route. The removal is atomic (_atomic_write or unlink), but a Ctrl-C after it and before the call returns lands in the rollback: the old block is gone, and undo removes the new block. The window is now the removal call only. Before this commit it was the whole stretch after the rc install. This is inherent to the fix both reviewers proposed. Note only.
  • A move to a shell with no rc file (fish) still leaves the old block. rc_file is None, so the removal never runs. Reviewer 2 raised this in round 4. The risk is small: fish does not read .bash_profile.
  • The rc_created empty-file case still has no test. Reviewer 2's round-4 note. A user-owned empty .zshrc must survive uninstall.
  • Older notes (Makefile comment line, MINIMUM_BOB_RELEASE, priced/money in the data-dependence row, the probe under nounset, a doctor warn for a legacy block): no change, all non-blocking.

Status of earlier findings

  • Round 4, finding 1 (both reviewers, the same defect): fixed in 04b7f2f6. See above.
  • Round 1, reviewer 1, finding 1 (getJson hang): still fixed. client.ts is unchanged since round 2.
  • Round 1, reviewer 2, finding 1 (data-dependence row): still fixed. The new commits change no read path.

What I checked

  • Last review: round 4, 6fa1627e64ed7ea771b97197bfd9a8162d8e7cce, 2026-11-09T15:51:17Z
  • New commits read: 1 (04b7f2f6 fix(bob-plugin): keep the old rc block until setup succeeds)
  • Read in full: 8 reviews, 4 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 2's round-4 review (15:51:59Z): read in full. Its finding 1 is the same defect as mine. Its 4 non-blocking notes: I checked each one myself (see Non-blocking). The docstring, fish and empty-.zshrc notes are still open. The note on the author's 15:46 comment is settled by the new comment.
    • The author's comment "Round 4: fixed in 04b7f2f" (16:42:30Z): I checked each claim against the diff. The fix and the test match. The test count 180 fits 179 plus one new test. The CI failures it names (TestStatuslineGoldenWeeklyTip, TestKeepAliveSendsTheSweepQuestionInPlaceOfTheNextPing, TestDashboardAddsNoRequestLatencyWithContentCapture, docs nav) sit in packages this branch does not touch: the branch diff is bob-plugin/ plus one docs line, 30 files.
    • Commit 04b7f2f6: I read the diff and the code around it: all of _setup_changes, _remove_old_rc_block, Undo.run and Undo._undo, and bob_route.install/remove/is_routed. I traced the failure path step by step (see above). I read the new test and the TempHome/FakeProxy helpers it relies on, to confirm the second run reaches the hooks step.
  • I did not run Go, Python or npm tests. Live tests are not approved, and Go is not installed here.

@amiddavid
amiddavid merged commit 1032987 into main Nov 9, 2026
14 of 17 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 9, 2026
vz-ibm added a commit that referenced this pull request Nov 10, 2026
The test from #968 already pins the order: setup removes the old block only
after the last step that can fail. The new test ran the same steps.

Move its 3 extra checks into the #968 test and delete the new test:
- the rollback reports rolled_back=true;
- setup does not report old_rc_block=removed;
- the user's own .zshrc is byte-identical after the rollback.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Vitaly Zabershinsky <[email protected]>
amiddavid pushed a commit that referenced this pull request Nov 11, 2026
)

The test for a failed re-run after a change of login shell
(test_a_failed_shell_change_keeps_the_old_rc_block, from #968) now
also checks the rollback report and the user's own .zshrc: the output
has rolled_back=true, has no old_rc_block=removed, and .zshrc is
byte-identical after the rollback. main already has the right order;
this pins it.

Behavior change: none (one test). Data dependence: none.

Reviews: 2 offload reviews (Claude), round 2, both approve at
2f02885, which is the PR head.

Signed-off-by: Vitaly Zabershinsky <[email protected]>
Assisted-By: Claude Opus 5.5 <[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.

2 participants