Repository navigation
fix(pi): write the cache strategy by name and re-render the config before each start - #1049
Conversation
…fore each start The Pi package wrote the proxy config only in setup and configure, with each strategy key as a literal. A fix to a strategy's values in a new release never reached an existing Pi install. - For a binary of v0.7.1 or later (#987), the config names the strategy (cache.strategy) and the proxy fills the keys from its own table. The package reads the version from `--version`, which never starts a proxy. A version it cannot read counts as old. - For an older binary, the config keeps the literal keys from Pi's table. - `none` writes no cache block, as before, on any binary. - `restart` and `update` (with the new binary) re-render the config from the install record before the start. Only a file with the package marker is written. A hand-written file is reported as config=not_owned and left alone. - setup resolves the binary before it writes the config, and still refuses a hand-written config before any download. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID AMID <[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 | 74253dd52ce9 |
approve |
Verdict: approve
Findings
None. I found no wrong behavior on a path a user can reach.
Non-blocking
- pi-package/scripts/pi_plugin.py:298 — a pre-release version counts as the release.
release_version("0.7.1-rc1")strips-rc1and returns(0, 7, 1), so an rc binary gets the by-name config. An rc cut before #987 merged refuses thestrategykey, exits, and crash-loops.rerender_configcannot heal this: it re-makes the same decision and writes the same file. Today this is unreachable — the repo has never cut an rc tag, andreleases/latestnever resolves to a pre-release. Only a manualCONTEXT_GURU_VERSION=v0.7.1-rc1install can hit it. The test at test_pi_plugin.py:603 asserts the rc case on purpose. If rcs ever become practice, compare pre-releases as older than their release. - pi-package/scripts/pi_plugin.py:385 — a hand edit to a marked config is reverted at the next session start.
restartre-renders from the record even when the proxy already answers. Before this PR, a hand-tuned cache key inside a marked file persisted. Now it is silently replaced. The proxy's own rules advertise hand-tuning ("a key the file sets itself always wins", config/strategy.go:20). The README covers the marker rule and the escape hatch (remove the marker, or delete thestrategyline and set the keys by hand — the file then differs from the render, sorestartrewrites it; only the marker removal survives). Consider one README line that says it in those words. - pi-package/scripts/pi_plugin.py:863-869 —
configurewrites the config before the record, with no restart lock. A session-startrestartthat reads the record in between re-renders the old strategy over the new file. The window is two consecutive statements, and the next restart heals it. Not worth a lock; noting it so the shape is known. - pi-package/scripts/pi_plugin.py:398 — the
invalid_recordpath has no test. Every otherrerender_configreturn value has one. Also untested:restartfalling back tofind_binary()when the record has nobinarykey.
What I checked
- The full diff (3 files, +262/−17) and the code around each change in
pi-plugin.py,test_pi_plugin.py, and the README. - The proxy side of every claim the plugin makes:
--versionprintscontext-guru-proxy <version> (commit <sha>)and returns before any port, config or log sink opens (cmd/context-guru-proxy/main.go:284-286). Release builds stampbuildinfo.Versionfrom the tag without thev(.goreleaser.yaml), soout[1]is the version the parser expects.- The config loader is strict (
KnownFields, config/config.go:408) and acceptscache: strategy: <name>(config/strategy_test.go:81).auto,1-ping,2-pingandnoneall exist in the proxy table (config/strategy.go:61-133). config/strategy.gowith #987 is inside the v0.7.1 tag, soNAMED_STRATEGY_RELEASE = (0, 7, 1)is the right line. v0.7.1 is the newest tag, so fresh installs use by-name now.nonewrites nocache:block; everyCacheConfigfield defaults off or zero (config/config.go:99-101), so no block means no pings.
- The failure direction: a version the plugin cannot read (no
--versionflag, usage text, non-zero exit, hang, missing file,None) yields literal keys, which every binary fromMINIMUM_RELEASEon accepts.binary_version_textcatchesOSErrorandSubprocessError(includingTimeoutExpired), and requiresout[0] == "context-guru-proxy". - The by-name decision always matches the binary that will read the file:
setup,configure,restartandupdateeach pass the same executable tonames_strategies/rerender_configthat they pass tostart_service.updatere-renders with the NEW binary before the start, and its test provesstart_servicesaw the new file. - Ownership:
rerender_configwrites only a file that starts with the marker;missingandnot_ownednever create or change one;setuprefuses a hand-written config before any download (test assertsdownload.assert_not_called).rerender_confignever raises (the write sits insidetry/except), and a failed re-render does not stop the restart (tested). - Ordering:
updatewrites the record, then re-renders, then starts.restartre-renders insiderestart_lock, before the health check, so an already-up proxy gets the new file without a restart. - The extension (
pi-package/extensions/context-guru.ts) ignores the newconfig=fact;downReasonreads onlyresult,serviceandreset_hatch. The restart budget is 60 s, so the 5 s--versiontimeout fits. - The strategy tables: the Pi copy is pinned to
context-guru-plugin/scripts/settings.py(test_pi_plugin.py:324), which the Go table is pinned to (config/strategy_test.go:29). The keys and values ofauto,1-pingand2-pingmatch across all three copies today. - Every record the plugin can write carries
presetandcache_strategysince the first Pi release (c550c7c), sorerender_config's defaults cannot overwrite a choice a real install made.
Live tests were not approved, so I read the code only and ran nothing.
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 | 74253dd52ce9 |
approve |
Verdict: approve
Findings
None. I found no wrong behavior, no data loss, no broken fail-open path and no security problem.
Non-blocking
docs/data-dependence.md:241— the row for the Pi session-start check says restart "reads only the install record (port and proxy URLs)". After this PR, restart also reads the preset, the cache strategy, the upstreams and the binary path from the record, runs the binary's--version, and writesproxy.yaml. The data level stays "none", and the PR body states "Data dependence: None". But the row's list is now short. Update the row's text.pi-package/scripts/pi_plugin.py:899—update --checknow parses the installed version throughbinary_version_text, which also requires the first word to becontext-guru-proxy. The parsing itself is tested (the fake-binary cases), but no test runsupdate --checkwith the new helper. The old code had no update test either.pi-package/scripts/pi_plugin.py:832-836—restart(inside the restart lock) can now writeproxy.yamlwhileconfigure,setuporupdatewrite it with no lock. All writers use the sameproxy.tmppath. A collision fails safe: one render wins, or a writer reportsfailed/refused. Rare and self-healing, so I do not block on it.- A
setupthat fails at the health check leaves the new strategy in the file, while the record keeps the old one. The nextrestartre-renders from the record and reverts the file. This follows the stated rule ("It comes from the install record") and the setup reported failure, so the user was told. Worth knowing, not a defect.
What I checked
- The version gate.
NAMED_STRATEGY_RELEASE = (0, 7, 1)is right:b49cbeb6(#987,config/strategy.go) is an ancestor of tagv0.7.1and not ofv0.7.0. - The strict-YAML claim.
config/config.go:408setsKnownFields(true), so a binary without theStrategyfield (config/config.go:94) refusescache: strategy:. The gate is needed and correct. - The
--versionclaim.cmd/context-guru-proxy/main.go:284-287printscontext-guru-proxy <version> (commit <sha>)and returns before the config load, the log sink and the listener. The parse inbinary_version_textmatches this output. Dev builds printdev,release_versionraises, andnames_strategiesreturns False. - The strategy names. Pi writes
none,auto,1-ping,2-ping. All four exist in the proxy table (config/strategy.go:61-133). Pi's copy of the table is pinned to the Claude Code plugin bytest_strategies_match_the_claude_code_plugin, and the Go test pins that plugin to the Go table, so the three tables cannot drift. none.render_configwrites nocache:block for it on any binary.CacheConfig.KeepAliveis off by default (config/config.go:98-103), so no block andstrategy: nonegive the same behavior.- The fail-open paths.
rerender_configreturnsmissing,not_owned,invalid_recordorfailedand never raises;restartandupdatecontinue with the file as it is.names_strategiescannot raise:binary_version_textcatchesOSErrorandSubprocessError(the timeout), andrelease_version'sRuntimeErroris caught. An unreadable version gives literal keys, which every binary accepts (a file with nostrategykey changes nothing,config/strategy.go:23). - The re-render is byte-stable for old installs: the literal-keys branch of
render_configis unchanged from the base, so a restart on an old binary reportsunchangedand writes nothing. - Ownership.
restartandupdatewrite only a file that starts with the marker; a hand-written file is reportednot_ownedand left alone.setuprefuses before any download.configurerefuses throughwrite_proxy_config. - The setup order change. The not-owned refusal still happens before the binary download; the config is now written after the binary is known, so the format matches the binary that will run. A failed binary install now leaves no config behind (an improvement).
- The extension. It reads restart facts as a string map, so the new
config=fact is additive and harmless. - The tests. I read all 14 new tests and the helpers they use. They cover the by-name render, the literal render,
noneon both, the version detection cases, and everyrerender_configoutcome (rendered,unchanged,not_owned,missing,failed, andalready_upwith no restart). The Python suite runs undergo test ./...(pi-package/pi_test.go). - The README section matches the code: who writes the config, when, what
not_ownedmeans, and that a healthy proxy is not restarted for a config change. - I did not run the tests. Live tests are not approved for this review, so the "77 tests pass" claim is the PR's, not mine.
- data-dependence: the Pi session-start row lists what restart now reads from the install record, the `--version` call and the proxy.yaml write. The level stays none. - A pre-release (0.7.1-rc1) counts as older than its release, so it gets the literal keys. 0.7.2-rc1 still gets the name. - configure writes the config and the record under the restart lock, so a session-start restart cannot re-render the old record over the new file. - README: a hand edit inside a file with the marker does not stay; remove the marker line to keep it. - Tests: the invalid_record path, restart falling back to find_binary, update --check with the version helper, and the configure lock. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 replies. Both reviewers approved with no findings. I fixed the non-blocking notes in Reviewer 1
Reviewer 2
Tests: Python 81 pass, Node 26 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 | 1705cf8388a8 |
approve |
Verdict: approve
Findings
None. The fix commit is correct, and it introduces no new defect I can show.
Earlier findings, and their status
Mine (all round-1 non-blocking):
- A pre-release counts as its release — fixed.
names_strategiesnow returns False for0.7.1-rc1(same version, pre-release) and True for0.7.2-rc1(a later release). I traced all cases:0.7.1→True,0.7.0→False,v0.7.1-rc1→False,0.7.2-rc1→True,dev→False. The later-release-rc case is the right call: any release after 0.7.1 contains #987. Better than my suggestion, which lost that case. - A hand edit in a marked file is replaced — documented. The README now says it in the words I asked for, and the escape hatch (remove the marker) matches the code:
owned()fails,restartandupdatereportnot_owned, and onlysetup/configurerefuse. configurewrites config and record with no lock — fixed. Both writes now sit insiderestart_lock(). The lock releases on every exit path, including thereturn 2refusal (withcloses the handle).names_strategiesruns before the lock, so the binary run does not extend the hold. No nesting, so no deadlock. The order (config first, record second) is right for the reason given: a refused write leaves the record unchanged.- Missing tests (
invalid_record,find_binaryfallback) — fixed. Both tests exist and assert the right things.test_an_invalid_record_leaves_the_file_alonealso provesnames_strategiesis never called on that path.
Reviewer 1's (round-1 non-blocking), checked by me:
- data-dependence row too short — fixed. The row now lists what
restartreads and writes. One residual, see Non-blocking. - No
update --checktest with the new helper — fixed.test_update_check_reads_the_version_the_binary_printscovers 0.7.0, 0.7.1 and usage text. - Shared
proxy.tmpwith no lock — declined, and I accept the reason. Both writers dowrite_textthenos.replaceon the same tmp path. A collision leaves one complete render, or afailed/refusedreport. Never a mixed file. Theconfigurehalf of the race is now under the lock anyway. - A failed
setupleaves the new strategy in the file — declined, and I accept the reason. Setup reported the failure, and the nextrestartre-renders from the record. The rule is stated in the README.
Non-blocking
- pi-package/extensions/context-guru.ts:439 —
configurenow waits on the restart lock, but the extension still gives it 30 s. The extension givesrestart60 s precisely because of that lock (comment at line 289). A session-start restart can hold the lock about 45 s: 5 s--version, 5 s health check, up to 30 ssystemctl restart, 5 swait_healthy. Aconfigurethat collides is killed at 30 s while still waiting. It fails safe: nothing was written, and a retry works. Giveconfigurethe same 60 s budget, here or in a follow-up. - docs/data-dependence.md:241 — the row says
restartreads "proxy URLs" from the record. It does not.restart()reads the port, the binary path, the preset, the cache strategy and the upstreams. The phrase is carried over from the old row text. Trim it.
What I checked
- Last review: round 1, 74253dd, 2026-11-10T13:11:00Z.
- New commits read: 1 —
1705cf83"fix(pi): round 1 review notes for the config re-render". - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three files:
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt). - New items since my last review, and what I did about each:
- Reviewer 1's round-1 review (13:11:28Z) — read in full; checked each of its 4 notes against the fix commit (statuses above).
- The author's round-1 reply (13:14:03Z) — read in full; verified every "fixed" claim in the code and every "not changed" reason (both accepted).
- Commit
1705cf83— reviewed as a first review, below.
- The new
names_strategies: traced every input class — release versions,v-prefixed, pre-releases of the same and later releases,dev, usage text, non-zero exit, missing file,None. No path raises; the safe direction (literal keys) holds everywhere. - The
configurelock:restart_lock()returns an open handle,withcloses it on all exits,flockreleases. The new test proves the lock is held during the config write (a second non-blockingflockon the same file must fail), and that the record and the file both carry the new strategy after. - The new tests read in full: the find-binary fallback, the invalid-record path, the update-check versions, the lock test, and the updated pre-release cases.
- The README line and the data-dependence row against the code they describe.
- The extension timeouts (restart 60 s, configure 30 s, update --install 300 s) against the new lock wait — the one real tension, in Non-blocking.
Live tests were not approved, so I read the code only and ran nothing.
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 | 1705cf8388a8 |
approve |
Verdict: approve
Findings
None. The fixes are correct and I found no new defect in them.
Earlier findings and notes
My round-1 review had no findings, only non-blocking notes. The author's reply 1705cf83 addresses all of them:
- data-dependence row too short — fixed. The row (
docs/data-dependence.md:241) now lists whatrestartreads from the install record (port, proxy URLs, preset, cache strategy, chained upstreams, binary path), the--versionrun and theproxy.yamlwrite. The level stays "none", which is still true. - no
update --checktest — fixed.test_update_check_reads_the_version_the_binary_printscovers0.7.0,0.7.1and usage text, with the release lookup mocked. - shared
proxy.tmp, no lock — not changed, reason accepted. A collision fails safe: one render wins, or a writer reportsfailed/refused. The reason is right. Theconfigurepart is now under the lock anyway (see below). - a failed
setupleaves the new strategy in the file — not changed, reason accepted. Setup reports the failure, and the nextrestartwrites the file again from the record. This matched my own round-1 assessment.
Reviewer 2's round-1 notes (I checked each fix myself, not only the reply):
- pre-release counts as its release — fixed, correct.
names_strategies(pi-package/scripts/pi_plugin.py:293-305) now returns True only forversion > (0, 7, 1), or== (0, 7, 1)without a-in the version text. I traced every test case:0.7.1→ True,0.7.1-rc1andv0.7.1-rc1→ False,0.7.2-rc1→ True,0.7.0→ False,dev→ False (RuntimeError path).release_versionstrips the-rc1for the numbers and the raw text supplies the pre-release flag, so the two cannot disagree. - hand edit in a marked file is replaced — documented. The README bullet is accurate: I verified in round 1 that
owned()tests the marker line, so a file without it returnsnot_ownedfromrerender_configand is never written, whilesetupandconfigurerefuse it (the next bullet says so). configurewrites config and record with no lock — fixed. Both writes now sit insiderestart_lock()(pi_plugin.py:871-878), andtest_configure_writes_the_config_and_the_record_under_the_restart_lockproves the lock is held during the config write, by trying a non-blockingflockfrom a second file descriptor. The author's reason for writing the record second is right: a refused config write must not leave the new strategy in the record.- missing
invalid_recordandfind_binarytests — fixed. Both paths have a test, andtest_an_invalid_record_leaves_the_file_alonealso provesnames_strategiesis not called before the validation.
Non-blocking
pi-package/scripts/pi_plugin.py:828—restartstill reads the record before it takes the lock (the lock is at line 837). A restart that reads the record just before aconfigureruns, then waits for the lock, re-renders the stale record over the new file when it gets the lock. The window is now the gap betweenread_record()andflock(microseconds), and the file heals at the next proxy restart. To close it fully, read the record again inside the lock.setupandupdatestill write the config and the record with no restart lock (setup: config → start → record;update: record → render → start). The same shape the commit fixed forconfigure. Both are interactive commands with narrow windows, and a lost race reverts the file only until the next restart. Note only.
What I checked
- Last review: round 1,
74253dd52ce92d4de46ec7b8d5db865a558a28d2, 2026-11-10T13:11:28Z. - New commits read: 1 (
1705cf83"fix(pi): round 1 review notes for the config re-render", 4 files, +83/−11). - Read in full: 2 reviews, 1 comment, 0 inline comments (from
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt; the inline file is empty). - New items since my last review: the commit
1705cf83and the author's round-1 reply comment (2026-11-10T13:14:03Z). I read both in full and checked every claim in them against the code. - The new
names_strategieslogic, traced on all seven version strings the tests use plusv0.7.1and0.8.0. - The
configurelock: the locked section, the earlyreturn 2inside thewith(the lock is released), no re-entry intorestart_lockfrom inside, and the lock test's mechanism (a secondflockon the same file from another descriptor in the same process does conflict). - The four new tests, read against the code paths they claim to cover.
- The
data-dependence.mdrow and the README bullet for factual accuracy. - I did not run the tests. Live tests are not approved, so the "81 pass" claim is the author's, not mine.
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Merged
|
- 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]>
The review notes left on #1010, #1011 and #1049, for the Pi package: configure reads the install record again, conflictWords joins with "; " (a URL can hold a comma), and the data-dependence row says restart does not read the proxy URLs. Tests for the configure and update busy paths, and for each finding. Behavior change: none for users: the Pi package has no users yet (owner decision on #1049). Owner's yes, 2026-11-11, in the integrator session: "btw in the meantime 1058 is ready". Data dependence: no change. Metadata only; the docs row states it more exactly. Reviews: 2 offload reviews (GLM), round 2, both approve at 4da5bb4. The branch was then rewritten only to change the sign-off e-mail; the patch is identical (patch-id 563da3ea9c58 before and after). Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
…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]>
No behavior change for users: the Pi package has no users yet (decided by the developer, David Amid, 2026-11-10).
Fixes #1044
Summary
restartandupdatenow re-renderproxy.yamlfrom the install record before each start. This is the same rule as the Claude Code plugin'sstrategy sync.What we found
proxy.yamlonly insetupandconfigure.updateandrestartstarted the proxy with the old file.What changed
render_config(..., by_name): withby_name, it writescache:/strategy: <name>and no literal keys. Without it, it writes the literal keys as before.context-guru-proxy --versionwith a 5-second limit and needs0.7.1or later. feat(config): named cache strategies in the proxy config #987 is in v0.7.1 and not in v0.7.0.--versionexits before the proxy opens a port. A binary without the flag exits on the unknown flag. So the check never starts a proxy.context-guru-proxy strategies. An older binary reads that word as an argument and starts serving.nonewrites nocache:block, on any binary. This is the same as today. feat(config): named cache strategies in the proxy config #987 saysnonesets no keys, so the effect is the same asstrategy: none.rerender_config(record, binary): re-renders from the install record (preset, cache strategy, upstreams). It writes only a file with the package marker. It never raises. It reportsconfig=rendered|unchanged|missing|not_owned|invalid_record|failed.restartre-renders inside the restart lock, before the health check. It does this also when the proxy already answers: it does not restart that proxy, but its next start (launchd, systemd, a login) reads the right file. A missing file is not created byrestart.updatere-renders after it installs the new binary, so the new binary decides the format.setupnow resolves the binary before it writes the config. It still refuses a hand-written config before any download.update --checkuses the same--versionhelper, now with a time limit.configurewrites the config and the record under the restart lock, so a session-start restart cannot re-render the old record over the new file.docs/data-dependence.md: the Pi session-start row lists whatrestartnow reads and writes. The level stays none.README.md: a new section, "The proxy config". It says that a hand edit inside a file with the marker does not stay.How it was tested
python3 -I -W ignore -m unittest discover -s scripts: 81 tests pass (63 before, 18 new).nonethe same on both, upstream comment lines kept.0.7.1,v0.8.0,0.7.2-rc1give by name;0.7.1-rc1(a pre-release counts as older than its release),0.7.0,dev, usage text, a failing binary and a missing binary give literal keys.restartconverts an old literal file to the name, keeps literal keys for an old binary, reportsunchangedthe second time, re-renders when the proxy already answers (no restart), leaves a hand-written file alone, does not create a missing file, and goes on after a failed write.updatere-renders with the new binary before the service start.setupandconfigurewrite by name for a new binary.configureholds the restart lock while it writes.invalid_recordpath,restartfalling back tofind_binary(), andupdate --checkwith the version helper.test_strategies_match_the_claude_code_pluginstill passes.node --test tests/*.test.ts: 26 tests pass.auto,1-ping,2-ping,none(by name, with an upstream comment) andauto(literal). Each ran on a free loopback port in a sandbox HOME. Each answered/healthzand/stats(preset: medium). The start log showed the strategy values:auto: keepalive=true, idle 240 s, max pings 21-ping: keepalive=true, idle 240 s, max pings 12-ping: keepalive=true, idle 240 s, max pings 2none: keepalive=falseautoliteral: the same asautoby nameData dependence
None. The change is only how the package writes its own config file.
Open questions
The two questions from #1044:
Still open:
restartonly when/healthzfails. A user with a proxy that always answers gets the new file atupdate,preset,cache-strategyor the nextrestart. With the by-name format, a new binary applies new values by itself, so this matters only for an old binary.🤖 Generated with Claude Code