You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(storage): S3 chunked upload fails with 'key not found for uploadId' behind the swappable storage proxy #31607
epic:#3814#1 · os-zhuang · session_01QUs3BrVu5TqwtmuhsjdEvM
Filing gate: ③ maintainer-dispatched task (child of #3814). Maintainer, (2026-11-08, 16:25 UTC): 「继续,现在派第二批」 (gate 1 after the card 0 inventory, cloud#3868 comment 6723322368).
Single-node defect S2, found by card 0 of #3814 (cloud#3868 comment 6723322368, smoke). Maintainer ruling D2 (2026-11-08, 16:25 UTC): 「现在修,按普通 bug 卡」. This is a single-node bug fix, so it is NOT bound by #3814's R3.
Problem
Chunk 0 of an S3 chunked upload returns 500 with "S3StorageAdapter: key not found for uploadId" on a single replica. The swappable storage proxy hides setUploadKey (storage-routes.ts:1278, attachment-lifecycle.ts:764-770), so the adapter's per-process uploadId-to-key map is never filled. The map is also per process, so it cannot work across replicas either.
Do
Resolve the object key from the sys_upload_session row (the durable record) instead of the adapter's in-process map, or pass the key through the proxy. Prefer the row: it fixes single node and round-robin together.
Tests: a chunked upload through the swappable proxy against an S3-compatible stand-in completes; a resumed chunk on a fresh adapter instance (a second process) finds the key.
Done when
PR merged; chunked uploads to S3 succeed on a single node and on any replica.
Claim: PM loop round 1 · #31607 · 2026-11-08T21:31Z
Session: session_01ADHkmP8JJo4zF2sjTBRwnX (seat); dev = card thread session_01ADHkmRmL5ZWYTvnS9e3kmo
Account: os-steve
Branch: claude/project-thread-lhttwr
Worktree: the card thread's checkout of objectstack-ai/objectstack
Domain: domain:server
Seat: domain:server#4
File surface: packages/services/service-storage/src/** (the chunked-upload path in storage-routes.ts, the swappable proxy in attachment-lifecycle.ts, the uploadId-to-key map in s3-storage-adapter.ts), their tests, .changeset/31607-*.md (stop on breach; no spec edit, no new sys_upload_session column without a seat amendment)
Container & model: M, mode:thread, model: default tier (dispatch-gates --tier on service-storage: no path-derived mandate), effort: medium
Clause-②: no
Metadata-protocol: none
Responsibility: the storage service in objectstack (packages/services/service-storage) loses the S3 object key behind the swappable proxy · no platform path covers it today (the adapter's per-process map is never filled through the proxy) · reached by every chunked upload to S3, on one node and on any replica
Thread-read: 6724409261
Premise: holds (maintainer ruling D2 2026-11-08 16:25Z 「现在修,按普通 bug 卡」, a single-node bug, not bound by #3814 R3; the dev reproduces on main in step 0)
Serial constraints cleared: no open card claims service-storage; #3814 siblings #31599/#31601/#31602 touch runtime, cloud-connection and the cluster seam only.
{
"issue": 31607,
"status": "done",
"branch": "claude/project-thread-lhttwr",
"pr": "https://github.com/objectstack-ai/objectstack/pull/31705",
"session": "session_01ADHkmRmL5ZWYTvnS9e3kmo",
"premise_still_valid": true,
"summary": "Reproduced on main 5d1382a5: chunk 0 of an S3 chunked upload through SwappableStorageService answers 500 'S3StorageAdapter: key not found for uploadId' (the proxy had no setUploadKey, so the init door's probe never matched). sys_upload_session already stores key (required field), so no column. Fix: the chunk and completion doors hand session.key from the row to the backend (new module helper handUploadKeyToBackend) before every uploadChunk/completeChunkedUpload, and the proxy forwards setUploadKey (no-op for adapters without it). Init no longer seeds the map; the row is the only source, so any replica works. Comments in s3-storage-adapter.ts and attachment-lifecycle.ts corrected (made false by the change); no code change there. No spec edit, no HTTP shape change.",
"tests": "head 14e4eea9. New src/s3-chunked-upload-session-key.test.ts, 4 cases (S3 single replica; S3 init/chunk/complete on three fresh adapter instances sharing store+bucket; local adapter bytes unchanged; adapter without setUploadKey sees identical contract calls). Step 0 on main: 2 failed | 2 passed (4), both S3 cases 500 with the card's error. service-storage build+test+typecheck under lock: VERDICT command-exit 0, Test Files 76/76, Tests 1428/1428, check:test-typecheck OK. Ablation 1 (back to in-process table: init seeds through proxy, row hand-off removed at both doors, anchor 2->0, markers counted 1 and 2 on disk): only the second-process case red with the original error, 1 failed | 3 passed; restored blob == HEAD 8e21af92d37b, git diff HEAD empty. Ablation 2 (proxy drops the key, anchor 1->0): both S3 cases red, 2 failed | 2 passed; restored blob == HEAD a5b6010fb8eb. Test imports src relatively, no dist leg.",
"gates": "local: dispatch-gates --commands (repo objectstack-ai/objectstack, tree 14e4eea9) derived 73; after turbo build of ./packages/** and ./examples/** (VERDICT command-exit 0) all 73 ran, each exit 0; --ran reconciliation: 73 derived, 73 run, 0 NOT-MEASURED, 0 UNRUN. Lint: root eslint --no-inline-config packages/services/service-storage/src exit 0 (package has no lint script). CI check-runs: in_progress at report time (not awaited).",
"dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm. Targeted at 14e4eea9 under the lock: storage-chunked-parallel-parts, storage-chunked-resume-integrity, attachments-permission-matrix, error-sentences-live: VERDICT command-exit 0, Test Files 4/4, Tests 37 passed 1 skipped (38). They run the local adapter.",
"mcp_calls": "5 — issue_read get x1, issue_read get_comments x2, pull_request_read get x1, issue_read get_comments x1 (report read-back); all reads, no write tool",
"api_writes": "2 — relay pr_create (POST pulls, PR #31705), relay comment (POST issues/31607/comments, this report); git push not counted",
"open_questions": [
{
"question": "Hand the key down through the existing setUploadKey map (this PR) or add key-taking out-of-contract methods on the S3 adapter (e.g. one per chunk/complete/abort) so the adapter holds no per-upload state?",
"options": [
"A keep setUploadKey seeded from the row before each call (this PR): one way to address an upload on the adapter, matches the reap guard precedent, no new names; per-process map entries remain as a cache",
"B three new key-taking methods on the adapter and proxy: stateless, but a second dialect beside the contract methods and three new public names"
],
"recommendation": "A, because the row is already the record and B adds names and a parallel call path for no behaviour difference"
}
],
"security_findings": "withheld",
"out_of_scope_findings": [
"carrier: none · the S3 adapter's uploadId-to-key map keeps an entry on each replica that served a chunk but did not complete the upload (abandoned uploads already did on main); noted in the PR's Acceptance notes, not filed"
],
"files_changed": [
".changeset/31607-s3-chunked-upload-session-key.md",
"packages/services/service-storage/src/attachment-lifecycle.ts (comment only)",
"packages/services/service-storage/src/s3-chunked-upload-session-key.test.ts (new)",
"packages/services/service-storage/src/s3-storage-adapter.ts (comments only)",
"packages/services/service-storage/src/storage-routes.ts",
"packages/services/service-storage/src/swappable-storage-service.ts"
],
"line_budget": "+374 / -17 across 6 files (the new test file is 298 of the additions)",
"deviations": [
"The claim's File surface names the proxy in attachment-lifecycle.ts; the proxy class lives in swappable-storage-service.ts (inside the claimed packages/services/service-storage/src/**), edited there.",
"PR body opens with the harness attribution block (two lines) and Fixes #31607 follows it, per os-dev's harness-attribution exception, not as line 1.",
"No assignees sent on pr_create (relay read-back: none); the harness asked for an MCP assignee/reviewer write, not done because the standing order forbids MCP writes.",
"origin/main moved 12 commits past base 5d1382a5 with none in service-storage; no merge taken.",
"Dogfood run targeted (4 storage/attachment files), not the full battery, since the card has no ! and no (narrowing) arm (os-dev DoD wins over the delta's suite line)."
]
}
Activity
objectstack-fleet commentedon Nov 8, 2026
triage#1 · os-zhuang · session_01AavokzJ5DndAwitDXvKy4U
Path: none
Triage: confirmed ·
domain:server· p2 ·pm:queue· 2026-11-08T17:03Z⛔ Not a claim.
domain:server. The fix is in objectstack packages only.lockRecord,客户端只能假定「有 pending 就是锁死」 #3814 child, maintainer-directed batch.domain:devxanddomain:serveras separate lanes, or merge them? Measured load and boundary friction, 2026-11-08 #31424 rule 2).Generated by Claude Code
objectstack-fleet commentedon Nov 8, 2026
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX
Claim: PM loop round 1 · #31607 · 2026-11-08T21:31Z
Session:
session_01ADHkmP8JJo4zF2sjTBRwnX(seat); dev = card threadsession_01ADHkmRmL5ZWYTvnS9e3kmoAccount:
os-steveBranch:
claude/project-thread-lhttwrWorktree: the card thread's checkout of
objectstack-ai/objectstackDomain:
domain:serverSeat:
domain:server#4File surface:
packages/services/service-storage/src/**(the chunked-upload path instorage-routes.ts, the swappable proxy inattachment-lifecycle.ts, the uploadId-to-key map ins3-storage-adapter.ts), their tests,.changeset/31607-*.md(stop on breach; no spec edit, no newsys_upload_sessioncolumn without a seat amendment)Container & model:
M,mode:thread,model: default tier (dispatch-gates --tier on service-storage: no path-derived mandate),effort: mediumClause-②: no
Metadata-protocol: none
Responsibility: the storage service in objectstack (
packages/services/service-storage) loses the S3 object key behind the swappable proxy · no platform path covers it today (the adapter's per-process map is never filled through the proxy) · reached by every chunked upload to S3, on one node and on any replicaThread-read: 6724409261
Premise: holds (maintainer ruling D2 2026-11-08 16:25Z 「现在修,按普通 bug 卡」, a single-node bug, not bound by #3814 R3; the dev reproduces on
mainin step 0)Serial constraints cleared: no open card claims
service-storage; #3814 siblings #31599/#31601/#31602 touch runtime, cloud-connection and the cluster seam only.objectstack-fleet commentedon Nov 8, 2026
domain:server#4 · os-steve · session_01ADHkmRmL5ZWYTvnS9e3kmo
os-dev-report
{ "issue": 31607, "status": "done", "branch": "claude/project-thread-lhttwr", "pr": "https://github.com/objectstack-ai/objectstack/pull/31705", "session": "session_01ADHkmRmL5ZWYTvnS9e3kmo", "premise_still_valid": true, "summary": "Reproduced on main 5d1382a5: chunk 0 of an S3 chunked upload through SwappableStorageService answers 500 'S3StorageAdapter: key not found for uploadId' (the proxy had no setUploadKey, so the init door's probe never matched). sys_upload_session already stores key (required field), so no column. Fix: the chunk and completion doors hand session.key from the row to the backend (new module helper handUploadKeyToBackend) before every uploadChunk/completeChunkedUpload, and the proxy forwards setUploadKey (no-op for adapters without it). Init no longer seeds the map; the row is the only source, so any replica works. Comments in s3-storage-adapter.ts and attachment-lifecycle.ts corrected (made false by the change); no code change there. No spec edit, no HTTP shape change.", "tests": "head 14e4eea9. New src/s3-chunked-upload-session-key.test.ts, 4 cases (S3 single replica; S3 init/chunk/complete on three fresh adapter instances sharing store+bucket; local adapter bytes unchanged; adapter without setUploadKey sees identical contract calls). Step 0 on main: 2 failed | 2 passed (4), both S3 cases 500 with the card's error. service-storage build+test+typecheck under lock: VERDICT command-exit 0, Test Files 76/76, Tests 1428/1428, check:test-typecheck OK. Ablation 1 (back to in-process table: init seeds through proxy, row hand-off removed at both doors, anchor 2->0, markers counted 1 and 2 on disk): only the second-process case red with the original error, 1 failed | 3 passed; restored blob == HEAD 8e21af92d37b, git diff HEAD empty. Ablation 2 (proxy drops the key, anchor 1->0): both S3 cases red, 2 failed | 2 passed; restored blob == HEAD a5b6010fb8eb. Test imports src relatively, no dist leg.", "gates": "local: dispatch-gates --commands (repo objectstack-ai/objectstack, tree 14e4eea9) derived 73; after turbo build of ./packages/** and ./examples/** (VERDICT command-exit 0) all 73 ran, each exit 0; --ran reconciliation: 73 derived, 73 run, 0 NOT-MEASURED, 0 UNRUN. Lint: root eslint --no-inline-config packages/services/service-storage/src exit 0 (package has no lint script). CI check-runs: in_progress at report time (not awaited).", "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm. Targeted at 14e4eea9 under the lock: storage-chunked-parallel-parts, storage-chunked-resume-integrity, attachments-permission-matrix, error-sentences-live: VERDICT command-exit 0, Test Files 4/4, Tests 37 passed 1 skipped (38). They run the local adapter.", "mcp_calls": "5 — issue_read get x1, issue_read get_comments x2, pull_request_read get x1, issue_read get_comments x1 (report read-back); all reads, no write tool", "api_writes": "2 — relay pr_create (POST pulls, PR #31705), relay comment (POST issues/31607/comments, this report); git push not counted", "open_questions": [ { "question": "Hand the key down through the existing setUploadKey map (this PR) or add key-taking out-of-contract methods on the S3 adapter (e.g. one per chunk/complete/abort) so the adapter holds no per-upload state?", "options": [ "A keep setUploadKey seeded from the row before each call (this PR): one way to address an upload on the adapter, matches the reap guard precedent, no new names; per-process map entries remain as a cache", "B three new key-taking methods on the adapter and proxy: stateless, but a second dialect beside the contract methods and three new public names" ], "recommendation": "A, because the row is already the record and B adds names and a parallel call path for no behaviour difference" } ], "security_findings": "withheld", "out_of_scope_findings": [ "carrier: none · the S3 adapter's uploadId-to-key map keeps an entry on each replica that served a chunk but did not complete the upload (abandoned uploads already did on main); noted in the PR's Acceptance notes, not filed" ], "files_changed": [ ".changeset/31607-s3-chunked-upload-session-key.md", "packages/services/service-storage/src/attachment-lifecycle.ts (comment only)", "packages/services/service-storage/src/s3-chunked-upload-session-key.test.ts (new)", "packages/services/service-storage/src/s3-storage-adapter.ts (comments only)", "packages/services/service-storage/src/storage-routes.ts", "packages/services/service-storage/src/swappable-storage-service.ts" ], "line_budget": "+374 / -17 across 6 files (the new test file is 298 of the additions)", "deviations": [ "The claim's File surface names the proxy in attachment-lifecycle.ts; the proxy class lives in swappable-storage-service.ts (inside the claimed packages/services/service-storage/src/**), edited there.", "PR body opens with the harness attribution block (two lines) and Fixes #31607 follows it, per os-dev's harness-attribution exception, not as line 1.", "No assignees sent on pr_create (relay read-back: none); the harness asked for an MCP assignee/reviewer write, not done because the standing order forbids MCP writes.", "origin/main moved 12 commits past base 5d1382a5 with none in service-storage; no merge taken.", "Dogfood run targeted (4 storage/attachment files), not the full battery, since the card has no ! and no (narrowing) arm (os-dev DoD wins over the delta's suite line)." ] }Stamped 2026-11-08T22:05Z.
objectstack-fleet commentedon Nov 8, 2026
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX
Landed · #31607 · 2026-11-08T23:23Z
e43a1691a8; head8e23f6b8ab(ACCEPT 6728278394, TIER_DEFAULT seat review)Fixes #31607State change:
pm:dispatchedremoved in this stroke. No follow-up card is owed.