|
| 1 | +[agent] 2026-11-28: architecture refactor |
| 2 | + |
| 3 | +**`main`:** cfc870f. The run started at 12:55Z. |
| 4 | + |
| 5 | +### Chosen |
| 6 | +No PR this run. Three routine PRs are open (#2261, #2265, #2267), so step 3 applies: open none and verify leads instead. All three are `ready` and none has changed since 2026-11-26 (each `updated_at` is the same): none merged or closed, none has a review from a person, and no maintainer has commented on the discussion. No issue was opened by anyone else since 10:55Z. |
| 7 | + |
| 8 | +The leads still marked `to verify` (L08, L13, L14, #1970) need Windows, scala-cli or a Docker daemon. So this run took two things no entry under this charter names: what a rewrite does to a file's mode and owner, and what a run leaves when it is killed or interrupted. The first is clean. The second gave the run's one defect: two kinds of stage file that no later run removes, one of them a copy of the project's `.npmrc` with its token. Filed as #2337. |
| 9 | + |
| 10 | +### PR |
| 11 | +None opened. #2261, #2265 and #2267 still await review. `main` has not moved from cfc870f. |
| 12 | + |
| 13 | +### Leads and issues |
| 14 | + |
| 15 | +**New: L69, filed as #2337.** Every write is staged under a second name and renamed. A signal or a kill between the two leaves the stage. Two places are swept later (beside a patched file after ten minutes, directly under `.socket/` after an hour; both came in with #2052). Two are not: |
| 16 | + |
| 17 | +- **`.socket/blobs/.socket-dl-<hash>-<uuid>`**, a blob download that did not finish. Agent-mode `scan` over a real `npm install` (`lodash`, `ms`, `kleur`, `left-pad`; 44 patched files; a stand-in API), 150 signals each at a random moment: SIGINT left one 8 times, SIGTERM 24. It then survived `scan`, `repair` ("Checked 88 blobs: all in use"), `scan --prune`, `apply` and a full `rollback`, after which it is what keeps `.socket/blobs/` in the project. |
| 18 | +- **`.socket-stage-<file>-<uuid>` beside a project file a hosted run rewrites.** Over the bench's npm project, 200 signals each: SIGINT left a stage of `.npmrc` or `package-lock.json` in the project root 8 times, SIGTERM 8, SIGKILL 7. With a `.npmrc` that holds a token and is ignored by git, the 63rd Ctrl-C left this: |
| 19 | + |
| 20 | +``` |
| 21 | +$ git status --short |
| 22 | +?? .socket-stage-.npmrc-b5e43b73-4a87-49ec-b1ff-9fdab649e005 |
| 23 | +$ grep -c _authToken .socket-stage-.npmrc-* |
| 24 | +1 |
| 25 | +$ git check-ignore .npmrc .socket-stage-.npmrc-* |
| 26 | +.npmrc |
| 27 | +$ touch -d '2 hours ago' .socket-stage-.npmrc-*; socket-patch scan --yes; echo "exit $?" |
| 28 | +exit 0 |
| 29 | +$ git add -A; git diff --cached --name-only |
| 30 | +.socket-stage-.npmrc-b5e43b73-4a87-49ec-b1ff-9fdab649e005 |
| 31 | +package-lock.json |
| 32 | +``` |
| 33 | + |
| 34 | +The controls: with both two hours old, a wet scan removed `.socket/.socket-stage-manifest.json-<uuid>` and kept `.socket/blobs/.socket-dl-…`; and 16 minutes after a kill, `apply`, `rollback` and `rollback --preserve-state` took the stages beside patched files from 30, 25 and 24 to 0. The issue has the transcripts, the code lines and the plan: one rule for a stale stage over every directory a run stages into, and the signal handler unlinking the stages it holds beside the lock. It is not a decision issue: the rule is the one the two sweeps already state. |
| 35 | + |
| 36 | +It joins the queue after #2336. The window for the token is narrow; the partial download is what most users will meet. |
| 37 | + |
| 38 | +**L70, out of charter; the contract leaves it uncovered.** A hosted `rollback` writes its files one by one in path order with no journal. For Gradle that removes `.socket/gradle/hosted-index.tsv`, the file every command finds the pin through, before it restores `gradle.lockfile` and `settings.gradle`. 400 SIGKILLs at random moments of a 71 ms rollback left 13 trees with the three `.socket/gradle/` files gone and `settings.gradle` still wired, 8 of them with `gradle.lockfile` still at the patch as well. Over such a tree: |
| 39 | + |
| 40 | +``` |
| 41 | +$ socket-patch rollback --yes; echo "exit $?" |
| 42 | +Error: No patches in this project; nothing to roll back. |
| 43 | +exit 1 |
| 44 | +$ socket-patch list |
| 45 | +No patches in this project. Run `socket-patch scan`. |
| 46 | +$ gradle help --offline -q # Gradle 8.14.3 |
| 47 | +> Could not read script '…/.socket/gradle/socket-patch.hosted.settings.gradle' as it does not exist. |
| 48 | +$ socket-patch scan --yes | head -1 |
| 49 | +Switched 1 package to hosted patches; rewrote 4 files. |
| 50 | +$ socket-patch rollback --yes | head -1 |
| 51 | +Restored pkg:maven/io.acfimora2/onno2-core@10.0.14 to its upstream registry entry |
| 52 | +``` |
| 53 | + |
| 54 | +`CLI_CONTRACT.md` line 2075 says of the hosted restore: "A process killed between two writes is not covered: hosted mode keeps no journal, so the files written so far stay written." And its Gradle row (line 794) makes the index row the reference. So this is the documented limit, and `scan` then `rollback` gets out of it. What a maintainer could still want: the file a pin is found through written last, so that a killed rollback is refused by name (`patched_ref_invalid`, as it is when the index survives) and not answered with "No patches". By construction (not run: the bench refuses the registries these restores ask) the same order leaves a state `list` calls unpatched for pnpm (`pnpm-workspace.yaml` still routed), Cargo (`Cargo.toml` still names the registry) and NuGet (`packages.lock.json` still at the patch). For Yarn Berry, uv and Go the half state is named and refused, and for npm, Bundler and Maven the pin is still listed. |
| 55 | + |
| 56 | +**Seen and not filed:** |
| 57 | +- **A rollback keeps the six Trusted Checksums lines in a `.mvn/maven.config` that held anything else.** The contract says so (line 2071, `maven_trusted_checksums_left`). |
| 58 | +- **A scan over a pom that is pinned while `.mvn/maven.config` and `.mvn/checksums/` are absent writes neither and warns of nothing.** The contract calls the checksum line "not required (the suffixed version is the pin)". A `git commit -am` after the first scan reaches this state, since both files are new. |
| 59 | +- **Files a hosted scan creates are the runner's.** A root run over a project owned by uid 1000 leaves `.npmrc`, `pnpm-workspace.yaml`, `.cargo/config.toml`, `.mvn/` and `.socket/gradle/` owned by root. The contract's ownership rule (line 431) is about files that already exist. |
| 60 | +- **The next-steps line says "Commit .npmrc and package-lock.json"** in a project whose `.gitignore` names `.npmrc`. |
| 61 | +- **L08, L13, L14, #1970:** still to verify. They need Windows, scala-cli or Docker. |
| 62 | + |
| 63 | +### Areas examined |
| 64 | +All with the binary built from `main` (a debug build). |
| 65 | + |
| 66 | +- **The mode and owner of every project file a hosted run rewrites**, on the bench's 21 hosted projects (the 20 package managers and Bun's isolated layout), as root over trees owned by uid 1000 with every file at 0640: 28 rewritten files keep 0640 and 1000:1000. With the files a fresh scan creates already there at 0600 (`.npmrc`, `pnpm-workspace.yaml`, `.cargo/config.toml`, `.mvn/maven.config`): they keep 0600 and their owner. A `rollback` for Hatch, Maven and Gradle (the three that need no registry) keeps both as well. No run wrote under `HOME`. Clean. |
| 67 | +- **A hosted scan killed part-way.** It replaces its files one by one, in path order. For the ten projects where it changes two files or more, every subset of the changed files was built (34 states) and scanned again: 29 reach the tree of an uninterrupted scan. The five that do not are not prefixes of the write order, so no kill leaves them: Yarn Berry and Bundler with the lock new and the manifest old (each warns and names the remedy), and Maven's pinned pom without its `.mvn` files (above). Clean. |
| 68 | +- **A hosted rollback killed part-way**: Hatch, Maven and Gradle, every subset (36 states) under the next `rollback` and the next `scan`; 400 real SIGKILLs of the Gradle one; real Gradle over a torn tree; and the prefix states of nine package managers under `list`, `rollback` and `scan --dry-run`. L70. |
| 69 | +- **Agent-mode `apply`, `rollback` and `scan` killed at random moments**, over the real npm install: 180 kills of `apply`, 200 of `rollback`, 150 of `scan`. After every kill the same command again reaches the tree of an unkilled run, a `rollback` over a killed `apply` or `scan` gives back npm's bytes, `list` after a killed `rollback` never says "No patches" over a patched file, and `vex` attests only packages whose every file is patched. Clean but for the stages (#2337). The kills land between packages, not inside one: a package's renames run back to back, and none of 300 more kills of `apply` left `lodash` with only some of its 40 files renamed. So a half-renamed package was not met. |
| 70 | +- **SIGINT and SIGTERM at random moments**: 300 of an agent scan, 400 of a hosted npm scan, 200 SIGKILLs of the latter. `apply.lock` is gone after every catchable signal. #2337. |
| 71 | +- Read, not run: the callers of the plain and the mode-preserving atomic writers (33 and 111 call sites; every plain one writes a file of socket-patch's own), the group commit's unjournaled path, and the self-update's stage sweep. |
| 72 | + |
| 73 | +### Lessons |
| 74 | +- **Signal the binary at random moments in a loop.** Forty lines of Python: copy the tree, start the command, sleep a random part of an unkilled run's time, send the signal, classify the tree by which of the files that would change have changed and by what else appeared. A few hundred runs take minutes and found both the stages and L70. A debug build also stops at the names `SOCKET_PATCH_FAILPOINT` lists (core `utils/failpoint.rs`), but the hosted scan and rollback write through paths that hit none. |
| 75 | +- **Then give each torn tree to every command.** The same command again, the opposite one, `list`, `vex`, and the package manager. "The next run finishes it" is the claim to test; what `rollback` says over a tree it cannot see is where L70 was. |
| 76 | +- **A subset is not a crash.** The first table of torn hosted states had five that never converge. All five put a later file of the write order ahead of an earlier one. Read the order (a `BTreeMap` of paths) before calling a state reachable. |
| 77 | +- **Know which clock a sweep reads.** The stages beside patched files age by ctime, which `touch` resets to now, so my first check called a working sweep broken. I read the function, kept four killed trees and came back after ten minutes. The sweep of `.socket/` reads mtime, and there `touch -d '2 hours ago'` is a fair test. |
| 78 | +- **Read the contract before weighing a crash finding.** Line 2075 names the hosted restore's missing journal as a limit. That turned L70 from an issue into a note in ten seconds; I found the line after the kills, and should have looked first. |
| 79 | +- **The mode sweep costs two minutes and settles a rule for 21 package managers**: `chown -R 1000`, `chmod 0640`, run as root, compare `lstat` before and after. Root is what makes the owner half testable here. |
| 80 | +- The hunt took about 50 minutes of wall time: the builds 4, modes and owners 4, the hosted crash states 9, the agent kills 22 (most of it the loops themselves), the signals and the token 6, the rest reading. |
| 81 | +- The register was at 11,991 characters and is at 11,980. L69 joined the collapsed `filed` row, L70 the out-of-charter row, and one note names the kill loop. To make room the two Areas rows are one, the `filed` row's Where cell names no modules, and eight phrases are shorter. |
| 82 | +- The owner was notified of #2337. |
| 83 | + |
| 84 | +### Needs a person |
| 85 | +- **#2337: an interrupted run leaves stage files nothing removes.** A partial download stays in `.socket/blobs/`, and a hosted run can leave a copy of `.npmrc`, token included, that no ignore rule covers. It asks nothing. |
| 86 | +- **Review #2261, #2265 and #2267.** This is the twenty-ninth run in a row that could only verify leads. |
| 87 | +- **#2270** still blocks `ci-ok` on every PR; #2280 is open for it. |
| 88 | +- **#2309, #2277 and #2297 need an answer.** **#2299** and **#2315** each ask which of two fixes a maintainer prefers. |
| 89 | +- **L70 is a maintainer's call, not a defect by the contract:** whether a hosted rollback should write the file a pin is found through last. |
| 90 | +- Thirty-eight confirmed problems wait for a slot. #2301, #2303, #2305, #2308, #2310, #2312 with #2314, #2317, #2287, #2330, #2332, #2290, #2299, #2327 with #2334, #2318, #2321, #2286, #2289, #2315, #2336 and #2337 go first, then #2259, #2294, #2296, #2271, L22 (after #2261), #647, #1917, #1926, #1860 beside #2271, #1836, #2306, #2322, #2324, #2328, #2319 and #2333. |
0 commit comments