Skip to content

Inbox: open the file a relative link means; tell the agent which links open nothing - #4114

Merged
backnotprop merged 7 commits into
mainfrom
fix/inbox-missing-file-links
Nov 27, 2026
Merged

backnotprop merged 7 commits into
mainfrom
fix/inbox-missing-file-links

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

What happened

An agent's message linked a file by a relative path ([decisions](decisions.html)) with no attachment. The message's base_path is the agent's working folder at send time (sendBasePath in packages/server/inbox-mcp.ts, from the connection's working folder or project_path), and that folder had moved. So the link pointed to a folder where the file was not. The file was on this computer, and an earlier message of the same thread had attached it under that name. The pane still said "decisions.html is not on this computer." Also, the send had not told the agent that the link opened nothing.

The fix

  • The file the person means opens (packages/server/inbox-link-fallback.ts, used by the view route in packages/server/inbox-open-in.ts). These are tried only when nothing is at the message's own places (its folder, its checkout, the thread's project folder), in this order:
    1. a file of that name (or ending in that relative path) attached to the message;
    2. the newest such file attached by an earlier message of the thread. The view answers its attachment_id, so it opens as that attachment;
    3. the link, resolved from the folders that the same sender's earlier messages in the thread were sent from. This also applies to raw and attach.
  • No widening. Only a missing result falls back, so a refused path stays refused. A secret found in an earlier folder stays unread. For a linked machine's request, those earlier folders are held to the thread's folders, even for a path the message names.
  • A file found nowhere now answers looked_in: the first place it was looked for, relative to the project when the path is inside it. The pane says <name> isn't at <looked_in>. These words are a PROPOSAL held for the owner, in one function: packages/inbox/fileMissingWords.ts. "does not show here." and "is too large to show here." are unchanged.
  • The send tells the agent. send_message and submit_guide now return the following (each is a warning; the message is still sent):
    • links_not_found [{ ref, path }]
    • question_media_not_shown [{ ref, question }]: a sound or video in a picture choice, a Shows: line, or Before:/After:. The card draws it as text.
    • pages_not_shown [{ name, size, limit }]: an attached HTML page larger than the 8 MB INBOX_PAGE_MAX_BYTES.
  • An oversize attached page now shows its download card with the existing "too large to show here" words, instead of an empty frame. This happens once the page route answers page_too_large.

No tool description, body guidance or --help text changed. The mobile contract is unchanged (scripts/mobile/check.ts passes).

Tests

  • packages/server/inbox-link-fallback.test.ts: the message's own attachment; the newest earlier attachment; the project folder; the sender's earlier folder (never another sender's); missing with looked_in; no widening (a secret, a linked machine); body link parsing; links_not_found through sendAgentMessage.
  • packages/server/inbox-send-warnings.test.ts: a clip in a choice, a Shows: line, and Before:/After:; an oversize page.
  • packages/inbox/referencedFilePane.dom.test.tsx: the missing note names where it looked, and a refused file still says it does not show; an attachment_id answer opens that attachment.
  • packages/inbox/attachmentPageTooLarge.test.tsx (DOM): a refused page shows the download card, and a kept page stays framed.

…ll the agent which links open nothing

A message's base_path follows the agent's shell, so a relative link can
start in a folder where the file is not, even when the thread already
holds it. The referenced-file view now falls back to a same-named
attachment of the message, then the newest one an earlier message of the
thread attached, then the folders the same sender wrote from before. A
refused path stays refused and a linked machine's earlier folders are
held to the thread's folders. A file found nowhere answers looked_in.

send_message and submit_guide return links_not_found, and warn about a
sound or video inside a question (question_media_not_shown) and an
attached page past what the window frames (pages_not_shown). Such a page
now shows its download card instead of an empty frame.

The pane's words for a file found nowhere are a proposal held for the
owner (packages/inbox/fileMissingWords.ts).
…is found nowhere

- The fallback takes only the linking sender's files: its own attachment, then one the same
  agent session on the same computer attached earlier in the thread, then that sender's
  earlier folders. Never another agent's file, the person's upload, or a session's on another
  computer.
- An agent in a linked worktree never falls back to another checkout's folder, as the
  message's own places already rule.
- The hover, Open in and the code preview take the same fallback as the pane, under the
  project path rule.
- A file found nowhere names where it was looked for only when that path is in the project
  for a linked computer's window; with no such path, or one that is only the name, the short
  form. The routes' errors use the same words as the pane. A view that could not be read
  says the attachment pane's "could not be opened", never where the file is.
- links_not_found asks the thread's PR first, as the pane does.
- pages_not_shown is documented as a lower bound: it names only a page that can never show.
…lback exact

- links_not_found reads a thread's PR only from what the Inbox already keeps in
  memory (InboxPulls.cachedFile); a link memory cannot answer for is not warned
  of, so a send never waits on a forge read.
- A diff header's path (from the repository's top) never falls back to an
  earlier folder or an attachment of the same name.
- A file a linked machine's window cannot reach is named with the short form,
  never a place it is said not to be.
- The hover's code window shows the attachment the pane opens; Open in still
  launches only that attachment's path while it is on disk.
- Hover and Open in fall back only after a miss: a refused file stays refused.
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 27, 2026
The places a message's path may be (candidates, PR paths, the credential
rule) move from inbox-open-in.ts into a small inbox-message-places.ts that
both the routes and links_not_found import. inbox-guides.ts, which a browser
spec loads under Node through scripts/inbox-worst-case.ts, no longer reaches
the routes' Bun-only imports. A test walks that spec's static imports and
fails on any path to "bun".
@backnotprop
backnotprop marked this pull request as ready for review November 27, 2026 20:11
@backnotprop
backnotprop merged commit 960bf50 into main Nov 27, 2026
78 of 80 checks passed
backnotprop added a commit to bendrucker/plannotator that referenced this pull request Nov 28, 2026
…panel swipes and the HTML viewer's lost highlights

ui 0.67.0 and core 0.25.35 went to npm on 2026-11-28 with package files
that match the v0.29.6 tag (c21f65e), so this pair carries what merged
after v0.29.6, up to v0.29.7.

core 0.25.36 is additive: the linked mark "decisions" and
InboxDecision.machine (backnotprop#4066), DraftFileUploader.previewUrl (backnotprop#4165), and
holdingsOf no longer counting a question Mark read closed (backnotprop#4160). No
exports subpath changes; nothing removed.

ui 0.68.0 is a minor: Escape while an input method composes only ends the
composition, and shortcuts skip such keys; holdsImeEscape is new (backnotprop#3689,
backnotprop#4162). HtmlViewer treats a collapsed live Range as lost (backnotprop#4152). Compact
panels: OverlayScrollArea scrollMemory, SidebarContainer closing and
scrollPositions, ActionMenu compactEdgeSwipe, four new hooks and the panel
rules in theme.css (backnotprop#2861). useLaunchAnnouncement waits for ready (backnotprop#4067).
ui uses nothing new from core; its exact pin follows so a host gets one
core. Publish core first.

README and HANDOFF name the new pair, and HANDOFF adds what the published
0.25.35 / 0.67.0 already held beyond their notes (backnotprop#4114, backnotprop#4151).

bun.lock is bun install's own output: the two package version lines, and
six app workspace version lines (0.29.5 to 0.29.7) the release bumps left
behind.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant