GeezerVison is showing github.com — feat(pm-stack): prompt attachments — multipart upload, host-dir storage, storage refs (#10036 S7) by dezren39 · Pull Request #13328 · developing-today/code
Conversation
dezren39
commented
Nov 23, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
S7 of the #9539 prompt & chat surface (design §6): upload handling, multipart, storage refs. Streaming audio stays out of scope (future enhancement).
Gate
Design §8 question 3 (where attachment storage lives) was answered on #10036 on 2026-11-22 (decision of record): option (a) — the pm-stack host data dir, with storage refs in the records. This PR implements exactly that; refs are abstract (attachment:<uuid>), so the B2 option (#9414) remains a resolver migration later, not a redesign.
What landed
POST /api/prompt accepts multipart/form-data in addition to JSON. Text fields are shaped into the same body validateNewPrompt already checks (one validator for both encodings; notify coerced from its form string, refs parsed as a JSON array). File parts arrive under the field name attachments. The JSON path is byte-for-byte unchanged.
- New
src/prompt-attachments.ts: PromptAttachmentsStore persists each blob in the attachments dir under its uuid (temp-write + rename, like the other file-backed stores) with a JSON sidecar (original name, content type, size, sha256). The multipart body is read under a cap before parsing, mirroring readJsonBody's contract.
- Storage location:
cfg.promptAttachmentsDir — PM_AGG_PROMPT_ATTACHMENTS_DIR, defaulting to prompt-attachments/ beside the prompts file (the host data dir, per the decision).
- Record shape:
PromptRecord.attachments: PromptAttachment[] ({ref, name, contentType, size}), normalized on load so pre-S7 records read as [] and a hand-edited record cannot smuggle a ref the resolver would refuse. The §3.7 sync-block answer body now echoes the refs instead of the placeholder []; GET /api/prompt/:id includes them too.
- Read side:
GET /api/prompt/:id/attachments/:ref returns the blob — only when the named prompt's record carries that ref (a ref alone is not a capability), served as a download with nosniff, never inline.
- Limits, enforced before any write: ≤5 files, ≤5 MiB per file, ≤25 MiB total per submission. A submission whose record fails to persist removes its blobs, so a refused upload leaves nothing behind.
- Widget: the prompt form is now
multipart/form-data with a file input (name="attachments", multiple).
Tests
New src/prompt-attachments.test.ts (store round-trip + sha256, forged/traversal ref refusal, limit enforcement with nothing written, multipart shaping/extraction, record persistence + legacy-record load, widget + config wiring) plus the S3 fixture updated for the new record field.
Evidence: remote dispatch via the fleet-command fallback — run 45185224298 at head 4edee8513: success — bun test src/prompts.test.ts src/prompt-attachments.test.ts src/prompt-ws.test.ts (41 tests, 0 fail) and bunx tsc --noEmit clean. (Two earlier runs on this branch failed only on a BodyInit typing error in the download route, since fixed; the first bare dispatch found no bun in the executor container, so the command installs it first, per the #9608 lane's proven recipe.)
No new dependencies. No schedule created, changed, or retired.
Refs #10036 (stays open as the S7 tracker until Felix's review/merge).

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
…ge, refs on the record (#10036 S7)
POST /api/prompt now accepts multipart/form-data: text fields are
shaped into the same body validateNewPrompt checks, file parts under
"attachments" are persisted first, and the record carries their
storage refs. Per the design §8.3 decision of record (2026-11-22,
option (a)), blobs live in the pm-stack host data dir
(PM_AGG_PROMPT_ATTACHMENTS_DIR, default prompt-attachments/ beside
prompts.json) under abstract attachment:<uuid> refs, so a later B2
move is a resolver migration. GET /api/prompt/:id/attachments/:ref
serves a blob back (record-bound, download-only, nosniff). Limits:
5 files, 5 MiB each, 25 MiB total, enforced before any write; a
failed submission removes its blobs. Streaming audio stays out of
scope (future enhancement, design §6).
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 14 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
da14d339-f0c6-41ef-93a9-3778a7b52f03
Commits
-
Reviewing files that changed from the base of the PR and between 6314507 and 4edee85.
Files selected for processing: 7
-
pm-stack/aggregator/src/config.ts
pm-stack/aggregator/src/prompt-attachments.test.ts
pm-stack/aggregator/src/prompt-attachments.ts
pm-stack/aggregator/src/prompt-widget.ts
pm-stack/aggregator/src/prompts.test.ts
pm-stack/aggregator/src/prompts.ts
pm-stack/aggregator/src/server.ts
- 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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-23T13:39:46.705354Z |
4edee85 |
PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|