Repository navigation
feat(updates): add npm-aware update check and opt-in cached notices - #85
Merged
Merged
Conversation
8 of 11 tasks
Add `session-peer update --check`, which makes one bounded read of the npm dist-tags (latest by default, or preview) and reports current/latest/ channel/source/status with guidance for a positively identified installation owner. `update` without --check refuses with self_update_unsupported and never replaces npm-owned files; update is local only (no --host/--ssh-opt, refused over the wire). Cached notices on list/send/doctor are opt-in (SESSION_PEER_UPDATE_NOTICE) and honor --no-update-notice and SESSION_PEER_NO_UPDATE_NOTICE. The private cache is written atomically, and every cache write is serialized by a fail-closed O_EXCL token lock. One detached refresh runs per invocation with a 3 s timeout. Notices never change results or exit codes, are computed by the client after dispatch, and are added only to flat results. Refs #22
Drop any clientUpdate supplied by a verified remote receiver. Document that a flat per-host result, including a failed or unknown one, may carry the advisory, that the top-level catch path never does, and that repeated --host arrays keep their exact element shape. Add the POSIX multi-host integration tests (array shape, one refresh per invocation, failure policy and forged remote fields) and a Windows fake-SSH notice case, and clear SESSION_PEER_UPDATE_NOTICE in the test isolation preload. Closes #22
abruption
force-pushed
the
feat/22-update-check
branch
from
October 3, 2026 02:55
8677caf to
efe4bbb
Compare
This was referenced Oct 3, 2026
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #22.
This adds an npm-aware
session-peer update --checkand opt-in cached update notices. Nothing installs or replaces files. The branch is now rebased onto main e35d1e6 (#79, #84, and #86 merged) and includes the reviewed multi-host integration contract from the review-only candidate #88.The history has two commits on top of main:
feat(updates): the feat(updates): add npm-aware update check and opt-in cached notices #85 feature, resolved against feat(ssh): support ordered multi-host commands and constrained connection options #84/feat(replies): add verified sender context and optional return-route diagnostics #86 exactly as in the candidate's merge commit 8519197.test(updates): port the multi-host integration contract: the candidate's later changes (9359f90, 0e96c41, 448be73).Equivalence evidence.
git diff 448be73 <this head>is byte-identical togit diff 63eec74 origin/main, which is exactly #79 (da0e06d): VALIDATION.md, src/windows.ts, and test/windows-inspection.test.ts, with 19 insertions and 7 deletions. This head therefore equals the independently reviewed candidate 448be73 plus #79, with no other changes.Acceptance mapping
update --checkagainst npm, current/latest/channel/source, upgrade guidance, no Python/npm cross-comparison;updatewithout--checkrefuses--channel latest(stable only) orpreview. SemVer 2.0 precedence; Python-style tags are invalid.updateCommandis given only for a positively identified owner: an npm global prefix whose own launcher targets this package (default, Homebrew, nvm, nvm-windows, fnm), a pnpm/Yarn/Bun global store whose manifest declares the package, Volta, or npx. Project, source, and unknown installs getnullplusguidance. Without--check, the result isself_update_unsupported(exit 2) with no network request.npm-update.jsonis written 0600 via temp file + rename into a 0700 directory. Every cache write, background or explicitupdate --check, is serialized by one fail-closedO_EXCLtoken lock and only replaces an older record. Nothing takes over, moves, or deletes a foreign lock. See "Lock limits" below.--no-update-noticeandSESSION_PEER_NO_UPDATE_NOTICEsuppress background notices and refreshes. Notice, cache, and network errors never change results or exit codes.test/integration-multihost-updates.test.ts(POSIX).updaterefuses--host/--ssh-optand is refused over the wire. Package smoke verifies that installed files are unchanged. Skills are reported read-only.test/updates.test.ts(16),test/integration-multihost-updates.test.ts(4), a Windows fake-SSH notice case, and the package-smoke extension.Lock limits
update --checkreportscache: "skipped_stale_lock"in that case.Multi-host and failure policy
--hostkeeps request order and the exact element shape. NoclientUpdateis added to elements, and no wrapper object is introduced.--host, gets the additiveclientUpdate, including a failed or unknown per-host result.--stdio-requestreceiver never reads or refreshes the cache or produces a notice.clientUpdateis dropped.submitted,consumptionConfirmed, orretryAllowed.Design decisions
SESSION_PEER_UPDATE_NOTICE=1), unlike Python's default-on. Agents and scripts call this CLI often, and an unrequested registry call or an extra stderr line would change its no-network default.npm-update.json, and Python'supdate.jsonis never read.SESSION_PEER_UPDATE_REGISTRYaccepts HTTPS, or HTTP on loopback only, with no credentials.doctorcapabilities addupdateCheck:trueandselfUpdate:false.Type
Validation
npm ci --ignore-scriptsandnpm run buildSESSION_PEER_PYTHON_ROOT=/path/to/pinned/reference npm test: 121 tests, 116 pass, 0 fail, 5 skipped (Windows-only tests skipped on macOS)npm run test:package: pass.npm audit: 0.node scripts/check-repository.mjs: OK. Release pack/artifact: validated.test:types: clean.list --host auditSSH notice test passes with feat(ssh): support ordered multi-host commands and constrained connection options #84'sssh -Gmetadata callTested environments / limitations
windows-contract.test.tschecks an opted-in repeated--hostarray with no element field, one text stderr line identical to the opt-out stdout, and a flat single host carrying the field with code 0,ok:true, andsshHost. The refresh count, the failure policy, and the forged-field cases are unverified on Windows; they are covered by POSIX tests only.update --hostremote push is not ported. There are no skill notices.Release impact
No release or publication. This adds the
updatecommand, the additive optionalclientUpdatefield (opt-in), theupdate --checkcachefield, and thedoctorcapability flagsupdateCheck/selfUpdate. The package gainsdist/updates.jsanddist/updates.d.ts. No dependency, native, or schema-version changes.