Skip to content

fix: fail a Room Run that never replied, Local models page copy and feedback, attachment limit, gateway-home cause (0.1.4) - #249

Merged
oldwinter90 merged 4 commits into
mainfrom
oldwinter/014-runtime
Nov 19, 2026
Merged

oldwinter90 merged 4 commits into
mainfrom
oldwinter/014-runtime

Conversation

@oldwinter53

@oldwinter53 oldwinter53 commented Nov 19, 2026 •

Copy link
Copy Markdown

Computers, Agent replies and the Local models page for 0.1.4. This PR consolidates #230 and #237, replayed on the newest main with authorship and messages kept, one commit per concern:

Commit From Concern
fix(agent): fail a Room Run that never replied to a waiting Human #230 (D) reply_not_sent (node-services, TeamHub validator, web copy, contract enum)
fix(web): explain Make room and show local model actions under way #237 (E2) Local models page copy and action feedback
fix: name the attachment size limit when TeamHub refuses a file #237 (E2) attachment limit in the 413 and the composer
feat: show why a local model's gateway registration failed #237 (E2) LocalModelError cause and path, Daemon to Web

#229 (C1, Set Up Again keeps the Computer) is not in this PR: main already has #234, which fixes the same problem (#97) differently. The parts of #229 that #234 does not cover are tracked in #243.

Integration changes

User message → provider_ready path: untouched. Neither part adds a network round trip or file walk there.

Integration checks on this branch (BASE=origin/main, GOROOT/GOBIN unset)

  • make check-repository-gate: passes.
  • make -C apps/teamhub fmt-check lint-go, go test ./tests/integration/layout: pass.
  • pnpm --filter @linger/web test src/features/local-models: 72 passed.
  • make check: check-repository, check-docs, check-contracts, check-voice-runtime, check-teamhub-cli, check-installer, check-desktop, check-teamhub and check-scripts-fast pass. check-packages failed in native-process.test.ts (this PR does not touch that package; host load average ~130). rerun on their own: check-web and check-node-services pass; check-computer passes except TestManagedToolsUpdateKeepsResidentDaemonPID, which fails the same way on an unmodified main on this host (it needs the bundled Node 26.5 layout). CI passes every required check, check (packages) and check (computer-go) included.

Part 1: fail a Room Run that never replied to a waiting Human (from #230)

Problem (P1-7, #172)

Pi on a small local model often answers in the Run's final text without calling teamhub message send. The Run reported succeeded and the Room showed nothing: no reply and no failure.

Root cause: ReplyDelivery.replyUndelivered (apps/node-services/src/agent/executor/reply-delivery.ts) failed a Room Run only when it tried to post and every write failed. An Agent that never tried was treated as choosing silence, so #completedTerminal in run-loop.ts returned succeeded. Silence is correct for Room talk the Agent only reads along with, but not when a Human mentioned it and is waiting.

Fix

A Room (Meta) Run now finishes failed with the new code reply_not_sent when both are true:

  • One of its inputs (initial or steered) is a Human's Message that mentioned this Agent. This uses the structured fields TeamHub freezes into each Inbox input: mentioned, authorType == "user", and messageKind == "conversation". The web sends every direct-chat message with the peer's @mention, so direct chats are covered.
  • The Agent never started a message write. Emoji Reactions count as writes because the Computer already classifies them that way.

Routine wakes, Task callbacks, another Agent's mention, and Room talk that doesn't mention the Agent can still end silently. No wording is matched anywhere.

The final text is not posted on the Agent's behalf. The prompt defines it as private scratch, which often holds reasoning about whether to reply, and node-services has no server-side post path. The Room shows the failure instead: "Pi: The Agent finished without sending its reply to the Room. Its model may have answered without using the message command. Ask again, or choose a stronger model for the Agent."

  • apps/node-services/src/agent/executor/reply-delivery.ts: observeInputs, replyNotSent, awaitsReply
  • apps/node-services/src/agent/executor/run-loop.ts: #completedTerminal returns reply_not_sent and logs local_run.reply_not_sent. Steered inputs are observed in #applyProviderSteer.
  • Contract enum and description: contracts/openapi/components/agent-runtime-state.yaml (regenerated)
  • TeamHub validator: apps/teamhub/internal/agentruntimestate/runtime_failure.go
  • Web copy: apps/web/src/features/rooms/runtime-status/runtime-failure-message.ts
  • Docs: apps/node-services/src/agent/AGENTS.md

Critical path (user message → provider_ready): no change. The check runs after the Provider turn completes and adds no network round trip or file walk.

Not in this PR

Tests

Written first. Both "posted nothing" cases came back succeeded before the fix.

  • apps/node-services/tests/agent/executor/run-loop.test.ts › Room reply delivery:
    • A mentioned Human waits, the Run only reads and ends with text: fails reply_not_sent, the final text stays out of the terminal, and local_run.reply_not_sent is logged.
    • A Human mention steered into a Run that started for unmentioned Room talk, nothing posted: fails reply_not_sent.
    • A Human mention answered with a message: succeeded.
    • Silent on unmentioned Room talk, on a routine wake that mentions the Agent, or on another Agent's mention: succeeded.
  • runtime_failure_test.go: reply_not_sent is accepted.
  • runtime-failure-message.test.ts: copy for reply_not_sent.

Checks run locally:

  • make check-node-services (260 files, 2622 tests)
  • make check-web
  • make -C apps/teamhub fmt-check, go test ./tests/integration/layout, make -C apps/teamhub test
  • pnpm contracts:verify
  • make check-repository-gate BASE=origin/main

make check BASE=origin/main also selects check-packages and check-computer because the generated contracts changed. check-packages passes once mise's exported GOROOT/GOBIN are unset. TestManagedToolsUpdateKeepsResidentDaemonPID ("Managed tools require Node 26.5.0") fails on this host on an unmodified origin/main too, so it isn't caused by this change.

Real-machine checks (FIXLIST section 6, item 5; 0.1.4 RC round)

macOS (macmini, zh-CN, 24 GB), Pi with Spark-X2.6 4B, then again with LFM3 1.7B:

  1. In a direct chat with a Pi Agent, send each LM-01 prompt. Each message gets either a visible reply or the red Run failure "Pi: The Agent finished without sending its reply to the Room…". There is never a Run that shows success with no message.
  2. In a Room with that Agent and one other member, @-mention the Agent with an LM-01 prompt: same expectation as step 1. Send a Room message that doesn't mention it: no failure is shown if it stays silent.
  3. Create a routine with the Agent's mention and an instruction that usually has nothing to say. When it fires and the Agent stays silent, no failure is shown.
  4. In the Agent log, each failed Run in step 1 has a local_run.reply_not_sent event with deliveredMessageWrites: 0.
  5. P1-9: keep a 10-turn chat going with LFM3 1.7B and watch for the same reply posted more than once in one Run. If it happens, note the Run id and the count, check that Stop ends it, and attach the Agent log. That decides whether a per-Run message budget is needed.
  6. Codex and Claude Code direct chats: ordinary questions still get replies and no reply_not_sent appears (regression check).

Part 2: Local models page copy and feedback, attachment limit, gateway-home cause (from #237)

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_PRIVATE cause end to end. Three commits, each with its own regenerated contracts.

1. Make room lists what holds the memory (local-model-dialogs.tsx, local-models-rules.ts)

Integrated with #242, which landed first and added the Recheck memory button and "Other apps are using N" copy to the same dialog. The dialog keeps #242's Recheck memory flow, "Enough memory is free now" state and poolOtherBytes, and adds:

 MakeRoomDialog
   <fieldset> loaded models to unload (unchanged)
+  need > pool total          → "<model> needs more than all <total> of <pool>, so it can't load there."
+                                (free memory never exceeds the pool total, so closing apps can't help)
+  unloading all isn't enough → <ul "Also using this memory">
+                                  Other apps   <used_bytes − Σ holders>
+                                  <component>  <bytes>
+                                "Other apps are using 8 GB. Close other apps that use GPU 0, then click Recheck memory."
+                                (or "Choose a smaller model." when no other app holds any)
   unloading some is enough, other apps hold memory → #242's "Close unnecessary apps and click Recheck memory" hint

2. Show actions that are under way (local-model-row.tsx, local-models-page.tsx)

 row status while a request is pending or accepted but not yet in a snapshot
   load → Loading, download → Downloading            (unchanged)
+  cancel → Cancelling (Discarding for a stopped download)
+  unload → Unloading, remove → Removing
 row actions
-  off until a snapshot reflects the accepted download
+  Cancel works as soon as the Computer accepts the download

3. Attachment limit names the number (TeamHub handlers_message_attachment.go, use-composer-attachments.ts)

 413 PAYLOAD_TOO_LARGE
+  details: [{field: content, code: too_large, limit_bytes: 52428800}]   # ErrorDetail.limit_bytes, additive
 composer
-  "big.zip: message attachment exceeds the configured limit"
+  "big.zip: Attachments can be up to 50 MB, and this file is 60 MB."

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."
Loading

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.cause and path in both the Runner Gateway envelope and OpenAPI.

Docs: apps/web/AGENTS.md (labels, early Cancel, Make room) and apps/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_ready path: untouched. This PR adds no round trip or file walk there.

Evidence

Every behavior test below failed first, before its implementation:

  • Web (local-models-page.test.tsx)
    • "names the apps holding the memory instead of calling the model too big"
    • "lists other apps when unloading every model still isn't enough"
    • "says so when nothing else in the pool can be unloaded" (now says a model can't fit only when it is bigger than the whole pool)
    • "shows a download as cancelling from the click until the Computer stops it": the row read Downloading · 32% before and reads Cancelling after
    • "lets an accepted download be cancelled before its first progress": Cancel was disabled before and is enabled after
    • "spins and disables the row's button while an unload is sent": the row now reads Unloading
    • "explains a gateway folder another account owns", for the owner (with the path) and without the path
  • Web (message-composer.test.tsx): "names the file's size and the attachment limit when TeamHub refuses a large file"
  • TeamHub
    • TestMessageAttachmentTooLargeNamesTheLimit covers both the file-size path and the MaxBytesReader path
    • TestLocalModelsViewShowsTheCausePathOnlyToTheOwner
    • TestValidLocalModelsSnapshot/unknown error cause
  • Daemon: TestAFailedLoadKeepsTheGatewayCauseOnItsRow shows the cause on the failed row, keeps it across later reads, and drops it after a retry that fails without one

Checks run locally on this branch:

  • make check BASE=origin/main passed except one test, cmd/linger-computer-daemon TestManagedToolsUpdateKeepsResidentDaemonPID ("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/native and the go-local-daemon-process test.
  • make check-repository-gate BASE=origin/main passed.
  • TeamHub fmt-check and tests/integration/layout passed.
  • Contracts were regenerated and verified.

Real-machine checks for the 0.1.4 RC round

  1. Windows, NVIDIA 16 GB with other GPU apps open: Load a model that fits an empty card but not the free memory. Make room lists "Other apps N GB" and asks to close them and Recheck memory; it never says "doesn't fit even when empty".
  2. Any platform: Download a model, then press Cancel right away, before the first progress tick. Cancel is enabled, the row reads Cancelling until the model is back to Not downloaded, and Unload and Remove show Unloading and Removing.
  3. Any platform: Attach a file larger than 50 MB in a Room. The composer shows ": Attachments can be up to 50 MB, and this file is N MB."
  4. Windows: Make a gateway-home owned 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/path on 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

oldwinter90 and others added 4 commits November 19, 2026 11:20
A Pi Run on a small local model often answers in its final text without
calling the message command. The Run then succeeded and the Room showed
nothing. A Room Run that never tried to post while a Human's Message that
mentioned the Agent waits now finishes failed with reply_not_sent, so the
Room shows the cause. The final text stays private scratch and is not
posted for the Agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes (1 P1, 1 P3)

Scope: base main, merge base 71b42436 (equal to current origin/main, so the branch is not behind). Reviewed 4 commits and 41 files at 62551304. Loaded coderbook (sections 2, 3, 5), ponytail-review (sections 1–3) and karpathy-guidelines (sections 2–3). Ran in a separate session.

Findings

P1

1. A reply sent from a chained shell command still fails the Run with reply_not_sent. (apps/node-services/src/agent/executor/reply-delivery.ts:27, :59)

replyNotSent counts a write only when the Computer reports an activity.started with kind === "message". The Computer gives a whole shell script one kind. activityPresentation (apps/computer/local-daemon/internal/provider/activity_status.go:47-52) takes that kind from the last shown step. A message send is a quiet step (command_activity.go:378), so any other recognized command in the same script decides the kind. I checked this against activityPresentation with a temporary probe test, which I then deleted:

  • python3 make_chart.py && teamhub message send --attach chart.png --content 'Here it is' gets kind command
  • teamhub docs create --title Plan --file plan.md && teamhub message send --content 'Plan is in the doc' gets kind file_change

Failure scenario: a Human @-mentions the Agent. The Agent builds a file or Document and sends the reply in the same shell call, which the compact prompt encourages ("Once a message is owed, send it in the same step"). The message posts and the Room shows it, but #attemptedWrites stays 0. The Run then finishes failed with reply_not_sent, and the Room also shows the red "The Agent finished without sending its reply…" failure under a visible reply. Before this PR the same Run succeeded. This contradicts the stated design that a Run fails only when the Agent "never started a message write". It also breaks the real-machine expectation of "either a visible reply or the red Run failure". Codex and Claude Code chain commands routinely, so check 6 in the test plan (no reply_not_sent for those runtimes) is likely to fail in practice.

Fix: record that a script contains a message send without depending on which step's kind wins. Two ways:

  • Have the Computer emit message whenever any step of the script is a message send. The status line can still show the other steps.
  • Carry a separate structured flag on the activity.

Either way, add activity_status_test.go cases for the two commands above. Add a run-loop test where a mentioned Human's Run posts through a mixed-kind activity and must succeed. A server-side alternative is to check in TeamHub whether the Agent authored a Message in the Room during the Run. That would also make this independent of the shell parser.

P3

2. awaitsReply adds a fourth ad-hoc parser of acceptedNotification.messages. (apps/node-services/src/agent/executor/reply-delivery.ts:85-97)

run-kind.ts:14-36 (messageRunKind / inputRunKinds) already classifies each queued Message by authorType and messageKind. accepted-fact.ts and accepted-notification.ts parse the same payload too. The new check uses a slightly different rule: it requires messageKind === "conversation", while run-kind treats every non-agent_runtime/task_terminal_notice Human message as chat. Export one helper from run-kind.ts, for example "Human chat message that mentioned the Agent", and use it here, so the two rules can't drift apart.

Verified as fine

  • Mentions are deterministic: mentioned, authorType and messageKind come from TeamHub's frozen inbox payload (agent_inbox_notification_payload in 00852_baseline.sql). No wording is matched.
  • Steers are observed only after provider.steer succeeds (run-loop.ts #applyProviderSteer). reply_undelivered still takes precedence over reply_not_sent.
  • The enum is added consistently in node-services provider.ts, the TeamHub validator (runtime_failure.go), the contract, the generated code and the Web copy. Docs are updated in apps/node-services/src/agent/AGENTS.md, apps/web/AGENTS.md and the local-daemon README.
  • Daemon cause tracking:
    • restoreCauses takes l.mu itself, and read is not called under it.
    • An accepted job clears the cause, and a row that moved on or changed code drops it.
    • The path is clipped to the schema's 4096 characters, and only known causes are kept.
  • TeamHub:
    • localModelsView strips path for non-owners, and that view is the only public reader of the snapshot.
    • An unknown cause is rejected at record time.
    • The 413 detail uses writeErrorWithDetails, and limit_bytes is an additive optional field.
  • Web:
    • The attachment copy reads limit_bytes from structured details (formatBytes renders 52428800 as "50 MB") and falls back to the server message otherwise.
    • The Make room kept list excludes the loaded models the user can unload.
    • tooBig uses the pool total.
    • The early-Cancel busy rule frees only an accepted, no-longer-sending download.
  • Rollout: the new Daemon to an old TeamHub/Agent Service rejects only snapshots that carry a cause, and the PR's Merge Danger section says so.

Process notes

  • No merge commits and no fixup commits. All four commits are linked to GitHub user oldwinter90.

CI

  • All finished checks pass. check (teamhub) was still pending at review time.
  • CI has no node-services job. I ran vitest run tests/agent/executor/run-loop.test.ts -t "Room reply delivery" locally: 10 passed. That suite has no case for a reply sent in a chained command (finding 1).
  • I ran a throwaway activityPresentation probe in internal/provider (deleted afterwards) to confirm the kinds quoted in finding 1.

Automated review by Claude Code


Automated review of 6255130 by Claude Code.

@linger-review linger-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes (1 P1 and 1 P3 carried over from the previous review; no new findings)

Scope: follow-up on 6255130. Base main, merge base 71b42436, 4 commits and 41 files. The PR head is still 62551304, the same commit the previous review covered, so git diff 6255130..HEAD is empty and there was nothing new to review. I re-checked the two earlier findings against the code at this head. Helper skills (coderbook, ponytail-review, karpathy-guidelines) were not reloaded because no code changed since the last review. This ran in a separate session.

Previous findings

  • P1: a reply sent by a chained command is still reported as reply_not_sent. Not resolved.
    • apps/computer/local-daemon/internal/provider/activity_status.go:47-52 still sets a shell script's activity kind from its last shown step. command_activity.go:378 marks teamhub message send and teamhub message emoji as quiet, so they drop out of the shown steps.
    • So a script like python3 draft.py && teamhub message send --file reply.md gets the kind command. A script like teamhub message read --json && teamhub message send --content hi gets the kind message_read.
    • ReplyDelivery.observe (apps/node-services/src/agent/executor/reply-delivery.ts:27) counts an attempted write only when the kind is message. A Human who mentioned the Agent gets the reply, and the Run still fails with "The Agent finished without sending its reply to the Room".
    • Fix: give a script that contains a message send a write kind, or a separate write flag on the activity, whatever its last shown step is. Then add a run-loop test for a chained send.
  • P3: awaitsReply parses the Inbox payload a second time. Not resolved.
    • reply-delivery.ts:85-97 still reads acceptedNotification.messages[].{mentioned, authorType, messageKind} by hand.
    • messageRunKind in apps/node-services/src/agent/executor/run-kind.ts:14 already classifies the same queued-message origin. Reusing it would keep the two rules from drifting apart.

Findings

None new. The head did not change.

Verified as fine

  • The head SHA matches the previous review, and there are no merge commits in 71b42436..62551304.
  • The quiet-step kind resolution and the message-only write counting are still in the state the earlier P1 describes.

Process notes

  • No new commits since the previous review. The P1 above needs a code change before merge.

CI

All reported checks pass: computer-go, contracts, desktop, installer, packages, teamhub, teamhub-cli, web, the three web test shards, web-static, repository-gate and CodeQL. I ran no tests locally; the head did not change and the finding was confirmed by reading the code. Merge state is BLOCKED, which waits on review.

Automated review by Claude Code


Automated review of 6255130 by Claude Code.

@oldwinter90
oldwinter90 disabled auto-merge November 19, 2026 03:52
@oldwinter90
oldwinter90 added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 307f2ab Nov 19, 2026
16 checks passed
@oldwinter90
oldwinter90 deleted the oldwinter/014-runtime branch November 19, 2026 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants