Repository navigation
fix: Local models page copy and feedback, attachment limit, gateway-home cause (0.1.4 E2) - #237
oldwinter53 wants to merge 3 commits into
Conversation
Make room said a model "doesn't fit even when the memory is empty" whenever no other model was loaded in its pool, though on a shared card other apps or Linger's components held the memory. It now says a model can't fit only when it needs more than the pool's total; otherwise, when unloading every loaded model is not enough, it lists what else holds the pool (components, and other apps from the used bytes no holder accounts for) and asks to close other apps. A cancel, unload or remove under way now labels its row Cancelling, Unloading or Removing (Discarding for a stopped download) until a snapshot moves the model on, and a download the Computer accepted can be cancelled before its first progress reaches a snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An oversized Message attachment showed "message attachment exceeds the configured limit" with no number. TeamHub now adds an ErrorDetail with code too_large and the new limit_bytes field to its PAYLOAD_TOO_LARGE answer, and the composer reads that structured limit to say how large attachments may be and how large the file is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
localmodels 0.1.0.dev40 adds cause GATEWAY_HOME_NOT_PRIVATE and the folder's path to a GATEWAY_REGISTRATION_FAILED error line, while its status row keeps only the code. LocalModelError gains optional cause and path in the Runner Gateway and TeamHub contracts. The Daemon keeps the cause of a job's error line per model and puts it back on that row in every read while it still fails with that code; the model's next accepted job drops it. TeamHub refuses an unknown cause and shows the path only to the Computer's owner, and the Local models page tells the owner to quit Linger and rename that folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Approve with nits (1 P2)
Scope: base main at merge-base 080cbcf9 (equal to current origin/main, so no rebase needed); 3 commits, 31 files reviewed at 9c195ef8. Helper skills loaded: coderbook; ponytail-review and karpathy-guidelines were not loaded, but their checklists were applied from the review instructions. Ran in a separate session.
Findings
P2
apps/computer/local-daemon/internal/localmodels/library.go:207 (restoreCauses): a status read that was already running can drop a cause that was just saved.
superviseJob saves the cause under l.mu (line ~557) and then calls Refresh, which waits on refreshMu. While the load job is adopted, reconcile keeps polling (hasAdoptedJobLocked), and phaseStarted and owner-triggered Refresh also read status. If one of those reads started its localmodels status process before the tool wrote the failed row, it still sees the model as loading. It then reaches restoreCauses after the cause was saved, finds Error == nil (or a different code), and deletes the cause. The Refresh that follows reads the failed row with no cause, so the owner sees only the generic GATEWAY_REGISTRATION_FAILED copy and never the folder or the rename instruction. The race window is one status read overlapping the end of the job. Process spawn on Windows makes it wider, and Windows is the platform where this cause occurs. The new test does not exercise a concurrent read.
Fix: let only reads that began after the cause was saved decide whether to forget it. For example, store a sequence or now() with the cause, take the same stamp before runOnce in read, and skip the delete when the read is older. An accepted job already clears the cause, so the snapshot-based delete only needs to handle reads that are newer than the cause.
Verified as fine
- Daemon:
libraryEvent.cause()accepts only a known code, a known cause and a non-empty path, and clips the path to the schema's 4096 limit. The next accepted job clears the cause, and a retry that fails without a cause leaves nothing stale behind (covered byTestAFailedLoadKeepsTheGatewayCauseOnItsRow).readruns underrefreshMuand never undermu, so takingmuinrestoreCausescannot deadlock. - TeamHub:
localModelsViewis the only public reader of the stored snapshot (handlers_local_models.go:90/99), and it setsError.Pathto nil for non-owners.validLocalModelsSnapshotrefuses an unknown cause. Both have tests. - The 413 detail goes through the existing
writeErrorWithDetails.limit_bytesis an additive optional field onErrorDetail. The test covers both theErrTooLargepath and theMaxBytesReaderpath.formatBytesuses base 1024, so 52428800 bytes shows as "50 MB", as the PR says. - Contracts: the OpenAPI and Runner Gateway envelope changes are additive and optional, and the generated files match (
check (contracts)passed). - Web:
otherAppsBytesis moved into the rules module rather than copied, and the pool bar reuses it. In Make room, the "too big" message is now based onneedBytes > total_bytes, and holders that Make room cannot unload are listed. The new row labels for cancel, unload and remove, and early Cancel for an accepted download (busy), match theapps/web/AGENTS.mdupdate. Copy logic keys on structuredcauseandcode, never on prose. - Docs:
apps/web/AGENTS.mdandapps/computer/local-daemon/README.mdare updated in the same PR. The PR body's claims (tests listed, additive contracts, path visible only to the owner, cause lost after a Daemon restart) match the diff. - No new dependencies, migrations or env vars.
Process notes
- No merge commits and no fixup commits. Each commit has a descriptive body.
CI
All checks pass, including check (teamhub), check (computer-go), check (contracts), web tests 1–3 and repository-gate. I ran no tests myself; the finding comes from reading the code. CI's check (computer-go) runs without -race.
Automated review by Claude Code
Automated review of 9c195ef by Claude Code.
Summary
0.1.4 E2 (FIXLIST P2-11, P2-18; GitHub #183): Local models page copy and action feedback, the attachment size limit, and the localmodels dev40
GATEWAY_HOME_NOT_PRIVATEcause end to end. Three commits, each with its own regenerated contracts.1. Make room no longer blames the model when other apps hold the memory (
local-model-dialogs.tsx,local-models-rules.ts)otherAppsBytes(pool)now lives in the rules and the Details pool bar uses it too.2. Show actions that are under way (
local-model-row.tsx,local-models-page.tsx)3. Attachment limit names the number (TeamHub
handlers_message_attachment.go,use-composer-attachments.ts)4. GATEWAY_HOME_NOT_PRIVATE reaches the page
sequenceDiagram participant LM as localmodels dev40 participant D as Daemon (internal/localmodels) participant NS as Agent Service participant TH as TeamHub participant W as Web LM->>D: load job error line {code GATEWAY_REGISTRATION_FAILED, cause, path} Note over D: keeps cause per model; library status has only code+detail D->>NS: snapshot, row error + cause/path (each read, while the row still fails with that code) NS->>TH: record (envelope schema validates cause enum) TH->>W: view; path only for the Computer owner, unknown cause refused W->>W: "…the folder <path> belongs to another account. Quit Linger, rename that folder, then open Linger and load the model again."The owner's next accepted job for that model drops the kept cause, as does a row that has moved on. The cause lives in Daemon memory, so after a Daemon restart the row shows only the code copy. Contract changes are additive:
LocalModelError.causeandpathin both the Runner Gateway envelope and OpenAPI.Docs:
apps/web/AGENTS.md(labels, early Cancel, Make room) andapps/computer/local-daemon/README.md(error causes).Not in this PR: an unload or remove refusal that carries the cause still maps to
LOCAL_MODEL_ACTION_FAILED, because the cause reaches the page only through a failed load's row. "Recommended jumps rows mid-download" (precheck N1) is also not covered.User message →
provider_readypath: untouched. This PR adds no round trip or file walk there.Evidence
Every behavior test below failed first, before its implementation:
local-models-page.test.tsx)Downloading · 32%before and readsCancellingafterUnloadingmessage-composer.test.tsx): "names the file's size and the attachment limit when TeamHub refuses a large file"TestMessageAttachmentTooLargeNamesTheLimitcovers both the file-size path and the MaxBytesReader pathTestLocalModelsViewShowsTheCausePathOnlyToTheOwnerTestValidLocalModelsSnapshot/unknown error causeTestAFailedLoadKeepsTheGatewayCauseOnItsRowshows the cause on the failed row, keeps it across later reads, and drops it after a retry that fails without oneChecks run locally on this branch:
make check BASE=origin/mainpassed except one test,cmd/linger-computer-daemonTestManagedToolsUpdateKeepsResidentDaemonPID("Managed tools require Node 26.5.0"). It fails the same way on a clean origin/main worktree on this host, so it is environmental and not caused by this branch. The rest of check-computer passed when run separately:internal/provider/nativeand the go-local-daemon-process test.make check-repository-gate BASE=origin/mainpassed.fmt-checkandtests/integration/layoutpassed.Real-machine checks for the 0.1.4 RC round
gateway-homeowned by another account that localmodels cannot reclaim (for example SYSTEM, not Administrators), then Load. The owner's row details show the folder path and the rename instruction. Another Tenant member sees the copy without the path.Merge Danger
Door: two-way
The contract fields are optional and additive, and there is no migration or stored-data change. A revert drops the fields again, and snapshots already stored keep decoding.
Blast Radius: small
The changes are limited to the Local models page copy and row labels, one TeamHub 413 body (one new detail added), and Daemon snapshots, which can now carry
cause/pathon a failed row. Older TeamHub or Agent Service builds that receive a dev40 Daemon snapshot with a cause would reject it under the old envelope schema, so ship the Daemon with this TeamHub and Agent Service, as the desktop bundle already does.🤖 Generated with Claude Code