Repository navigation
fix(pi): the review notes left on #1010, #1011 and #1049 - #1058
Conversation
- 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
left a comment
There was a problem hiding this comment.
| 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
-
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
restartand waits for the lock. Asetupfrom 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 oldportfrom 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 reportsresult=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:
portis set only at line 863, beforerestart_lock()at 872. The re-read at 878 refreshesrecordforrerender_configonly.healthy(port)at 883,wait_healthy(port)at 887 andwhere["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 refreshwhere["port"].
- What fails: session A runs
-
pi-package/scripts/pi_plugin.py:983 —
updatecrashes with a KeyError when the record it re-reads under the lock has no port- What fails:
update --installpasses the port guard at line 968, then waits up to 40 s for the lock. Anuninstallduring that wait (uninstall takes no lock) deletesinstall.json. The re-read at line 978 returns{}. Line 980 then writes a newinstall.jsonthat holds onlybinary. Line 983 runsint(record["port"])and raises KeyError: a traceback on stderr, no facts, and a leftover record file. The extension printscontext-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
portagain. 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.
- What fails:
Non-blocking
configure(pi_plugin.py:917-924) does not re-read the record under the lock, unlikerestartandupdatein 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
killedfact (context-guru.ts:294-297) assumespi.execresolves with akilledfield when it stops the child at the time limit. No file in this repo pins that contract, and no test wiresrun()to the facts. Ifpi.execrejects 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) namesLOCK_WAIT_SECONDSin the LockBusy message even when a caller passes a customwait. No caller passes one today.- The
configurebusy 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 ofLOCK_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 handlesLockBusy; no nested lock takes, so no deadlock;uninstallstill 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
killedfact. - The extension:
downReasonorder (killed, not_installed, busy, service),conflictWordsjoin,run/parseFacts,checkAtStart. - The new tests: traced each one by hand (lock held across a thread,
fcntlremoved fromsys.modules, the plural wording). Both Python files parse. docs/data-dependence.md: the row now separates what the extension reads (port, proxy URLs) from whatrestartreads. 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
left a comment
There was a problem hiding this comment.
| 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
-
pi-package/scripts/pi_plugin.py:917-925 —
configurewrites the record and the service command from a snapshot read before the lock wait, so asetupthat ran during the wait is undone.- What fails:
configurereads the record at :893 and takesupstreamsandby_namefrom it at :908-909. It then waits up toLOCK_WAIT_SECONDS(40 s) for the lock. Under the lock it writes the config from the staleupstreams(:919), writes the whole stale record back (:923-924), and after the lock rewrites the service command with the staleupstreams(:925). Asetupthat held the lock during the wait (it holds the lock across its own config write,start_serviceand 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>-upstreamflag. 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 testtest_a_restart_reads_the_record_again_after_the_lock) and toupdate(:978) for exactly this hazard — its own test docstring says "a configure that ran during the wait is not undone". The mirror case, asetupthat ran whileconfigurewaited, is not fixed:configurenever re-reads the record.write_record(record)at :924 serializes the full pre-lock dict, so fieldsconfiguredoes not own (upstreams,base_urls,port) are reverted too. - Fix: re-read the record under the lock in
configure, asrestartandupdatedo. Keep the values given on the command line (args.preset,args.cache_strategy); takeupstreams,by_name,portandbinaryfrom the fresh record.setuphas the same shape for the fields it takes from the record (preset,cache_strategyat :673-674) — apply the same re-read there, keepingargs.cache_strategywhen given.
- What fails:
-
pi-package/extensions/context-guru.ts:294-297 — the new
killedfact 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 whenpi.execresolves with a truthykilledfield after the 60 s timeout. Ifpi.execrejects on a timeout instead, or the field has another name, the wrapper never sets the fact:checkAtStart's catch (:151-155) swallows the rejection,factsstays 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
downReasonwith a hand-madekilled: "true"(pi-package/tests/context-guru.test.ts:166).@earendil-works/pi-coding-agentis a peer dependency and is not vendored in this repo, so I could not readpi.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
runresult; output: the facts) and test it with a stubbed result that haskilled: true,killed: false, and a rejection. Or name where pi's API defineskilled, so the contract is checkable.
- What fails: the new message "the restart did not finish within 60 seconds and was stopped" (
Non-blocking
restart_lock'sLockBusymessage namesLOCK_WAIT_SECONDSeven whenwaitis passed explicitly (pi_plugin.py:849-850). No production caller passeswait, 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: itsstart_serviceruns 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), andsetupnow holds the lock acrossstart_service, whosesystemctl/launchctlcalls have no timeout (pi_plugin.py:507-510, 524-528). A waiter then reportsbusy— the designed fallback — but the "about 45 s at most" comment (pi_plugin.py:158-159) understates it.restartre-reads the record under the lock but keeps the pre-lockportforhealthy,wait_healthyand the printed facts (pi_plugin.py:863, 883, 887-888). Asetupthat moved the port during the wait (it does when the recorded port is foreign-held) makesrestartcheck 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_strategyandupstreamsfrom 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
busyreason:f.version ?? f.reasonpicks the version, so it prints "context-guru update: error v0.7.2" with no reason (context-guru.ts:486). - The
configureandupdateLockBusybranches have no tests;restartandsetupdo. downReasonhardcodes "60 seconds" in its text (context-guru.ts:85) while the limit lives as60_000at :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, therestartwrapper,configure,conflictWords), both test files,README.md, the data-dependence row. - Traced the lock interleavings between
setup,restart,configureandupdate: what each reads before the wait, what it writes under the lock, and what it writes after the lock. - Traced the extension's
checkAtStartpaths for thebusyandkilledfacts, including the swallow-catch path. - Searched the repo for
pi.exec's result contract;@earendil-works/pi-coding-agentis not vendored, so thekilledfield 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]>
- 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]>
Round 1: repliesAll findings are fixed in Reviewer 1
Non-blocking, all fixed:
Reviewer 2
Non-blocking:
Tests: Python 90 pass (4 new in this round). Node 27 pass. |
amiddavid
left a comment
There was a problem hiding this comment.
| 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
- Restart checked the pre-wait port (mine, finding 1): fixed.
restartnow takesportfrom the record it re-reads under the lock (pi_plugin.py:884-889), refresheswhere["port"], and a fresh record with no port printsnot_installed. I traced the new testtest_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. - 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 leftoverinstall.json. - Configure wrote a pre-wait snapshot (reviewer 1, finding 1): fixed, and I checked it myself.
configurere-reads the record under the lock (pi_plugin.py:927-934). Only--presetand--cache-strategycome from the command line; the upstreams, the port, the binary andby_namecome from the fresh record.setupmerges its fields into a fresh copy too (pi_plugin.py:761, 773-776). I tracedtest_configure_reads_the_record_again_after_the_lockend 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.
- The
killedcontract (reviewer 1, finding 2): fixed. The logic moved to the exportedrestartFacts()(context-guru.ts:87-91) with tests forkilled: true,killed: falseand a missing field, anddownReasonbuilds its text fromRESTART_TIMEOUT_MS. I could not read@earendil-works/pi-coding-agentmyself: it is a peer dependency and is not vendored in this repo. The author names the source (ExecResult.killedindist/core/exec.d.ts, 1.5.0). I accept the named source. If the field were absent anyway,restartFactsdegrades to the plain facts, so the path fails open.
Non-blocking
- My round-1 note about the tautological
assertLesswas wrong, and the author's rejection is right. I checked the indentation myself: thewith mock.patch.object(...)block closes inside thetry, and the assertion runs after it, so it reads the realLOCK_WAIT_SECONDS(40). No change needed. configurenow computesby_nameunder the lock (pi_plugin.py:934), which runs the binary's--version(up to 5 s) while holding the lock.restartdoes the same throughrerender_config. This lengthens the hold a little; thebusyfact covers a waiter that gives up. No action needed.- The remaining round-1 non-blocking items are all fixed in this commit: the
LockBusymessage names the real wait, the setup comment no longer says "as in configure", theLOCK_WAIT_SECONDScomment 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.pyat 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_waithelper. Both Python files parse. - The extension:
restartFacts,RESTART_TIMEOUT_MS, therestartandconfigurecall 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 whatreadInstallfeeds (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
left a comment
There was a problem hiding this comment.
| 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
configurenow runsnames_strategiesinside the lock (pi_plugin.py:933). That is a--versionsubprocess with a 5 s limit, so it can lengthen the lock hold, and a waiter can hitbusymore often. The trade is right:by_namemust 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. setupstill takesupstreams,portandearlierfrom 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
portinrestartand theupdateKeyError. Both are fixed in4da5bb4a. - 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.
- 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
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.
4da5bb4 to
ae9568f
Compare
Head moved, no code change: the approvals of
|
…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]>
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]>
Behavior change
None for users: the Pi package has no users yet (owner decision on #1049). The small changes in Pi-only behavior:
configurefrom the extension gets 60 s, not 30 s.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 ofdocs/data-dependence.md.What changed
Restart lock (
pi_plugin.py)restart,configure,setupandupdateread the install record again after they take the lock (fix(pi): write the cache strategy by name and re-render the config before each start #1049, reviewer 1, and round 1 here). Before, aconfigurethat ran during the wait could have its new strategy replaced by the old one until the next restart.setupandupdatewrite the config and the record under the restart lock, asconfiguredoes (fix(pi): write the cache strategy by name and re-render the config before each start #1049, reviewer 1).restartprintsresult=busy, and the notice says another command held the lock.configure,setupandupdaterefuse withreason=busyand write nothing.fcntl, no lock (feat(pi): check the proxy at session start and restart it once #1011, reviewer 1). On a state directory copied to Windows,restartnow printsservice=unsupported, not an ImportError traceback.Extension (
context-guru.ts)configuregets 60 s, asrestarthas, because it can wait for the lock (fix(pi): write the cache strategy by name and re-render the config before each start #1049, reviewer 2).conflictWordsjoins with"; ", because a URL can hold a comma (feat(pi): chain the proxy in front of an existing base URL #1010, reviewer 1).Setup question (
pi_plugin.py)Docs
docs/data-dependence.md: the session-start row says what the extension reads and whatrestartreads.restartdoes not read the proxy URLs (fix(pi): write the cache strategy by name and re-render the config before each start #1049, reviewer 2).Not changed:
restart.lockstays 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):busyand runs no service command;fcntl,restartreportsunsupported;setupwith a busy lock writes no config, no record and nomodels.json;node --test tests/*.test.ts: 27 tests pass. New asserts for thebusyandkilledreasons and the"; "separator.tscstrict 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