Skip to content

fix(chat): show omp's blob-store pictures on macOS and Windows (#2004) - #2114

Merged
devswha merged 6 commits into
mainfrom
fix/omp-blob-pictures-mac-win
Oct 28, 2026
Merged

devswha merged 6 commits into
mainfrom
fix/omp-blob-pictures-mac-win

Conversation

@devswha

@devswha devswha commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes #2004 (follow-up to #1998).

Problem

omp keeps a picture's bytes in its blob store (<data>/blobs/<sha256>). Since #1998 the bridge read a blob only on Linux: it opened the store as a held directory and the blob through it (/proc/self/fd/<fd>/<digest>), so no link or directory swapped in above it could stand in for the store. Node has no descriptor-relative open on macOS or Windows, so there openBlob returned null and Chat showed no blob-backed omp picture (reproduced on eamac and home-window in the issue).

Change

server/held-open.ts holds a directory opened without following a link and opens its entries through the held object, asking the open object itself what it is (identity) and where it is now (path):

open relative to the held directory path of the held object identity
Linux (unchanged) /proc/self/fd/<fd>/<name>, O_NOFOLLOW readlink /proc/self/fd/<fd> fstat
macOS openat(2) via bun:ffi, O_NOFOLLOW|O_NONBLOCK|O_CLOEXEC fgetattrlist(2) ATTR_CMN_FULLPATH fstat
Windows NtCreateFile with RootDirectory = held handle, FILE_OPEN_REPARSE_POINT; any reparse point (junction, symlink) refused walked, not compared: see below GetFileInformationByHandle (volume serial + 64-bit file index); FILE_ID_INFO for the walk
  • openBlob (codex-images.ts) and the transcript's store anchor walk (ompBlobIdentity, conversation.ts) use it, with the same checks and order as the Linux code before.
  • fcntl(F_GETPATH) is not used: it is variadic, and through a fixed FFI signature on arm64 it returns 0 with an empty path (probed on eamac).
  • Identities come from bigint stats: Bun rounds a Windows file index held in a number (probe: …020 vs the exact …019n), which would have refused every picture.
  • OBJECT_ATTRIBUTES, its UNICODE_STRING and the name share the one allocation passed to NtCreateFile, so GC cannot collect a buffer reachable only through a raw pointer.
  • An entry name refuses /, NUL, ., .. everywhere, and \ and : (streams) on Windows only.
  • server/omp-images.test.ts now runs on all three platforms, the swap races included, and the native Windows and macOS CI jobs run it.

Windows: is the held store the one its path names?

Linux and macOS compare the descriptor's own path with the path asked for. Windows names one directory several ways (a short 8.3 name, as GitHub's runner keeps its temp directory under C:\Users\RUNNER~1; another letter case), so an exact comparison refused every blob there, and a case-insensitive one let a different directory through in a case-sensitive folder. So isAt walks the path instead: from its root (a drive or a share, whose own handle must name that root, so a subst or mapped drive is refused), each name opened through the directory before it with reparse points refused, down to the very object held, compared by FILE_ID_INFO (the volume serial and the 128-bit id; the 64-bit index where a file system keeps no full id, as FAT32; ids that name no one file refused). A path with /, NUL or the \\.\ device namespace is refused before it is walked.

Try it

On a Mac or Windows PC running this branch's server, in an omp pane (omp 18.8.7 or later):

  1. Send omp a prompt with a picture (@shot.png what is this?), or ask it to read a picture file.
  2. In Chat, the picture shows on the prompt (and on the read tool row). Before this PR it is missing there on macOS and Windows, while inline pictures still show.
  3. Optional check that the store is held: ls <omp data>/blobs lists the picture's sha256 name; the Chat picture is served from that file only.

Verification

Fresh clones of origin/main 65ffea69 plus this branch, with HERDR_TEST_MODE=unit, deleted afterwards:

  • macOS (eamac, macOS 27.0.1 arm64, Bun 1.4.3): bun test server/omp-images.test.ts 21 pass, 0 fail, 3 skip (Windows-only cases); a real store probe gives image/png with the exact bytes. The same tests against main's server code: 18 fail, probe null. A store under $HOME is served too (fgetattrlist names /Users/...).
  • Windows (home-window, Windows 11 26100, Bun 1.4.2, TEMP set to an 8.3 short path as on GitHub's runner): 23 pass, 0 fail, 1 skip (the colon-name case, POSIX-only by design), including the short-name and letter-case spellings, a case-sensitive folder (Box vs box, a junction whose name differs from its target's only by case), and / or \\.\ spellings through a junction; probe image/png. 20,000 relative opens with Bun.gc(true) every 100: 0 failures. A subst drive below a junction or onto the real folder is refused (probe). Against main's server code: 18 fail, probe null.
  • Linux: 21 pass, 3 skip (Windows-only). bun run check fast green on the head (unit 7757 pass, 0 fail).
  • The race and swap cases (store or agent directory swapped for a link around each open, another real store moved in, a link as the store or as the blob, the data directory swapped before and after it is held) are refused on every platform.

Review

  • The first head failed CI's Native Windows install: GitHub's runner keeps its temp directory under an 8.3 short name, and the exact path comparison refused every blob (reproduced on home-window). Fixed by the walk above; isAt's design went through three more Codex rounds: case folding equated distinct directories in a case-sensitive folder (MEDIUM), / or \\.\ or subst could hide a junction above the walk's root and sentinel file ids compared equal (two MEDIUM), and FAT32 lost its pictures when the full id was required (MEDIUM); each fixed and verified on home-window. Final round: APPROVE, no findings.
  • Codex Sol 6.1 Fast xhigh, round 1: HIGH (Windows name buffers reachable only through raw pointers; reproduced 28/100,100 corrupt with mocked symbols under GC), MEDIUM (native CI did not run the file), LOW (: refused on POSIX). All fixed in the second commit; round 2 on that delta: no findings.
  • omo-native-code-reviewer: no code HIGH or MEDIUM. Its HIGH was that the device results were missing: it read the logs while the runs were still going; the complete results are above. LOWs: the fgetattrlist argument type was fixed; the macOS firmlink concern was checked on eamac (served).
  • Known limits, all fail closed: Windows refuses every reparse point (OneDrive placeholders, deduplicated files); a Windows file index with the top bit set would compare unequal and refuse.

This PR touches a workflow (.github/workflows/ci.yml, two test lists) and a file-serving security path, so it waits for a real review.

REMOTE_BUNDLE_VERSION is not raised here: the release PR raises it (docs/development.md).

omp keeps a picture's bytes in <data>/blobs/<sha256>. Since #1998 the
bridge read a blob only on Linux, through /proc/self/fd of the held
store, and refused it on macOS and Windows, where Node has no
descriptor-relative open.

server/held-open.ts holds a directory opened without following a link
and opens its entries through it, asking the open object itself what it
is and where it is now:

- Linux: unchanged (/proc/self/fd open and readlink).
- macOS: openat(2) relative to the held descriptor (O_NOFOLLOW), and
  fgetattrlist(2) ATTR_CMN_FULLPATH for its path, through bun:ffi.
  fcntl(F_GETPATH) is variadic and returns an empty path through a fixed
  FFI signature on arm64, so it is not used.
- Windows: CreateFileW and NtCreateFile relative to the held handle,
  both on the link itself, so a junction or symbolic link is refused;
  GetFinalPathNameByHandleW for its path, GetFileInformationByHandle for
  its identity, ReadFile for the bytes.

openBlob and the transcript's anchor walk (ompBlobIdentity) use it.
Identities are taken from bigint stats: Bun rounds a Windows file index
held in a number.

omp-images.test.ts runs on all three platforms now, the store and
parent swap races included.
…ateFile, and run omp-images natively in CI

Review of #2004's first commit:

- The UNICODE_STRING and the name it points into were separate buffers
  reachable only through raw pointers, so GC could collect them before
  NtCreateFile read them. OBJECT_ATTRIBUTES, the UNICODE_STRING and the
  name now share the one allocation passed to the call.
- ':' and '\\' are refused in an entry name only on Windows; elsewhere a
  session file may hold them.
- fgetattrlist's options argument is an unsigned long (u64).
- The native Windows and macOS CI jobs run server/omp-images.test.ts.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 29c152c and a86bcb8.

Files selected for processing: 7
  • .github/workflows/ci.yml
  • changelog.d/omp-blob-pictures-mac-windows.md
  • server/codex-images.ts
  • server/conversation.ts
  • server/held-open.ts
  • server/omp-images.test.ts
  • server/transcript-store.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Chat now displays omp blob-store pictures on macOS and Windows, in addition to Linux.
  • Bug Fixes
    • Blob images are opened through the store directory held by the bridge, preventing a substituted link or parent directory from being used in its place.
  • Tests
    • Added coverage for blob image behavior across supported platforms, including Windows and macOS.

The bridge now opens OMP blob-store images through held directories on Linux, macOS, and Windows. It verifies store and transcript identities, reads blobs through held-file objects, and adds cross-platform tests and CI coverage.

Changes: OMP blob-image access

Layer / File(s) Summary
Held-directory API and platform implementations
server/held-open.ts
Adds the Held interface and platform-specific directory and entry operations for Linux, macOS, and Windows.
Transcript and blob-store identity checks
server/transcript-store.ts, server/conversation.ts
Transcript identity values now use bigint stats. Blob identity lookup traverses held directories and checks the authorized transcript and blobs directory.
Held blob opening and reading
server/codex-images.ts
Blob opening validates the held store and opens the digest relative to it. Image reads and cleanup use held-file operations.
Cross-platform tests and CI coverage
server/omp-images.test.ts, .github/workflows/ci.yml, changelog.d/omp-blob-pictures-mac-windows.md
Tests cover supported platforms, path and identity cases, and directory-link substitutions. CI adds the image tests to Windows and macOS commands. The changelog records the platform support.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

  • devswha/ovis#1998: Adds the original OMP blob-image serving path and Linux-only store checks that this change extends.
Merge Risk: Minimal · up to a86bc

This change extends omp blob-store picture display to macOS and Windows using held-directory opens. No concrete merge-blocking risk was found. The author-reported platform CI runs remain the main validation for Windows identity behavior.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title "fix(chat): show omp's blob-store pictures on macOS and Windows (#2004)" names the main change. The PR extends blob-backed omp picture display from Linux to macOS and Windows through held-di…
Linked Issues check Passed Directly linked issue #2004 requires blob-backed omp pictures on macOS and Windows. The requirement names a race-free, descriptor-relative open: openat or fcntl(F_GETPATH) on macOS, and NtCreateFile w…
Out of Scope Changes check Passed Changed files, from the file summary and the inspected codex-images.ts diff:
- server/held-open.ts (new): the held-directory primitive. Required for the macOS and Windows opens in #2004.
- server/code…
Docstring Coverage Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Description check Passed The description covers the problem, the change, and a detailed validation section, so it matches the template's Change and Validation sections. It also includes a changelog-related note, a review hist…
Full details: Title check

Explanation

The title "fix(chat): show omp's blob-store pictures on macOS and Windows (#2004)" names the main change. The PR extends blob-backed omp picture display from Linux to macOS and Windows through held-directory opens in server/held-open.ts, openBlob, and ompBlobIdentity. The title is short, specific, and matches the linked issue #2004.

Full details: Linked Issues check

Explanation

Directly linked issue #2004 requires blob-backed omp pictures on macOS and Windows. The requirement names a race-free, descriptor-relative open: openat or fcntl(F_GETPATH) on macOS, and NtCreateFile with a root directory handle on Windows. It also requires that no link above the store, or in its place, supplies the blob bytes.

Code evidence at head a86bcb8:

  • server/codex-images.ts: openBlob now gates on heldOpenPlatform(blobPlatform) instead of Linux only. It opens the store with openHeldDirectory(blobs), checks store.stat().identity against the checked identity, checks store.isAt(blobs), and opens the blob with store.open(digest, "file"). Those are the same checks and order as the former Linux code. blobStoreIdentity uses bigint lstat, so Windows file indexes compare exactly.
  • server/held-open.ts: DarwinHeld calls libSystem openat(2) through bun:ffi (O_NOFOLLOW, O_NONBLOCK, O_CLOEXEC) and names the held object with fgetattrlist(2) ATTR_CMN_FULLPATH. WindowsHeld opens the directory with FILE_FLAG_OPEN_REPARSE_POINT, refuses reparse points, and walks the path for isAt. Entry names reject separators, NUL, '.', and '..'.
  • Not inspected: the body of WindowsHeld.open (NtCreateFile call) and the rest of isAt. The inspection output was truncated at that point. The PR description and summary report that path, and the CI change adds omp-images.test.ts to the native Windows and macOS jobs. The reported platform results are author-reported; I did not rerun them.
  • Not changed by this check: conversation.ts (ompBlobIdentity) and transcript-store.ts. Their behavior is taken from the change summary, not from inspected diff lines.

Result: the macOS and Windows requirements are implemented at the reviewed head, with no unmet coding requirement found in the inspected code. Linux behavior is unchanged per the PR description and the codex-images.ts diff. The issue's non-coding items, if any, do not apply.

Full details: Out of Scope Changes check

Explanation

Changed files, from the file summary and the inspected codex-images.ts diff:

  • server/held-open.ts (new): the held-directory primitive. Required for the macOS and Windows opens in #2004.
  • server/codex-images.ts: openBlob moves to the held-open API. Required by #2004.
  • server/conversation.ts and server/transcript-store.ts: ompBlobIdentity and the bigint fstat identity move to the same platform gate and identity form. These support the transcript store-anchor walk named in #2004.
  • server/omp-images.test.ts: tests for the new platform paths, run on Linux, macOS, and Windows. Supporting tests for the feature.
  • .github/workflows/ci.yml: adds omp-images.test.ts to the native Windows install and macOS session test commands. Verification of the feature, not an unrelated CI change.
  • changelog.d/omp-blob-pictures-mac-windows.md: a changelog entry for the user-visible fix. Documentation for the feature.

The PR description states that REMOTE_BUNDLE_VERSION is not changed, and the summary lists no such change. No change found that is unrelated to blob-store pictures. The Windows path walk and the 8.3-name, case-folding, and FAT32 handling are part of the Windows held-open requirement, not separate scope.

Limit: the summaries for conversation.ts, transcript-store.ts, ci.yml, and omp-images.test.ts are not confirmed against their diff lines. This check relies on the file summaries for those files.

Full details: Docstring Coverage

Explanation

Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 11 functions across 5 files. (2 skipped: 2 unsupported.)

Full details: Description check

Explanation

The description covers the problem, the change, and a detailed validation section, so it matches the template's Change and Validation sections. It also includes a changelog-related note, a review history, and a release note about REMOTE_BUNDLE_VERSION. The Change section is thorough and explains the problem, the platform approach, and the Windows path-identity design. The Validation section lists platform test results and the checks run, with explicit results. The description is mostly complete. The template asks for linked issues when a feature is added, and this PR is a fix that links #2004, so that requirement is satisfied. No required section is missing.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

GitHub's Windows runner keeps its temporary directory under a short 8.3
name (C:\\Users\\RUNNER~1), and the JS realpath keeps that spelling, while
GetFinalPathNameByHandleW names the held store by its long name: the
exact path check refused every blob there (Native Windows install). A
store named with another letter case was refused the same way.

Held.isAt(path) now asks whether the held object is the one the path
names. Linux and macOS compare the path exactly, as before. Windows
spells every short component long (GetLongPathNameW: the same entries by
the same names, no junction resolved) and compares letter case ignored,
one UTF-16 unit against one. A junction on the way still makes the
handle's final path differ, so it is refused.

The event-loop count test now has 30 s: it asserts buffer counts, not
time, and its 40 MiB transcript takes about 4 s on Windows.
…paring spellings

The previous commit compared the held store's final path with the named
path, letter case ignored. In a case-sensitive directory (fsutil
setCaseSensitiveInfo) that took Box for box, and a junction whose name
differs from its target's only by case passed the no-link check (Codex
review).

Windows isAt now walks the named path from its root (a drive or a
share): each name is opened by NtCreateFile through the directory before
it, a reparse point (junction, symbolic link, mount point) is refused,
and the walk must end at the very object held (volume serial and file
index). The system resolves each name as any open would, short 8.3 names
and each directory's own case rules included.

The spelling test changes the case of its own ASCII name only, and a new
test holds a store to its own name where letter case tells two
directories apart (skipped where fsutil makes no case-sensitive
directory).
…its full file id

Codex review of the walk:

- A '/' inside a share or device path (\\\\.\\C:/qa/link/agent\\blobs) put
  names into the parsed root, which CreateFileW then opened through a
  junction unseen; a subst drive's root did the same. A path with '/',
  NUL or the device namespace is refused, a server is never '.' or '?',
  and the root handle's own path must be the root named (letter case
  aside), so a drive that names a folder elsewhere (subst, a mapped
  share) is refused.
- The 64-bit file index can be 0 or all ones where a file system keeps
  none unique, and two directories would then compare equal. isAt now
  compares FILE_ID_INFO (the volume serial and the 128-bit id) and
  refuses those values; stat() refuses a legacy index that names no one
  file.

A Windows test holds a store to its path only when every name on it is
walked.
…em keeps no full id

FAT32 answers no FileIdInfo though its 64-bit index names the directory,
so the previous commit refused every store there (Codex review;
Microsoft's STL restored the same fallback). isAt prefers the full id
and falls back to the index (its sentinels refused) only when the query
fails; a full id the file system marks unavailable stays refused.
@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Merging a86bcb8 on the owner's go, relayed by Dori, which approves the ci.yml change. omo-native-code-reviewer and Codex both passed the strict file-serving review. The Windows path is fixed in the server code by walking the store's path from a real root and comparing full file ids. Native Windows and macOS CI pass. Codex's FAT32 index-reuse MEDIUM needs a program that can already write ~/.omp, inside #1998's trust boundary. It goes to a follow-up issue with the LOW notes.

@devswha
devswha merged commit 70e19f4 into main Oct 28, 2026
21 checks passed
@devswha
devswha deleted the fix/omp-blob-pictures-mac-win branch October 28, 2026 06:04
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.

Chat: show omp's blob-store pictures on macOS and Windows (needs a descriptor-relative open)

1 participant