Repository navigation
fix(pi): wait for a cold first start; name the right settings.json - #1344
Conversation
#1288: the first setup after a download could fail with health_check_failed. The proxy started a few seconds after setup's 5 s check (2 of 3 fresh setups in one test), and the service stayed running with no record. - wait_healthy checks every 0.1 s for up to 20 s. A proxy that answers at once adds no wait. - A first setup that still fails removes the service it started. A re-run keeps the service of the earlier install. #1289: the two-copies warning always named ~/.pi/agent/settings.json. It now names $PI_CODING_AGENT_DIR/settings.json when that is set. Behavior change (#1288): Pi users whose proxy starts slowly. Old: setup (and the session-start restart, and configure and update) gave up after 5 s. New: up to 20 s. The first request still waits at most 10 s (#1215). No setting turns it off. Data dependence: none. Fixes #1288 Fixes #1289 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @vz-ibm) | Claude Code 2.1.325 | offload-review skill, @vz-ibm's session | fresh | 1 of 2 | 1 of 2 | 6ff96beb3fd3 |
blocking |
Verdict: blocking
Findings
- pi-package/scripts/pi_plugin.py:149 — the 20 s wait breaks the 60 s time budget of
restartandconfigure- What fails: a
restartor aconfigurethat waits for the restart lock can now run past the extension's 60 s limit (RESTART_TIMEOUT_MS,extensions/context-guru.ts:104, used at lines 478 and 627). Pi then kills the Python command. The person sees "the restart did not finish within 60 seconds and was stopped", or aconfigurewith no facts, instead of the real result (busy,down, orconfigured). - Proof (worst case,
restart, line 1088-1109):- Lock wait: up to
LOCK_WAIT_SECONDS= 40 s (line 138). healthy(port, timeout=START_CHECK_SECONDS): up to 5 s (line 1105).restart_service()on a fastkickstart: about 0 s.wait_healthy(port): old 5 s, new 20 s (line 1109).- Total: old about 50 s, inside 60 s. New about 65 s, past 60 s.
- Lock wait: up to
- Proof (
configure, line 1142-1175): lock wait 40 s +start_service(wait_launchd_goneup to 5 s, thenwait_healthy20 s) = about 65 s, past the 60 s limit of line 627. - The comment at lines 134-137 states the rule this breaks: "A caller that waits 40 s reports
busyand still finishes inside the extension's 60 s limit." The PR makes the contended case more likely too:setupholds the lock acrossstart_service(line 975), and that now holds it for up to 20 s more. - It is worse when
/healthzaccepts the connection but does not answer (for example, a listener that is open before the server serves). Eachhealthy()call then takes its 1 s timeout (line 141). 200 tries x (1 s + 0.1 s) = about 220 s, not "about 20 s" as the docstring says. The old limit was about 55 s in the same case. - Fix: make
wait_healthystop at a deadline (time.monotonic() + 20), not after a count of tries, so a slowhealthy()cannot stretch it. Then make the budget fit again: for example, lowerLOCK_WAIT_SECONDSto about 30 s, or give the restart and configure paths a deadline that ends before 60 s. Update the comment at lines 134-137. Add a test that pins the sum (lock wait + start check + health wait) belowRESTART_TIMEOUT_MS / 1000, next totest_a_restart_that_waits_too_long_for_the_lock_reports_busy(test_pi_plugin.py:695), which only checksLOCK_WAIT_SECONDS < 60.
- What fails: a
Non-blocking
test_pi_plugin.py:274counts calls tohealthy, not time. With finding 1 fixed by a deadline, the test can mocktime.monotonicand check that the loop stops at 20 s even when eachhealthy()call is slow.- The first half of the same test (answers at try 150) does not check that the loop stopped at once on the first
True. A call count would pin "a proxy that answers adds no wait". - Pre-existing, not from this PR: a re-run of setup that moves to a new port (
choose_port, line 190) rewrites the plist or unit with the new port instart_service. When that start fails, the record keeps the old port, but the service now runs on the new one. "A re-run keeps the earlier install's service" is then only partly true. Consider a follow-up issue. PI_CODING_AGENT_DIRis used as is, with no~expansion, in bothpi_plugin.py:75and the new warning. That is consistent. I did not check whether Pi itself expands~in that value.
What I checked
- Read
CLAUDE.mdrules that apply (fail open, behavior change, data dependence, tests wait on a condition). - Read the full diff of the one commit (4 files, +62/-4) and the commit message.
- Read the code around each change:
healthy,wait_healthy,start_service,restart_service,stop_service,wait_launchd_gone,launchd_bootstrap,setup,restart,configure,restart_lock,choose_port, and the extension's time limits (START_CHECK_TIMEOUT_MS,FIRST_REQUEST_WAIT_MS,RESTART_TIMEOUT_MS,checkAtStart). - First-setup cleanup:
recordis read again under the lock (line 964), sorecord.get("port")reflects only a successful earlier install.stop_servicereturnsnot_ownedand does nothing for a foreign unit or plist, so the cleanup cannot remove a service context-guru did not write. In the existing testtest_no_route_is_written_when_the_proxy_does_not_come_up, the realstop_servicenow runs, but the sandbox HOME has no unit or plist, so it returnsgoneand runs no command. - The new TS test saves and restores
PI_CODING_AGENT_DIRand theLOADEDglobal infinally. The extension path matchesagent_dir()inpi_plugin.py:75. - The PR body names the behavior change at the top, with who, old, new, and "no setting turns it off". It asks the owner to confirm on the PR. That confirmation must be on the PR before merge.
- Data dependence: none. No component or proxy feature changes; the PR touches only the Pi package host scripts. No row is needed.
- The new tests mock
time.sleepand use no real waits. No binary or LFS file is added. - I did not run the tests. Live tests were not approved.
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @vz-ibm) | Claude Code 2.1.325 | offload-review skill, @vz-ibm's session | fresh | 2 of 2 | 1 of 2 | 6ff96beb3fd3 |
blocking |
Verdict: blocking
Findings
- pi-package/scripts/pi_plugin.py:149 —
wait_healthycounts tries, not time, so "about 20 s" can be about 220 s, andconfiguregoes past its 60 s limit- What fails: a proxy that accepts the TCP connection but does not answer
/healthzwithin 1 s (a stuck or very busy process). Eachhealthy()call then waits its fulltimeout=1(line 141), plus the 0.1 s sleep. 200 tries take about 220 s, not 20 s. Before this PR, 50 tries took about 55 s. - Proof:
configureruns withRESTART_TIMEOUT_MS = 60_000(context-guru.ts:104,:627). It waits up toLOCK_WAIT_SECONDS = 40for the lock, then callsstart_service→wait_healthy(pi_plugin.py:1176). With a normal "not up yet" proxy (connection refused, fast tries): 40 + 20 s + the launchctl time is more than 60 s. With a stuck listener: about 220 s, even with no lock wait. Before: 40 + 5 s, or 55 s, both inside 60 s.pi.execthen killsconfigure, and the person gets no facts, only a killed command.restart_pendingstays set, so the next configure retries. The harm is a wrong message, not lost state.- The comment at
pi_plugin.py:134-138says a 40 s lock wait "still finishes inside the extension's 60 s limit". With the new wait, this is no longer true, and the PR does not update the comment. setuphas a 300 s limit (context-guru.ts:578), so 220 s alone does not kill it.restartwas already at about 5 + 55 = 60 s in the stuck case before this PR, so that part is not new.- The new test (
test_pi_plugin.py:274) mockshealthyto return at once, so it checks the count of calls, not the time.
- Fix: bound the loop by a monotonic deadline, for example
deadline = time.monotonic() + 20andhealthy(port, timeout=min(1, remaining)). Test it with a fake clock. Then make the budget fit: lowerLOCK_WAIT_SECONDS(for example to 35 s) or raiseRESTART_TIMEOUT_MS, and update the comment at lines 134-138 with the new numbers.
- What fails: a proxy that accepts the TCP connection but does not answer
Non-blocking
- Behavior change needs the human's yes on the PR. The PR body says the owner approved the time limit "in the session; confirm on this PR".
CLAUDE.mdrequires a human developer's yes, and an agent's report of it does not count. The yes must be on the PR before merge. pi_plugin.py:956-959: thedrop_downloaddocstring says "After a failed start the binary stays, because the service names it." On a failed first setup, the service is now removed, so this reason is gone. The binary still stays. The next setup downloads again (#1157 logic at line 851), so no harm. Update the comment.- A failed first setup also leaves the proxy config that
write_proxy_configwrote (line 970). The next setup overwrites it (it is ours), so no harm. Mention it only if you want "nothing is left" to be exact. context-guru.ts:421: the long inline ternary is hard to read. A smallsettingsPath()helper would also let the unset case have its own test. The existing test attests/context-guru.test.ts:477only matches/settings\.json/, so the~/.pi/agent/settings.jsondefault has no exact test.
What I checked
- Read the full diff (4 files, +62/-4) and the commit message.
- Read the code around each change:
healthy,wait_healthy,start_service,restart_service,stop_service,restart_lock,LOCK_WAIT_SECONDS,setup,restart,configure, and allwait_healthycallers. - Checked the record logic.
recordis read again under the lock (line 967). A record with noportmeans no successful setup, becausesetupwrites the record only after the start works. A re-run keeps the old service. The new tests cover both branches. - Checked that
stop_servicereturnsnot_ownedand removes nothing when a foreign unit or plist exists.start_servicereturns False for that case too, so the new branch does not remove a file we do not own. - Checked the TS change. Pi and
pi_plugin.py:agent_dir()both usePI_CODING_AGENT_DIR, with an empty value treated as unset. The two now agree. The new test restores the environment variable andLOADED. - Checked the existing tests that reach
health_check_failed(line 271). On the first-setup path, they now call the realstop_service, which finds no unit or plist in the sandbox and returnsgone. No real service command runs. - Data dependence: no component or feature data changes. No row file is needed.
- Fail open: the change is in the Pi installer, not in the request path.
- I did not run any tests. Live tests are not approved.
Round-1 review of #1344: - wait_healthy now stops at a deadline, so a slow health check cannot stretch the wait past its limit. - Only setup and update (a cold first start) wait up to 20 s. Restart and configure keep 5 s, inside the extension's 60 s limit. - A failed first setup removes the service it started. - settingsPath() names the settings.json that Pi uses, with tests. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
Replies to round 1 (fixed in 3d43428)Finding 1 of both reviewers (the 20 s wait and the 60 s limit): fixed.
Non-blocking:
Checks: Python 156 tests OK, Node 54 pass, |
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @vz-ibm) | Claude Code 2.1.325 | offload-review skill, @vz-ibm's session | resumed | 1 of 2 | 2 of 2 | 3d434284a952 |
approve |
Verdict: approve
Findings
None.
Status of round-1 findings
- Reviewer 1, finding 1 (the 20 s wait breaks the 60 s limit): fixed.
wait_healthy(pi_plugin.py:156) now stops at atime.monotonic()deadline. Each check getsmin(1, remaining), so a slow/healthzcannot stretch the wait.- Only
setup(line 986) andupdate(line 1266) passcold_start=Trueand wait 20 s. Both run under the extension's 300 s limit. restart(line 1120, default) andconfigure(start_servicedefault) wait 5 s. Worst case: 40 + 5 + 5 + 5 = 55 s, inside 60 s.test_restart_and_configure_stay_inside_the_extensions_60_second_limitpins that sum.
- Reviewer 2, finding 1 (same defect): fixed, for the same reasons. The deadline also fixes the "about 220 s" case.
- My non-blocking points: the fake-clock tests now check time, not a count.
test_a_proxy_that_answers_at_once_adds_no_waitchecks 1 call and 0 s. The re-setup port issue is filed as #1347. The~point needs no change. - Reviewer 2's non-blocking points: the
drop_downloaddocstring is updated.settingsPath()is added with an exact test for both cases. The left-over proxy config is accepted as harmless; I agree, because the next setup overwrites a config it owns.
Non-blocking
- A small narrowing on the warm path, not named in the PR body. Before this PR, the warm wait was 50 tries. When
/healthzaccepted the connection but answered slowly, it could last up to about 55 s. Now it stops at 5 s. The PR body says restart andconfigurehave "no change". For a refused connection that is true. For a slow answer, they now give up sooner. I think the risk is low: a warm proxy answers/healthzat once when it serves. Add one line to the behavior-change block so the owner's yes covers it. - The owner's yes for the behavior change is still not on the PR.
CLAUDE.mdrequires it before merge. - CI was still pending when I read it (
analyze,build-test,purego,record,trivy). - The comment at
pi_plugin.py:134-137still says "A caller that waits 40 s ... finishes inside the extension's 60 s limit". That is true again. The new comment at lines 149-151 explains why.
What I checked
- Last review: round 1, 6ff96be, 2026-11-24T10:35:51Z
- New commits read: 1 (
3d434284fix(pi): stop the start wait at a deadline; 20 s only for setup/update) - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
- New items since my last review:
- Reviewer 2's round-1 review (10:36:08Z): read it. Its finding 1 is the same as mine, and the new commit fixes it. I checked each of its non-blocking points above.
- The author's comment "Replies to round 1" (10:49:35Z): I checked each reply against the code. All of them match the diff.
- Commit
3d434284: read the full diff (4 files, +98/-28).
- Read the code around each change:
wait_healthy,start_service,restart,configure,update,setup,LOCK_WAIT_SECONDS,START_CHECK_SECONDS. wait_healthyreadsWARM_START_SECONDSat call time, so theRestarttest class patch to 0.05 s works. Withsleepmocked and the real clock, the loop spins for 0.05 s only.- Other tests that run the real
start_service(test_pi_plugin.py:1450) mockhealthytoTrue, so they return on the first check and do not spin. - The new test
test_setup_and_update_wait_for_a_cold_start_configure_does_notchecks thecold_startvalue forsetupandconfigure.contextlibis imported (line 8).updateis not in that test, but line 1266 passescold_start=Truedirectly. - The fake
starthelpers in tests take the newcold_startargument, so they still match the real signature. - The updated PR body names the behavior change at the top, with who, old, new, and how to undo it.
- Data dependence: none. The change is in the Pi installer only. Fail open is not affected; the change is not in the request path.
- I did not run the tests. Live tests were not approved.
vz-ibm
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @vz-ibm) | Claude Code 2.1.325 | offload-review skill, @vz-ibm's session | resumed | 2 of 2 | 2 of 2 | 3d434284a952 |
approve |
Verdict: approve
Findings
None.
Earlier findings
- Reviewer 2, finding 1 (try count, not time; the 60 s limit): fixed.
wait_healthy(pi_plugin.py:156-167) now stops at atime.monotonic()deadline. Each check getsmin(1, remaining). The sleep is cut to the time that is left.- Only
setup(line 986) andupdate(line 1266) passcold_start=Trueand wait 20 s. Their limits in the extension are 300 s. restart(line 1120, default) andconfigure(line 1175, no flag) wait 5 s. Worst case forrestart: 40 s lock + 5 s start check + 5 s = 50 s. Forconfigure: 40 s lock + up to 5 swait_launchd_gone+ 5 s = 50 s, plus the launchctl time. Both are inside 60 s again.- The new fake-clock tests check the deadline with slow checks, the 15 s success, and one call for a proxy that answers at once.
- Reviewer 1, finding 1 (the same 60 s budget): fixed. I checked this with the same trace as above. The new test
test_restart_and_configure_stay_inside_the_extensions_60_second_limitpins the sum at 55 s, below 60 s. - My non-blocking points: the
drop_downloaddocstring is updated.settingsPath()is added, with an exact test for both cases. The author kept the leftover proxy config on purpose, and I accept that reason: the next setup overwrites it. - Reviewer 1's non-blocking points: the author filed the port-move case as #1347, and it is not from this PR. The author kept
~inPI_CODING_AGENT_DIRunexpanded, the same asagent_dir(), and I accept that reason.
Non-blocking
- The human's yes is still not on the PR. The PR body still says "confirm on this PR". The merge must wait for the owner's yes.
- The PR body says "No change" for restart and configure, but one case changes. If the proxy accepts the connection but does not answer, the old loop ran 50 checks of up to 1 s each, about 55 s. The new deadline stops it at about 5 s. A proxy that is up within 5 s is not affected. Add one line to the behavior-change block.
- The test name says "update", but the test does not check update.
test_setup_and_update_wait_for_a_cold_start_configure_does_not(test_pi_plugin.py:317) checks onlysetupandconfigure. Acold_start=Truecheck on theupdate --installcall would pin line 1266. - The
Restarttests now depend on the real clock.Restart.setUp(test_pi_plugin.py:498-502) setsWARM_START_SECONDSto 0.05 s on the real clock.test_launchd_kickstarts_our_labelneeds its thirdhealthy()answer inside those 50 ms. A CI pause of more than 50 ms makes it reportdown. That is rare, but it is a time-based wait, whichCLAUDE.mdasks tests to avoid. A faketime.monotoniconly insidewait_healthy(for example aclockargument) would remove the risk and leave the lock tests on the real clock. - The deadline is soft by up to about 1 s.
urlopen'stimeoutapplies to each socket operation (connect, then read), so one check can take more thanmin(1, remaining). The budget still fits (55 s + about 1 s < 60 s). No change is needed.
What I checked
- Last review: round 1, 6ff96be, 2026-11-24T10:36:08Z
- New commits read: 1 (
3d434284fix(pi): stop the start wait at a deadline; 20 s only for setup/update) - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files)
- New items since my last review:
- Commit
3d434284: I read the whole diff (4 files, +98/-28) and the code around it:wait_healthy,start_service,restart,configure,update,setup,LOCK_WAIT_SECONDS, and theRestart,ControllerandConfigByNametest helpers. - The author's comment of 2026-11-24T10:49:35Z (replies to round 1): I checked each reply against the code. See "Earlier findings".
- Reviewer 1's round-1 review (10:35:51Z, read for the first time in this round): I checked its finding and its non-blocking points. See "Earlier findings".
- The updated PR body: it names the smaller behavior change and says how to undo it. The owner's yes is still not on the PR.
- Commit
- All 4 test stubs of
start_servicenow takecold_start=False, so the new keyword does not break them. wait_healthyreadsWARM_START_SECONDSwhen it is called, not when it is defined, so the patch inRestart.setUptakes effect.- Data dependence: none. The PR touches only the Pi package host scripts.
- I did not run the tests. Live tests are not approved.
Round-2 review of #1344: - wait_healthy takes an optional clock and sleep. The Restart tests use them, so no test depends on a 50 ms real-clock window. - The update test now checks that update --install is a cold start. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Vitaly Zabershinsky <[email protected]>
Replies to round 2 (fixed in 5ba774b)
Checks: Python 156 tests OK, Node 54 pass, |
|
The integrator merged main into this branch at the owner's request. New head: @vz-ibm, reviewers: please re-check the delta. Conflicts: none. The merge was clean. The delta is main's new commits only; this PR's own diff is unchanged. Tests (macOS)
|
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @amiddavid) | Claude Code 2.1.331 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 3 of 3 | 225729555865 |
approve |
Verdict: approve
Findings
None.
Earlier findings
- Reviewer 1 and reviewer 2, round 1, finding 1 (the 60 s budget): fixed in
3d434284. Round 2 of both reviewers confirmed it. The new commits do not change it. - Reviewer 2, round 2, non-blocking (the
Restarttests on a 50 ms real-clock window): fixed in5ba774bf.wait_healthy(pi_plugin.py:156) takes an optionalclockandsleep.Restart.setUp(test_pi_plugin.py:498-509) wrapswait_healthywith a fake clock that eachsleepmoves forward. The lock tests keep the real clock. The wrapper signature(port, seconds=None)matches both callers:pi_plugin.py:705(positional seconds) andpi_plugin.py:1121(no seconds). - Reviewer 2, round 2, non-blocking (the test name says "update" but does not check it): fixed.
test_update_re_renders_with_the_new_binary_before_the_startnow recordscold_startand asserts it is true. The fakestarttakescold_start=False, so the check fails ifupdatedrops the flag. - Both reviewers, round 2 (the slow-answer case for restart and
configurenot named): fixed. The PR body now has a line for it. - Reviewer 2, round 2 (the deadline is soft by about 1 s): no change, as I said. Accepted.
Non-blocking
- Behavior-change yes. The PR body still says "confirm on this PR". No human yes is on the PR yet. This is a Pi PR, so the owner rule of 2026-11-20 (Pi behavior changes are FYI to the owner, the PR author's yes is enough) may apply. The integrator must record which rule covers it in the squash message.
- CI is still pending at this head (
analyze,build-test,purego,record,trivy). Only DCO has passed. - The PR body has two Node lines under "How it was tested": "54 tests pass" and "53 tests pass". The second line is stale. The test counts also predate the merge (the merge comment says 218 Python tests now).
What I checked
- Last review: round 2, 3d43428, 2026-11-24T10:51:58Z
- New commits read: 2 on the PR side, plus the main commits that the merge brings in.
5ba774bftest(pi): run the restart wait on a fake clock; pin update's cold start. Full diff read (2 files, +20/-10).22572955Merge remote-tracking branch 'origin/main' into integrator/pi-1344.- Main commits in the merge (reviewed in their own PRs; I read their log and stat and checked overlap with this PR):
7f657d1b(#1335),2c8d8b89(#1330),71d18d6e(#1326),8f67d0c7(#1336),46e94e57(#1271),290898d3(#1333),2ee6dbc9(#1328),807d2178(#1327),c3096caa(#1315),28383ae2(#1332),8e3e6746(#1325),98c9a740(#1339),d6cc5286(#1322).
- Read in full: 4 reviews, 3 comments, 0 inline comments (from the three files).
- New items since my last review:
- Author comment "Replies to round 2" (10:55:27Z): I checked each reply against
5ba774bf. All match. See "Earlier findings". - Reviewer 1's round-2 review (10:51:44Z, read for the first time): its non-blocking points (the slow-answer line, the human's yes, CI pending) are handled or still open as listed above.
- Integrator comment (12:46:17Z, "please re-check the delta"): I checked it. See the merge checks below.
- Author comment "Replies to round 2" (10:55:27Z): I checked each reply against
- Merge checks:
git show --remerge-diff 22572955is empty, so the merge resolved no conflict by hand.- The PR diff against the old base (
de4e2f92..5ba774bf) and against the new base (7f657d1b..HEAD) are the same, except for line numbers and index lines. 4 files, +155/-17. - Overlap: #1335 changed
pi-package/extensions/context-guru.ts(the compaction mark,session_shutdown). The PR'ssettingsPath()(line 30) and its use (line 439) sit apart from it and still read the same. - Overlap: #1326 and #1330 changed
install_pi.py. It callspi_plugin.agent_dir(), which readsPI_CODING_AGENT_DIRthe same way assettingsPath(). It does not callwait_healthyor the start constants.
- Data dependence: none. The PR touches only the Pi package host scripts. Fail open is not affected: the change is not in the request path.
- I did not run the tests. Live tests are not approved.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @amiddavid) | Claude Code 2.1.331 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 3 of 3 | 225729555865 |
approve |
Verdict: approve
Findings
None.
Status of earlier findings
- Reviewer 1, finding 1 (round 1, the 60 s budget): fixed in
3d434284. Still fixed at this head.restart(pi_plugin.py:1121) andconfigureuse the 5 s warm wait. Onlystart_service(cold_start=True)(pi_plugin.py:705) gets 20 s. - Reviewer 2, finding 1 (round 1, try count, not time): fixed, for the same reason.
- Round-2 non-blocking points (both reviewers):
- The slow-answer case for restart and configure: the author says the PR body names it now. I accept that.
- The test name says "update": fixed.
test_update_re_renders_with_the_new_binary_before_the_startnow assertsseen["cold_start"]forupdate --install. - The 50 ms real-clock window in the
Restarttests: fixed. See "What I checked". - The soft deadline of about 1 s: no change, as reviewer 2 proposed. The sum stays below 60 s.
Non-blocking
- The owner's yes for the behavior change is still not on the PR. The only human comment (12:46:17Z) is about the merge of main.
CLAUDE.mdasks for a human developer's yes before merge. The integrator must check this.
What I checked
- Last review: round 2, 3d43428, 2026-11-24T10:51:44Z
- New commits read: 2
5ba774bftest(pi): run the restart wait on a fake clock; pin update's cold start22572955Merge remote-tracking branch 'origin/main' into integrator/pi-1344
- Read in full: 4 reviews, 3 comments, 0 inline comments (from the three files)
- New items since my last review:
- Reviewer 2's round-2 review (10:51:58Z): read it. Its non-blocking points are handled, as listed above.
- The author's comment "Replies to round 2" (10:55:27Z): I checked each reply against
5ba774bf. All of them match the diff. - The comment by amiddavid (12:46:17Z), "merged main, please re-check the delta": I checked the merge. See below.
5ba774bf,wait_healthy(pi_plugin.py:156-168): the newclockandsleeparguments default totime.monotonicandtime.sleep. The only production callers (lines 705 and 1121) do not pass them, so production behavior is the same as at3d434284.5ba774bf,Restart.setUp: it patchespi_plugin.wait_healthywith a wrapper that runs the real function on a fake clock.sleepmoves the clock.start_serviceandrestartlook upwait_healthyas a module global at call time, so they get the wrapper. The wrapper's(port, seconds=None)matches both call forms. WithhealthyalwaysFalse, the loop ends after about 50 fake sleeps of 0.1 s. No test now depends on the real clock in this wait. The lock tests keep the realtime.monotonic.- Merge
22572955:git merge-tree --write-tree 5ba774bf 7f657d1bgives treede2293c2. That is the same as the HEAD tree. So the merge is clean and has no hand edits. git diff 7f657d1b..HEAD --stat: the PR's own diff is still only 4 files (context-guru.ts,pi_plugin.py,test_pi_plugin.py,context-guru.test.ts).- Main's Pi changes since the merge base (
de4e2f92..7f657d1b) do not touchpi_plugin.py. Incontext-guru.tsthey add the compaction mark, in another part of the file thansettingsPath(). Ininstall_pi.pythey addcheck_folders, which usespi_plugin.agent_dir(). That readsPI_CODING_AGENT_DIRthe same way assettingsPath()(an empty value means unset). No conflict in behavior. - Data dependence: none. The PR changes only the Pi package host scripts. Fail open is not affected; the change is not in the request path. No binary or LFS file.
- I did not run the tests. Live tests were not approved.
|
Behavior change approved (owner): setup and update wait up to 20 s for the proxy to start (was 5 s). Restart and configure keep 5 s. Posted by my assistant at my request. — Vitaly |
#1342 merged to main. Its tests and this PR's tests both changed the same places. Conflicts and resolution: - pi-package/tests/context-guru.test.ts, import list: keep both settingsPath (this PR) and recoverStaleRoute (#1342). - pi-package/tests/context-guru.test.ts, tests: keep this PR's two-copies warning and settingsPath tests, then #1342's recoverStaleRoute tests. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
|
The integrator merged main into this branch again at the owner's request, after #1342 merged. New head: @vz-ibm, reviewers: please re-check the delta. Conflict: Tests (macOS)
|
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (claude, user of @amiddavid) | Claude Code 2.1.331 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 4 of 4 | f1c50ecac549 |
approve |
Verdict: approve
Findings
None.
Earlier findings
- Round 1, finding 1 of both reviewers (the 60 s budget): fixed in
3d434284. Still fixed at this head. The new merge does not touchpi_plugin.py. - Round 2 non-blocking points (both reviewers): fixed in
5ba774bf, as my round-3 review says. No change since. - My round-3 non-blocking points:
- Behavior-change yes: now on the PR. Comment by vz-ibm at 14:07:59Z: "Behavior change approved ... setup and update wait up to 20 s ... Restart and configure keep 5 s." Vitaly is the PR author, and Pi behavior changes are FYI to the owner (owner rule of 2026-11-20). The comment says an assistant posted it at Vitaly's request. The integrator can record it in the squash message.
- CI pending: not checked again at this head. The integrator checks CI at hand-off.
- The two Node test counts in the PR body: not fixed. It is a text nit only.
Non-blocking
- The PR body still lists "54 tests pass" and "53 tests pass" for Node, and Python counts from before the two merges. The merge comment gives the current counts (225 Pi script tests). Update the body before the squash, or leave the counts out of the squash message.
What I checked
- Last review: round 3, 2257295, 2026-11-24T12:50:46Z
- New commits read: 8. One is on the PR side; seven are main commits that the merge brings in.
f1c50ecaMerge origin/main into fix/pi-cold-start-and-warning-path. Read in full, withgit show --remerge-diff.- Main commits (reviewed in their own PRs; I read their messages and stats and checked overlap with this PR):
f4ee9f87fix(pi): a Pi window open during an uninstall no longer fails (#1342),d847e7c8fix(apply): report a head-TTL relabel as a change (#1356),f5a77414refactor(campaign): move the adapt recommendation choice (#1334),e31ed42frefactor(accrec): move the accountant glue (#1337),9f7475cerefactor(compactionpoint) (#1320),52876118refactor(keepalive): move wait windows, signal and manual ping rules (#1338),2257295is my last reviewed head.
- Read in full: 6 reviews, 5 comments, 0 inline comments (from the three files).
- New items since my last review:
- Reviewer 1's round-3 review (12:50:49Z): approve. Its one open point (the owner's yes) is now answered by the 14:07:59Z comment.
- Comment by vz-ibm (14:07:59Z), the behavior-change yes: checked. It names the same change as the PR body.
- Comment by amiddavid (14:27:58Z), "merged main again, please re-check the delta": checked. See below.
- Merge
f1c50ecachecks:- The remerge-diff shows one conflict only, in
pi-package/tests/context-guru.test.ts. The resolution keeps both sides: the import list hassettingsPathandrecoverStaleRoute. The file has this PR's two tests (the two-copies warning,settingsPath), then #1342'sstaleWorldhelper andrecoverStaleRoutetests. The braces close correctly (});after thesettingsPathtest, line 577). - The PR diff against the new base (
f4ee9f87..HEAD) is the same 4 files, +155/-17, as against the old base. A line-by-line compare shows only the changed import context and the hunk position. No real-code change from the merge. - #1342 also changed
pi-package/extensions/context-guru.ts(stale-route recovery). The PR'ssettingsPath()(line 30) and its use in the two-copies warning (line 470) are apart from that code.LOADEDhandling (lines 463, 476, 619) is unchanged. - The new
tests/recover.test.ts(#1342) also usesLOADEDand deletes it after each test (line 55). This PR's two-copies test also deletesLOADEDand restoresPI_CODING_AGENT_DIRinfinally. The two do not leak state into each other.
- The remerge-diff shows one conflict only, in
- Data dependence: none. The PR changes only the Pi package host scripts. Fail open is not affected: the change is not in the request path. No binary or LFS file.
- I did not run the tests. Live tests are not approved.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (claude, user of @amiddavid) | Claude Code 2.1.331 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 4 of 4 | f1c50ecac549 |
approve |
Verdict: approve
Findings
None.
Status of earlier findings
- Reviewer 1 and reviewer 2, round 1, finding 1 (the 60 s budget): fixed in
3d434284. The new merge does not touchpi_plugin.pyon the PR side.wait_healthy(pi_plugin.py:156), the cold start (line 705) and the warm restart (line 1121) are the same as at22572955. - Round-2 non-blocking points: fixed in
5ba774bf, as rounds 3 of both reviewers said. No change since. - My round-3 point (the owner's yes is not on the PR): fixed. The comment of 14:07:59Z records it: "Behavior change approved (owner): setup and update wait up to 20 s ... Restart and configure keep 5 s."
- Reviewer 2, round 3 (CI pending, a stale Node test count in the PR body): not code findings. The integrator checks CI at the final head.
Non-blocking
- The yes of 14:07:59Z names the 20 s cold start. It does not name the smaller change on the warm path (a slow
/healthzanswer now stops at 5 s, not about 55 s). The PR body names it in the behavior-change block, so I read the yes as covering the whole block. The integrator can confirm this with the owner if needed.
What I checked
- Last review: round 3, 2257295, 2026-11-24T12:50:49Z
- New commits read: 1 (
f1c50ecaMerge origin/main into fix/pi-cold-start-and-warning-path). It brings in main'sf4ee9f87(#1342), reviewed in its own PR. I read its message and its Pi diff to check the overlap. - Read in full: 6 reviews, 5 comments, 0 inline comments (from the three files)
- New items since my last review:
- Reviewer 2's round-3 review (12:50:46Z): read it. Its points are listed above.
- Comment by vz-ibm (14:07:59Z), the owner's yes for the behavior change: checked. It matches the change in the PR. See "Non-blocking".
- Comment by amiddavid (14:27:58Z), "merged main again, please re-check the delta": checked. See the merge checks below.
- Merge checks for
f1c50eca:git show --remerge-diff f1c50ecashows one conflict, inpi-package/tests/context-guru.test.ts. The resolution keeps both sides. The import list hassettingsPath(this PR) andrecoverStaleRoute(#1342). The tests have this PR's two-copies warning andsettingsPathtests, then #1342'sstaleWorldandrecoverStaleRoutetests. The resolution adds the closing});and a blank line between them, so each test is complete. No other change.git diff --stat f4ee9f87..HEAD: the PR's own diff is still 4 files, +155/-17.- I compared the changed lines of
7f657d1b..22572955andf4ee9f87..HEAD. The only difference is the import line, which now also hasrecoverStaleRoute. The PR's diff is the same. - #1342 changed
context-guru.ts. The second-copy branch ofcontextGuru(lines 464-475) still returns before any of #1342's new handlers. So the two-copies warning test still sees only the warning.settingsPath()(line 30) is used once, at line 470. - #1342 changed
install_pi.py(asks about open Pi windows). It does not callwait_healthy,start_serviceor the start constants.
- Data dependence: none. The PR touches only the Pi package host scripts. Fail open is not affected: the change is not in the request path. No binary or LFS file.
- I did not run the tests. Live tests were not approved.
|
Integrator: the 4 Pi PRs are merged: #1326, #1342, #1330 and #1344 (49f3531). @vz-ibm, they ship in v0.7.8. The owner chose a direct v0.7.8 with no beta. It is cut after a few more PRs from other sessions merge. As with v0.7.7, please run your full installer check from the live release, |
chore(plugins): bump the plugin versions for v0.7.8 - Pi package: 0.1.6 -> 0.1.7 (#1326, #1330, #1335, #1342, #1344). - OpenCode plugin: pinned proxy version v0.7.7 -> v0.7.8. - Unchanged: Claude Code plugin 0.7.8 (test files only changed since v0.7.7), Codex 0.2.14, Bob 0.1.3. Release owner (David Amid, 2026-11-24, integrator session): cut v0.7.8 now. Version bumps are under the owner standing approval. Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
|
Integrator: v0.7.8 is released and is @vz-ibm, it holds the 4 Pi PRs: #1326, #1330, #1342 and #1344. The release has |
Behavior change (the owner approved the time limit in the session; confirm on this PR): Pi users whose proxy starts slowly.
setupandupdategave up after 5 s when the proxy did not answer.setupandupdatewait up to 20 s (a deadline, not a count of tries). A proxy that answers at once adds no wait.configurekeep 5 s, so they stay inside the extension's 60 s limit. The first request still waits at most 10 s (fix(pi): hold routed requests while the start check restarts the proxy #1215).configure: a proxy that accepts the connection but does not answer/healthzmade the old wait last up to about 55 s (50 checks of 1 s). Now the wait stops at 5 s. A proxy that answers within 5 s sees no change.COLD_START_SECONDSback to 5 inpi_plugin.py.Data dependence: none. No row in
docs/data-dependence.mdchanges.Summary
Two small Pi fixes, found while I checked the QA guide and v0.7.6/v0.7.7.
#1288: the first setup can fail on a cold start
health_check_failed. The proxy started a few seconds after setup's 5 s check, and the service stayed running with no install record.wait_healthy()stops at a deadline: 20 s for setup and update, 5 s for restart and configure. On a failed first setup,stop_service()removes the half service.#1289: the two-copies warning names the wrong file
~/.pi/agent/settings.json. WithPI_CODING_AGENT_DIRset, it now names$PI_CODING_AGENT_DIR/settings.json.How it was tested
settingsPath()names the right settings.json, with and withoutPI_CODING_AGENT_DIR. 54 tests pass.$PI_CODING_AGENT_DIR/settings.json). 53 tests pass.go test -count=1 ./pi-package/,make lint.Fixes #1288
Fixes #1289
Assisted-By: Claude (Anthropic AI) [email protected]