Skip to content

fix(pi): the review notes left on #1010, #1011 and #1049 - #1058

Merged
amiddavid merged 2 commits into
mainfrom
fix/pi-review-notes
Nov 11, 2026
Merged

amiddavid merged 2 commits into
mainfrom
fix/pi-review-notes

Conversation

@amiddavid

@amiddavid amiddavid commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior change

None for users: the Pi package has no users yet (owner decision on #1049). The small changes in Pi-only behavior:

  • configure from the extension gets 60 s, not 30 s.
  • A command that waits more than 40 s for the restart lock stops and says busy. Before, it waited with no limit.

Summary

This PR fixes the non-blocking notes that the reviewers left on #1010, #1011 and #1049. Each note failed safe, so nothing was broken. All changes are in pi-package/ and one row of docs/data-dependence.md.

What changed

Restart lock (pi_plugin.py)

Extension (context-guru.ts)

Setup question (pi_plugin.py)

Docs

Not changed: restart.lock stays in the state directory (#1011, reviewer 2). It is an empty file, and uninstall keeps the state directory on purpose.

How it was tested

  • python3 -m unittest discover -s scripts: 90 tests pass (9 new):
    • a restart that waits too long for the lock reports busy and runs no service command;
    • a restart reads the record again after the wait (a mutation that removes the re-read fails this test);
    • with no fcntl, restart reports unsupported;
    • setup with a busy lock writes no config, no record and no models.json;
    • two providers with headers read "set", and the quota wording names both;
    • round 1 of the review: configure and restart read the record again after the wait, update after an uninstall during the wait, and the configure and update busy paths.
  • node --test tests/*.test.ts: 27 tests pass. New asserts for the busy and killed reasons and the "; " separator.
  • tsc strict against Pi 1.5.0 types: no errors.

Data dependence

No change. Metadata only, as before. The docs row now states it more exactly.

🤖 Generated with Claude Code

- restart reads the install record again after it takes the lock.
- setup and update write the config and the record under the restart lock.
- The lock wait has a 40 s limit. restart reports result=busy; configure,
  setup and update refuse with reason=busy and write nothing.
- With no fcntl (a state directory copied to Windows) there is no lock,
  and restart reports service=unsupported, not a traceback.
- The extension gives configure 60 s, as restart has. A restart stopped
  at the 60 s limit says so, not "the restart did not run".
- The headers warning says "set" for two providers, and the chained quota
  wording names the chained providers.
- conflictWords joins with "; ", because a URL can hold a comma.
- data-dependence: restart does not read the proxy URLs.

Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude (Anthropic AI) <[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.322 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 795261b20716 blocking

Verdict: blocking

Findings

  1. pi-package/scripts/pi_plugin.py:883 — a restart that waited for the lock still checks the port it read before the wait

    • What fails: session A runs restart and waits for the lock. A setup from session B holds the lock, picks a new port (choose_port, because the old one is held by another program), starts the proxy there and writes the new record. Restart A re-reads the record under the lock (line 878) but keeps the old port from line 863. So it health-checks the old port (883), restarts the service a second time (886, one extra cache rewrite), waits on the old port (887) and reports result=down port=<old>. The extension then warns that the proxy on the old port does not answer, while it is up on the new port.
    • Proof: port is set only at line 863, before restart_lock() at 872. The re-read at 878 refreshes record for rerender_config only. healthy(port) at 883, wait_healthy(port) at 887 and where["port"] at 867 all use the pre-wait value. Setup can change the port under the lock only since this PR (setup takes the lock at line 753), so the PR's own comment at 877 ("a configure that ran while this one waited wrote a new record") names one writer but not the one that moves the port.
    • Fix: after the re-read, do port = int(record.get("port") or port) and refresh where["port"].
  2. pi-package/scripts/pi_plugin.py:983 — update crashes with a KeyError when the record it re-reads under the lock has no port

    • What fails: update --install passes the port guard at line 968, then waits up to 40 s for the lock. An uninstall during that wait (uninstall takes no lock) deletes install.json. The re-read at line 978 returns {}. Line 980 then writes a new install.json that holds only binary. Line 983 runs int(record["port"]) and raises KeyError: a traceback on stderr, no facts, and a leftover record file. The extension prints context-guru update: with empty fields.
    • Proof: the guard at 968 tests the record read at line 952, before the lock. The re-read at 978 is new in this PR, and nothing between it and line 983 checks port again. Every other command reports a fact and an exit code; this path reports neither.
    • Fix: after the re-read, repeat the guard: no port → facts(result="updated", version=version, restart="skipped"), return 0.

Non-blocking

  • configure (pi_plugin.py:917-924) does not re-read the record under the lock, unlike restart and update in this PR. A configure that waited writes its pre-wait snapshot back, so a setup that ran during the wait loses its port, upstreams and base_urls in the record. This race is pre-existing, not made worse here. But the PR's own framing ("the config and the record change together under the restart lock") argues for the same re-read there.
  • The killed fact (context-guru.ts:294-297) assumes pi.exec resolves with a killed field when it stops the child at the time limit. No file in this repo pins that contract, and no test wires run() to the facts. If pi.exec rejects on a kill instead, checkAtStart's catch swallows it and the notice falls back to "the restart did not run" — the exact message this PR means to replace.
  • restart_lock(wait) (pi_plugin.py:849-850) names LOCK_WAIT_SECONDS in the LockBusy message even when a caller passes a custom wait. No caller passes one today.
  • The configure busy path (pi_plugin.py:913-916) has no test, while the restart and setup busy paths do.
  • In test_a_restart_that_waits_too_long_for_the_lock_reports_busy, the last assertion reads the patched value of LOCK_WAIT_SECONDS (0.2), so it cannot fail against a bad constant.

What I checked

  • The full diff of 795261b against 8d3452c, and the code around each change.
  • pi_plugin.py: restart_lock (poll loop, deadline, ImportError path, handle cleanup), setup, restart, configure, update, start_service, restart_service, rerender_config, choose_port, consent_question.
  • Lock use: every restart_lock() caller handles LockBusy; no nested lock takes, so no deadlock; uninstall still takes no lock (pre-existing).
  • Timing: LOCK_WAIT_SECONDS=40 against the extension's 60 s for restart and configure, and 300 s for setup and update. A restart that overruns 60 s now reports through the killed fact.
  • The extension: downReason order (killed, not_installed, busy, service), conflictWords join, run/parseFacts, checkAtStart.
  • The new tests: traced each one by hand (lock held across a thread, fcntl removed from sys.modules, the plural wording). Both Python files parse.
  • docs/data-dependence.md: the row now separates what the extension reads (port, proxy URLs) from what restart reads. It matches the code and changes no data dependence.
  • I did not run the Python or Node tests: live tests are not approved for this review.

@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.322 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 795261b20716 blocking

Verdict: blocking

Findings

  1. pi-package/scripts/pi_plugin.py:917-925 — configure writes the record and the service command from a snapshot read before the lock wait, so a setup that ran during the wait is undone.

    • What fails: configure reads the record at :893 and takes upstreams and by_name from it at :908-909. It then waits up to LOCK_WAIT_SECONDS (40 s) for the lock. Under the lock it writes the config from the stale upstreams (:919), writes the whole stale record back (:923-924), and after the lock rewrites the service command with the stale upstreams (:925). A setup that held the lock during the wait (it holds the lock across its own config write, start_service and record write, :757-772) loses everything it added: the record is reverted, and the service unit or plist is rewritten without that provider's --<provider>-upstream flag. The proxy then forwards that provider to the public API (api.anthropic.com) with the gateway's key and headers from models.json. Requests fail, and the gateway credential goes to a different endpoint. Nothing self-heals: a later session-start restart re-renders from the clobbered record.
    • Proof: the PR adds the under-lock re-read to restart (:878, with the test test_a_restart_reads_the_record_again_after_the_lock) and to update (:978) for exactly this hazard — its own test docstring says "a configure that ran during the wait is not undone". The mirror case, a setup that ran while configure waited, is not fixed: configure never re-reads the record. write_record(record) at :924 serializes the full pre-lock dict, so fields configure does not own (upstreams, base_urls, port) are reverted too.
    • Fix: re-read the record under the lock in configure, as restart and update do. Keep the values given on the command line (args.preset, args.cache_strategy); take upstreams, by_name, port and binary from the fresh record. setup has the same shape for the fields it takes from the record (preset, cache_strategy at :673-674) — apply the same re-read there, keeping args.cache_strategy when given.
  2. pi-package/extensions/context-guru.ts:294-297 — the new killed fact has no test, and its source (pi.exec's result field) cannot be verified in this repo.

    • What fails: the new message "the restart did not finish within 60 seconds and was stopped" (downReason, :85) shows only when pi.exec resolves with a truthy killed field after the 60 s timeout. If pi.exec rejects on a timeout instead, or the field has another name, the wrapper never sets the fact: checkAtStart's catch (:151-155) swallows the rejection, facts stays empty, and the user sees "the restart did not run" — the exact wrong message this change was made to fix.
    • Proof: the wrapper is inline in the default export, so no test covers it. The tests cover only downReason with a hand-made killed: "true" (pi-package/tests/context-guru.test.ts:166). @earendil-works/pi-coding-agent is a peer dependency and is not vendored in this repo, so I could not read pi.exec's contract to confirm the field exists or that a timeout resolves rather than rejects.
    • Fix: extract the wrapper into an exported helper (input: the run result; output: the facts) and test it with a stubbed result that has killed: true, killed: false, and a rejection. Or name where pi's API defines killed, so the contract is checkable.

Non-blocking

  • restart_lock's LockBusy message names LOCK_WAIT_SECONDS even when wait is passed explicitly (pi_plugin.py:849-850). No production caller passes wait, so the parameter is dead and the message can lie in tests that use it.
  • The comment at pi_plugin.py:750-751 ("The config, the start and the record happen under the restart lock, as in configure") is wrong about configure: its start_service runs outside the lock (pi_plugin.py:925).
  • LOCK_WAIT_SECONDS (40) sits under the real worst-case hold. restart_service's launchd path can spend about 90 s in subprocess timeouts (pi_plugin.py:558-563), and setup now holds the lock across start_service, whose systemctl/launchctl calls have no timeout (pi_plugin.py:507-510, 524-528). A waiter then reports busy — the designed fallback — but the "about 45 s at most" comment (pi_plugin.py:158-159) understates it.
  • restart re-reads the record under the lock but keeps the pre-lock port for healthy, wait_healthy and the printed facts (pi_plugin.py:863, 883, 887-888). A setup that moved the port during the wait (it does when the recorded port is foreign-held) makes restart check and report the old port. Narrow, and the extension checks the port it read at session start anyway.
  • The data-dependence row now says the extension reads "the port and the proxy URLs" from the install record. The extension also reads cache_strategy and upstreams from it (cache_warming_decision, context-guru.ts:329; stripsChatGPTFields, :199-201). Still metadata only, so the row's level is right.
  • The extension's update message hides the new busy reason: f.version ?? f.reason picks the version, so it prints "context-guru update: error v0.7.2" with no reason (context-guru.ts:486).
  • The configure and update LockBusy branches have no tests; restart and setup do.
  • downReason hardcodes "60 seconds" in its text (context-guru.ts:85) while the limit lives as 60_000 at :295. Change one and the other lies.

What I checked

  • CLAUDE.md and docs/design.md: fail-open, metadata-first, the behavior-change rule.
  • The full diff of 795261b against 8d3452c, and the code around each change: pi_plugin.py (restart_lock, setup, restart, configure, update, consent_question), context-guru.ts (downReason, the restart wrapper, configure, conflictWords), both test files, README.md, the data-dependence row.
  • Traced the lock interleavings between setup, restart, configure and update: what each reads before the wait, what it writes under the lock, and what it writes after the lock.
  • Traced the extension's checkAtStart paths for the busy and killed facts, including the swallow-catch path.
  • Searched the repo for pi.exec's result contract; @earendil-works/pi-coding-agent is not vendored, so the killed field could not be confirmed (finding 2).
  • No tests were run; live tests are not approved for this review.

- configure reads the record again under the lock, so a setup that ran
  during the wait keeps its upstreams, port and base URLs. Only the
  values on the command line come from configure.
- restart uses the port it reads after the wait, so a port that setup
  moved is the one it checks and reports.
- update repeats the port check after the wait: an uninstall during the
  wait gives restart=skipped, not a KeyError and a new partial record.
- setup merges its fields into a fresh copy of the record, and keeps the
  preset and strategy that the consent question named.
- restartFacts() and RESTART_TIMEOUT_MS in the extension, with tests.
  The downReason text reads the limit from the constant.
- The update message shows the reason and detail, not only the version.
- The busy message names the real wait. Comments and the data-dependence
  row are corrected.
- Tests for the configure and update busy paths, and for each finding.

Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
amiddavid added a commit that referenced this pull request Nov 10, 2026
- configure reads the record again under the lock, so a setup that ran
  during the wait keeps its upstreams, port and base URLs. Only the
  values on the command line come from configure.
- restart uses the port it reads after the wait, so a port that setup
  moved is the one it checks and reports.
- update repeats the port check after the wait: an uninstall during the
  wait gives restart=skipped, not a KeyError and a new partial record.
- setup merges its fields into a fresh copy of the record, and keeps the
  preset and strategy that the consent question named.
- restartFacts() and RESTART_TIMEOUT_MS in the extension, with tests.
  The downReason text reads the limit from the constant.
- The update message shows the reason and detail, not only the version.
- The busy message names the real wait. Comments and the data-dependence
  row are corrected.
- Tests for the configure and update busy paths, and for each finding.

Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round 1: replies

All findings are fixed in 4da5bb4a. Each finding has a test that fails on 795261b2 and passes now.

Reviewer 1

  1. configure writes from a snapshot read before the wait: fixed. configure now reads the record again under the lock. Only --preset and --cache-strategy come from the command line. The upstreams, the port, the binary and by_name come from the fresh record. Test: test_configure_reads_the_record_again_after_the_lock. A setup writes new upstreams and base URLs during the wait, and they survive, in the record, the config and the service command.
    • setup: it now merges its fields into a fresh copy of the record. It still writes the preset and the strategy it had before the wait. Those are the values the consent question named, and the user agreed to them, so a configure during the wait must not change them.
  2. The killed contract: verified, and now tested. pi.exec resolves and does not reject when it stops a command. ExecResult.killed is "The command was terminated by pi: timeout, abort, or output over maxBuffer" (@earendil-works/pi-coding-agent 1.5.0, dist/core/exec.d.ts; dist/core/exec.js returns { ..., killed } on every exit). The logic now sits in an exported restartFacts() with a test for killed: true, killed: false and a missing field. A rejection cannot come from a timeout. Other rejections still go to checkAtStart's catch, as before.

Non-blocking, all fixed:

  • The LockBusy message names the real wait (tested: "0.2 seconds").
  • The setup comment no longer says "as in configure".
  • The LOCK_WAIT_SECONDS comment says that slow service commands can make the lock wait longer than 45 s.
  • restart takes the port from the fresh record (reviewer 2, finding 1).
  • The data-dependence row names what the extension reads: the port, the proxy URLs, the cache strategy and the upstreams.
  • The update message shows result, version, reason and detail.
  • The configure and update busy paths have a test.
  • downReason builds its text from RESTART_TIMEOUT_MS, the same constant the exec calls use.

Reviewer 2

  1. restart checks the port it read before the wait: fixed. After the re-read, restart takes port from the fresh record and updates where["port"]. A record with no port now prints not_installed. Test: test_a_restart_checks_the_port_that_a_setup_moved_during_the_wait. Setup moves the port to 8801, and the restart checks 8801 only and reports port=8801.
  2. update KeyError after an uninstall during the wait: fixed. The port check runs again after the re-read: result=updated restart=skipped, and no record is written. Test: test_update_after_an_uninstall_during_the_wait_skips_the_restart.

Non-blocking:

  • configure re-read: fixed (reviewer 1, finding 1).
  • killed contract: see reviewer 1, finding 2.
  • LockBusy message, and the configure busy test: fixed.
  • "The last assertion reads the patched LOCK_WAIT_SECONDS": not so. self.assertLess(pi_plugin.LOCK_WAIT_SECONDS, 60) runs after the with mock.patch.object(...) block has closed, so it reads the real value, 40. No change.

Tests: Python 90 pass (4 new in this round). Node 27 pass. tsc strict: no errors.

@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.322 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 4da5bb4a703a approve

Verdict: approve

Findings

None. Both round-1 findings are fixed, and I found no new defect in 4da5bb4a.

Status of the round-1 findings

  1. Restart checked the pre-wait port (mine, finding 1): fixed. restart now takes port from the record it re-reads under the lock (pi_plugin.py:884-889), refreshes where["port"], and a fresh record with no port prints not_installed. I traced the new test test_a_restart_checks_the_port_that_a_setup_moved_during_the_wait: setup moves the port to 8801 during the wait, and the restart checks and reports only 8801.
  2. Update KeyError after an uninstall during the wait (mine, finding 2): fixed. The port check now repeats after the re-read (pi_plugin.py:996-999): result=updated restart=skipped, no record written. The new test deletes the record during the wait and asserts no restart and no leftover install.json.
  3. Configure wrote a pre-wait snapshot (reviewer 1, finding 1): fixed, and I checked it myself. configure re-reads the record under the lock (pi_plugin.py:927-934). Only --preset and --cache-strategy come from the command line; the upstreams, the port, the binary and by_name come from the fresh record. setup merges its fields into a fresh copy too (pi_plugin.py:761, 773-776). I traced test_configure_reads_the_record_again_after_the_lock end to end: the upstreams and base URLs a setup wrote during the wait survive in the record, the config and the service command.
    • Setup keeps the preset and strategy from before the wait, not from the fresh record. The author's reason: those are the values the consent question named. I accept it. A racing configure also had its own yes, so either order loses one consent; this choice is defensible, not a defect.
  4. The killed contract (reviewer 1, finding 2): fixed. The logic moved to the exported restartFacts() (context-guru.ts:87-91) with tests for killed: true, killed: false and a missing field, and downReason builds its text from RESTART_TIMEOUT_MS. I could not read @earendil-works/pi-coding-agent myself: it is a peer dependency and is not vendored in this repo. The author names the source (ExecResult.killed in dist/core/exec.d.ts, 1.5.0). I accept the named source. If the field were absent anyway, restartFacts degrades to the plain facts, so the path fails open.

Non-blocking

  • My round-1 note about the tautological assertLess was wrong, and the author's rejection is right. I checked the indentation myself: the with mock.patch.object(...) block closes inside the try, and the assertion runs after it, so it reads the real LOCK_WAIT_SECONDS (40). No change needed.
  • configure now computes by_name under the lock (pi_plugin.py:934), which runs the binary's --version (up to 5 s) while holding the lock. restart does the same through rerender_config. This lengthens the hold a little; the busy fact covers a waiter that gives up. No action needed.
  • The remaining round-1 non-blocking items are all fixed in this commit: the LockBusy message names the real wait, the setup comment no longer says "as in configure", the LOCK_WAIT_SECONDS comment no longer understates the hold, the data-dependence row names the cache strategy and the upstreams, the update message shows the reason and detail, and the configure and update busy paths have tests.

What I checked

  • Last review: round 1, 795261b, 2026-11-10T22:14:22Z.
  • New commits read: 1 (4da5bb4a "fix(pi): round 1 review of #1058 - read the record again in configure").
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files; the inline list is empty).
  • New items since my last review: reviewer 1's round-1 review (22:16:17Z) — read in full, its two findings are item 3 and 4 above; the author's reply comment (22:19:21Z) — read in full, every claim in it checked against the code; commit 4da5bb4a — full diff and the code around each change.
  • pi_plugin.py at the new head: restart (884-889), configure (924-942), setup (758-776), update (994-1004), restart_lock (841-855). Traced what each command reads before the wait, under the lock, and after it.
  • The new tests: traced each by hand — the moved-port restart test, the configure re-read test, the update-after-uninstall test, the configure and update busy test, and the during_the_lock_wait helper. Both Python files parse.
  • The extension: restartFacts, RESTART_TIMEOUT_MS, the restart and configure call sites, the update message, and the new Node tests.
  • docs/data-dependence.md: the row now names the port, the proxy URLs, the cache strategy and the upstreams. That matches what readInstall feeds (port, base_urls, cache_strategy, upstreams). Still metadata only.
  • I did not run the Python or Node tests: live tests are not approved for this review. The author reports 90 Python and 27 Node tests passing.

@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.322 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 4da5bb4a703a approve

Verdict: approve

Findings

None. Both round-1 findings are fixed, and the fixes are correct.

Non-blocking

  • configure now runs names_strategies inside the lock (pi_plugin.py:933). That is a --version subprocess with a 5 s limit, so it can lengthen the lock hold, and a waiter can hit busy more often. The trade is right: by_name must match the binary in the fresh record, not the pre-wait one.
  • In context-guru.test.ts, the downNotice(8800, { service: "no_service" }) assertion now sits inside the new "killed fact" test, which is not about that notice. Cosmetic only.
  • setup still takes upstreams, port and earlier from the record it read before the lock (pi_plugin.py:671-686). I checked the author's rule — "the values the consent question named" — and accept it: the consent question described the pre-wait state, setup owns every field it writes, and the same rule covers the kept preset and strategy.

What I checked

  • Last review: round 1, 795261b, 2026-11-10T22:16:17Z.
  • New commits read: 1 — 4da5bb4a "fix(pi): round 1 review of #1058 - read the record again in configure".
  • Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files).
  • New items since my last review, and what I did about each:
    • Reviewer 2's round-1 review (posted 2 minutes before mine; I read it now, per the round-2 rules). Both of its findings match code I traced myself: the stale port in restart and the update KeyError. Both are fixed in 4da5bb4a.
    • The author's reply comment. I checked every claim in it against the code; details below.
    • The new commit. Full diff read, plus the code around each change.

My finding 1 (configure writes from a pre-lock snapshot): fixed. configure re-reads the record under the lock (pi_plugin.py:926-933), repeats the port guard, and takes upstreams, by_name, port and binary from the fresh record. Only --preset and --cache-strategy come from the command line. write_record now serializes the fresh record, so a setup's upstreams, port and base URLs survive. The service command after the lock uses the fresh upstreams and port (pi_plugin.py:943). Test test_configure_reads_the_record_again_after_the_lock covers the record, the config and the service command.

My finding 2 (the killed contract): fixed, and now verified independently. I found @earendil-works/pi-coding-agent 1.5.0 installed globally on this machine and read it: dist/core/extensions/types.d.ts:1303 declares exec(...): Promise<ExecResult>, and dist/core/exec.d.ts defines killed: boolean as "The command was terminated by pi: timeout, abort, or output over maxBuffer". dist/core/exec.js sets killed = true and returns it — it resolves, it does not reject. So the author's citation is accurate, and restartFacts (context-guru.ts:87-91) is correct by contract. It is exported and tested for killed: true, killed: false and a missing field; downReason builds its text from RESTART_TIMEOUT_MS, the same constant the exec calls use.

Reviewer 2's finding 1 (restart checks a stale port): fixed. restart re-reads the port under the lock, updates where["port"], and prints not_installed when the fresh record has no port (pi_plugin.py:884-890). Test test_a_restart_checks_the_port_that_a_setup_moved_during_the_wait asserts the check and the fact both use port 8801.

Reviewer 2's finding 2 (update KeyError after an uninstall during the wait): fixed. The port guard repeats after the re-read (pi_plugin.py:996-998): result=updated restart=skipped, no record written, no service start. Test test_update_after_an_uninstall_during_the_wait_skips_the_restart asserts all three.

Reviewer 2's non-blocking about assertLess reading the patched value: the author's rebuttal is right. I checked the test: self.assertLess(pi_plugin.LOCK_WAIT_SECONDS, 60) sits outside the with mock.patch.object(...) block, so it reads the real constant, 40. No change needed.

Round-1 non-blocking items: all addressed — the LockBusy message names the real wait (with a test asserting "0.2 seconds"), the "as in configure" comment is gone, the LOCK_WAIT_SECONDS comment now names the longer holds, restart takes the port from the fresh record, the data-dependence row names the cache strategy and the chained upstreams the extension reads, the update message shows result, version, reason and detail, the configure and update busy paths have a test, and downReason reads the limit from the constant.

I also traced the new tests by hand (the lock held across a thread in during_the_lock_wait, the record written mid-wait, the unlink mid-wait) and re-checked the round-1 tests against the changed code: test_a_restart_reads_the_record_again_after_the_lock still passes because its mid-wait record keeps port 8800, and the other restart and configure tests are unaffected by the re-reads.

No tests were run; live tests are not approved for this review. The author reports Python 90 pass, Node 27 pass, tsc strict clean; the code reads consistent with that.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Head moved, no code change: the approvals of 4da5bb4a still count

  • Why: the DCO check failed. The Signed-off-by email ([email protected]) did not match the commit author ([email protected]). I rewrote only the two commit messages.
  • Proof: the tree of the new head ae9568f6 is the same as the tree of 4da5bb4a. scripts/release/approval-still-valid.sh 1058 4da5bb4a703a prints: SAME CHANGE: only the base moved. The approval of 4da5bb4a703a still counts. The only difference it shows is the sign-off line.

@amiddavid
amiddavid merged commit e8a8193 into main Nov 11, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 11, 2026
amiddavid added a commit that referenced this pull request Nov 11, 2026
…0.2.12, Pi 0.1.1)

Claude Code plugin 0.6.7 -> 0.7.2:
- #981, #989, #1018, #1035: subscription band and savings show saved tokens.
- #1038: insights drop the finding that credits a user's own removal.
- #1039, #1040: dash and keep-alive fixes that touch the plugin files.

Codex plugin 0.2.11 -> 0.2.12:
- #1051: read the cache strategies and presets from the proxy.
- The vendored cg.py gets the same plugin changes.

Pi package 0.1.0 -> 0.1.1:
- #1010: chain the proxy in front of an existing base URL.
- #1011: check the proxy at session start and restart it once.
- #1049, #1058: write the cache strategy by name; review fixes.

OpenCode plugin (#483): new in v0.7.2, no version file, not changed.
Bob plugin 0.1.0: no change since v0.7.1, not changed.

Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
amiddavid added a commit that referenced this pull request Nov 11, 2026
Bump the plugin versions for v0.7.2.

- Claude Code plugin 0.6.7 -> 0.7.2: #981, #989, #1018, #1035 (savings
  in tokens on a subscription), #1038, #1039, #1040, #1055 (cache
  strategies read from the proxy).
- Codex plugin 0.2.11 -> 0.2.12: #1051 (cache strategies and presets
  read from the proxy), plus the vendored cg.py changes.
- Pi package 0.1.0 -> 0.1.1: #1010, #1011, #1049, #1058, and the #1040
  README line.
- OpenCode plugin: new in v0.7.2 (#483), no version file. Its first
  start now downloads proxy v0.7.2 (was v0.7.1). Nothing compares
  against PINNED_VERSION; the floor stays "v0.7.1 or later". The README
  lines, the install guide and 3 tests follow.
- Bob plugin: 0.1.0, no change since v0.7.1.

Behavior change: the OpenCode plugin's first download is proxy v0.7.2,
not v0.7.1. Owner's yes, 2026-11-11, in the integrator session: "option1
it is"; the version bumps: "I approve the version bumps for the
plugins".

Data dependence: none.

Reviews: 3 offload review rounds (GLM; round 3 pre-approved by the
owner). Both reviewers approve at 3cf6176, which is the PR head.

Signed-off-by: DAVID AMID <[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.

1 participant