Conversation
Port custody SQL owner and admission hunks from G acf2166. Preserve accepted runtime NousResearch#111216 guard and its NEW-only transaction boundary. Reject retrofit of fresh custody onto old unreferenced admissions; existing referenced retries keep their lease-free behavior. Local composed prerequisite, not owner-only publication.
G source: acf2166; port custody, preparation, reclamation and normalization owners plus initializer, branch-retention, native-media holder, hosted submit and preclaim consumers. G data-only fixtures retained with source attribution. I reference: 691bb08 only for digest-attested reconstruction adaptation. Keep Q destination storage failures distinct from authorization failures and retain source-owner/after-await checks. Factor G byte publication into prepare_verified_documents with actual authority/principal/session/request and complete final payload binding; no fake RPC identity. No Files/API adapter, spool, permission widening, executor or activation. Local composed prerequisite, not public owner-only readiness.
Additive G custody correction on 672e19b for owner NousResearch#111362. Both trusted callers prepare validated task manifests, not individual messages. Use the existing 16-attachment task bound and preflight the unchanged 50 MB task byte bound before preparation; preserve per-file, platform, owner, private handle and final payload admission checks. No shared message/media cap, schema, permission or Files/Output implementation changes. RED under declared full dependencies: 15doc/1PNG and 16doc HTTP admissions return 409 invalid_params; focused 9/16 document custody cases fail at the old eight-document guard and aggregate task overage reaches preparation. Original mixed-media crossing and ordinary-message/platform refusals remain covered.
Additive G custody correction on 672e19b for owner NousResearch#111362. Both trusted callers prepare validated task manifests, not individual messages. Use the existing 16-attachment task bound and preflight the unchanged 50 MB task byte bound before preparation; preserve per-file, platform, owner, private handle and final payload admission checks. No shared message/media cap, schema, permission or Files/Output implementation changes. RED under declared full dependencies: 15doc/1PNG and 16doc HTTP admissions return 409 invalid_params; focused 9/16 document custody cases fail at the old eight-document guard and aggregate task overage reaches preparation. Original mixed-media crossing and ordinary-message/platform refusals remain covered.
andrexibiza
left a comment
There was a problem hiding this comment.
Reviewed exact head 07fc70fe7610bc2974c6dd301e98ec74618ba5d3 against its declared runtime base b36398f71929d6069905ccca59af8d1516c5ee3a, plus the exact published contracts in required #111216 (2fb90a347b5a0d7864367b221544dc058c6cf70c) and #99107 (43b9f02183444de0d48dc72170341346d58e09dc). I also traced the custody lineage back through #109338 and the digest-attested adaptation from #98072 rather than treating those as unrelated duplicates.
The direction here is substantially better than the deferred #109338 custody shape: the fixed migration cohort removes the upgrade-wide future-file hold, v3 documents are independently copied, preparation is token/generation/epoch bound, accepted refs carry principal/session/request/payload-digest/intent and compose into the canonical admission transaction, branch ownership is explicit, and reclamation seals before unlink with conservative identity/hardlink handling. The 16-item / 50 MB task-limit correction also matches the existing task contract rather than widening ordinary message limits.
I found three remaining lifecycle gaps:
-
P1 — a successfully settled image-bearing hosted task can lose exact terminal replay before the session is retired.
SessionAuthorityreleases terminalattachments_v1native media after settlement.lookup_request()still returns that terminal row fromsession_admissionswithretired=False, and_reconstruct_payload()then requires the old image path to passverified_identity(). Once settlement has legitimately released that image, retrying the same hosted task/generation failsstorage_unavailableinstead of returning the already-accepted terminal admission/receipt. The current mixed-input retry test retries before terminal settlement, so it does not exercise the deletion boundary. Exact replay needs to depend on durable admission/ref evidence rather than released image bytes (or the image lifetime must be extended through the replay lifetime). Please add a mixed/all-image accept → settle/release → exact retry witness proving no recapture and no second execution. -
P1 — mixed document+image preparation can publish durable native image bytes before the final authorization/admission boundary, with no owner if admission is refused. The
build_payload()callback runs duringprepare_verified_documents(); for hosted mixed input it callsnormalize_submission_payload(), which callsadmit_attachments()/capture_native_media()beforeauthority.submit()performs the post-preparation authorization and before the admission transaction accepts the custody handle. If membership/grant is revoked, the preparation expires, or admission otherwise refuses, the document copies are leased and collectible but the newly capturednative-inputsimage has no admission row or preparation reference. Native-media cleanup is admission-driven, so repeated refused mixed preparations can accumulate durable orphan bytes. Either defer canonical image capture to the accepted admission boundary or make those native refs part of the preparation/expiry ownership graph. The existing revocation test is document-only; this needs a mixed-input refusal/expiry regression that proves the image bytes are reclaimed. -
P2 — the fixed legacy cohort can forget the only reclamation inventory for real pre-v3 hosted documents without unlinking them. On the #106742 base, hosted documents are captured under
native-inputsand then represented in the admission only as prompt-text paths; they do not have a structured admission media reference. Migration records those paths ingateway_legacy_input_paths, butinitialize_working_copies()/collect_legacy_input_aliases()operate oninput_custody_copiespopulated fromworking-documents-v2, so a normal native-only legacy hosted document has no later collector row. When the last legacy admission is positively retired,_legacy_active()deletesgateway_legacy_input_pathsoutright, leaving the actual file behind with no remaining owner/index that can reclaim it. The current migration test masks that shape by creating a separate native admission viacandidate()and later explicitly callingrelease_admission_media()on that synthetic structured owner. Please test the exact oldsubmission_payload()shape (opaque hosted row + native document path, no separate native admission) and either convert the fixed inventory into bounded collector rows or explicitly unlink through a fail-closed reclamation state machine before clearing the inventory.
Topology / merge order: #111362 is the narrow custody carrier extracted from #109338; it should supersede only that custody slice, not #109338's unrelated fixes. #98072 is complementary Files ownership/provenance, not a competing custody implementation. #111216 supplies the NEW-admission authorization seam and #99107 supplies the same-owner/post-preparation authorization safeguards; both must compose before this carrier can claim end-to-end acceptance. #106742 remains the runtime foundation. I did not flag the absent dependency implementations in this diff as accidental omissions because the PR explicitly declares them and says this head is not independently runnable.
Acceptance: hosted proof is not green on the reviewed object. Exact-head CI 34927830877, Docker 34927830349, and Nix 34927830371 are all action_required; CI exposes zero jobs. Of the three surviving commits, ed20163c7c19e906a19c40f7aa4a13065c05711e has no workflow runs and 672e19b5b61e33037440b06e06537e8689c6d014 also has action-required hosted runs. The reported local 17-case / composed 269-case evidence is useful scoped development evidence, but this carrier is not exact-head or every-commit hosted-green yet.
This is a careful piece of state-machine work, and the core custody/ref graph is worth preserving. The remaining issues are all at lifetime boundaries where durable bytes and durable authority stop agreeing; fixing those should leave the design much tighter.
| docs.append(str(path)) | ||
| index += 1 | ||
| if not retired: | ||
| verified_identity(path, digest, item['size']) |
There was a problem hiding this comment.
P1 — terminal exact replay still depends on image bytes that settlement is allowed to delete. A hosted admission can remain in session_admissions with status='terminal', so lookup_request() returns it with retired=False. But settlement calls release_admission_media(), and terminal attachments_v1 images are deletion candidates. On the subsequent exact retry this line re-verifies the reconstructed native-inputs/<digest>/... path and raises storage_unavailable after that legitimate release. The mixed retry regression currently retries before settlement, so it never crosses this boundary. Please make accepted terminal replay derive from durable admission/ref evidence (or retain image bytes through that lifetime) and add accept → settle/release → exact retry coverage for mixed/all-image tasks.
There was a problem hiding this comment.
Fixed in 39955e6. Terminal reconstruction now takes lifecycle state from the stored admission or tombstone, checks exact identity and payload digest, and does not require image bytes that settlement legitimately released. Live inputs still verify bytes.
The new mixed/image-only witnesses run the actual inert drain and media release before retry, return the original admission and terminal result, and prohibit both recapture and a second execution. Retired-receipt, changed prompt/digest and forged terminal-hint controls are covered too. This was a real gap in the earlier retry coverage.
| '\n[Shared attachment] file: ' + ref['path'] + '\n' for ref in references), | ||
| **({'attachments': images} if images else {})}) | ||
| from gateway.session_submission_payload import normalize_submission_payload | ||
| return normalize_submission_payload(rpc.authority, rpc.principal, |
There was a problem hiding this comment.
P1 — this publishes native image ownership before the final admission/authorization boundary. For a mixed document+image task, normalize_submission_payload() reaches admit_attachments() → capture_native_media() while prepare_verified_documents() is still building the final payload. authority.submit() re-authorizes only afterwards. If that authorization/admission refuses, the document copies remain under the preparation lease and can be collected, but the new durable native-inputs image has neither an admission owner nor a preparation ref; admission-driven native GC cannot find it. Repeated revoked/refused mixed preparations therefore leak durable bytes. Please either defer canonical image capture until accepted admission or track those refs in the preparation/expiry graph, and add a mixed revoke/expiry test that proves the bytes disappear.
There was a problem hiding this comment.
Fixed in 39955e6. Native capture now commits a preparation-bound provisional target before publication and binds the actual verified winner afterward. A refused or failed preparation retains indexed ownership even when publication succeeds but the identity transaction rolls back.
Follow-up checks also caught a concurrent ordinary capture winning with another inode, and two equal-byte images conflicting within one cold-cache task. Both are fixed: physical publication is coalesced, but ordered media entries are preserved. Barrier regressions cover winner reuse, refusal/failure, the other admission settling while the lease holds, expiry, SQLite reopen and reclamation; live/branch/other-preparation holders remain protected.
Collection stays exclusive pre-ingress, not online or immediate TTL deletion. Unknown hardlinks still block deletion; generic power-loss temporary cleanup is not claimed.
| except (TypeError, ValueError): | ||
| return True | ||
| if rows: | ||
| conn.execute('DELETE FROM gateway_legacy_input_paths') |
There was a problem hiding this comment.
P2 — clearing this table can orphan the actual legacy document bytes permanently. On the base runtime, a hosted document is captured under native-inputs but then stored in the hosted admission only as an opaque prompt-text path; there is no structured media ref whose later release_admission_media() can delete it. Migration records that real path here, while the v3 collector scans input_custody_copies (and initialize_working_copies() only creates alias rows from working-documents-v2). When the final legacy admission retires, this DELETE can therefore erase the only index without unlinking the native-only legacy file. The current migration test uses a synthetic separate native admission and explicitly releases that owner, so it does not reproduce the old hosted-document shape. Please preserve/convert these inventory rows into bounded collector work (or safely unlink before dropping them) and add an exact old-submission_payload() upgrade witness.
There was a problem hiding this comment.
Fixed in 39955e6. The fixed native-only path inventory is converted into bounded alias-collector work, including databases with an existing v3 marker. Retiring the last legacy admission no longer drops the only file index; deletion still requires positive retirement, holder checks, matching physical identity and a committed seal.
The regression now calls the actual old submission_payload document path and creates one opaque hosted admission, with no synthetic separate native admission. It proves live retention, settlement/retirement, reclamation and idempotent reopen, plus replacement/symlink/hardlink and unrelated-future-file controls. Inventory already discarded by older code is not guessed back from later files.
The final composed selection passes 84 cases; the parent reruns overlap it. The PR remains draft, and hosted CI/maintainer approval is still a separate gate rather than an every-commit green claim.
Carry the four eight-line setup adaptations already verified in the declared assembly into the custody owner, so native/API holder regressions are not left as unpublished proof-only fixes. Production is unchanged. The source fixtures match the runtime base; only custody initialization is added. These exact blobs passed in the 84-case composition and a parent 14-case focused run. The output-owner namespace selection remains separate. Source-Commit: a4922ab4703aef4d9c2bd0db16a8046ab5cebf9d Source-PR: NousResearch#111362
Carry the four eight-line setup adaptations already verified in the declared assembly into the custody owner, so native/API holder regressions are not left as unpublished proof-only fixes. Production is unchanged. The source fixtures match the runtime base; only custody initialization is added. These exact blobs passed in the 84-case composition and a parent 14-case focused run. The output-owner namespace selection remains separate. Source-Commit: a4922ab4703aef4d9c2bd0db16a8046ab5cebf9d Source-PR: NousResearch#111362
…ollection Preserve NousResearch#111362 authored history and lifecycle fixes. Relocate its collector call into the current per-profile builder before publication; retain hot-serve refusal and upstream parking behavior. Carry the exact inert two-case scope regression from the reviewed broad checkpoint c45b27cc635589e95ee20bdc0e54ae8434d2a364. No foreign owner implementations.
(cherry picked from commit 89535feffcecfce5678725a1b9a211f47f2d6251)
…ollection Preserve NousResearch#111362 authored history and lifecycle fixes. Relocate its collector call into the current per-profile builder before publication; retain hot-serve refusal and upstream parking behavior. Carry the exact inert two-case scope regression from the reviewed broad checkpoint c45b27cc635589e95ee20bdc0e54ae8434d2a364. No foreign owner implementations.
e671cb4 to
ccbd437
Compare
…h#111362 Original donor attribution: ef9774953579e6eccccc2122f1770f8b24ecbe2d. Local forward successor only; no public write.
Keep shared inputs available through admission and replay
A shared document can disappear from an upload cache before a Bot finishes the task that needs it. The file needs to remain available for the work that accepted it, including safe retries. This isolates the private-input custody portion of #109338 on #106742, without carrying its unrelated UX fixes or the route/Files stack.
prepare_verified_documentsboundary for verified task bytes and the complete final API payload. Source authorization and the Files receiver remain separate owners.Read original retained inputs without recapture
Forward update
d12f6041191233e7fa4f05bd7c02a02b84a7b85cadds only the Input-ownedgateway/hosted_room_input_retained.pyprovider. It reconstructs the exact original admission binding from committed source metadata and retained custody references, verifies physical document identity and native references, and refuses missing or mismatched evidence. It does not recapture inputs, initialize another byte store, release custody or import an Output producer.The interrupted-image correction and public nine-control Input/Q/core replay below are preserved unchanged. Retention #99107 at
031c9f3b175551bcd228fb15d8f9f704889eb820owns the separate pending-cleanup/scan/compaction contract; Output #99159 at93fd0cd531ffe9c3e6ec1cd80c868d0ae09e44f7consumes both owners through its regression fixtures. The older public replay remains pinned to its stated source and does not claim to exercise this new reader.The affected local declared composition exercised text and mixed-input retirement/replay plus task-local damaged-input isolation: 3 passed, 7 deselected (parent: 4.48s). These are the same three controls, not an additional test total. This is an isolated focused pytest diagnostic, not canonical-suite or full-suite acceptance. Its broader substrate still includes unpublished lower inputs, so this three-control proof is not yet a public-only replay. Existing native/device, protected authorization, live recovery and deployment limits remain unchanged. Exact-head hosted CI success has not been verified.
Interrupted native-image retention correction
At
c061ac2cad7e699823b1f5166be795298e64b994, an interrupted mixed-input admission no longer loses its native image before the retained work can complete retirement/replay. Consumed native preparations retain the matching copy until identity-matched raw admission retirement provides positive release evidence. Missing or foreign evidence refuses collection; ordinary successful terminal release remains unchanged.This is a normal-forward, three-file Input-only amendment: two custody modules and lower-owner lifetime regressions. It introduces no Output/driver dependency, F1 authorization change, or consumer implementation.
rpc._submitauthorization-refusal controls now pass when the declared Q/core dependencies below are composed with this Input head: 9 selected cases passed, comprising the five refusals and four new retention controls. Parent rerun: 9 passed in 2.61s. No guard or assertion was removed; these overlapping selections are not added together or represented as a full-suite/final-head independent-review pass.5ff1604d08aa31d9286a79c443af94a92a7c22b1, without alternates, promisor packs or private fallbacks. It preserves Q post-preparation refusal, the core transaction guard and Input custody through three exact shared-file resolutions. The focused selection also passed on that public-only replay: 9 passed, 0 failed, repeating the same nine controls rather than adding new cases.1b00ef7ca8926c5d5297aca86fb9bccaabe88e1aadds only the replay script and instructions; production and test source remain identical toc061ac2cad7e699823b1f5166be795298e64b994. Local proof commits are synthetic and must not be published. This still does not claim full-suite, native-device or held-scope acceptance.Focused owner reproduction, with isolated test state and the project's resource limits:
pytest -q -o addopts= tests/gateway/test_input_custody_lifetimes.py -k 'interrupted_consumed_native_image or consumed_native_image_rejects'Exact-head hosted CI success has not been verified. Historical evidence below remains bound to its stated revisions.
Current-runtime update
This is the input-custody prerequisite for Layer 5 of #97681, now composed against #106742 at
485d5f6848c25. File collection runs under the owning profile's home, credentials and terminal scope, before that authority is published. The existing guard still refuses collection once live ingress is available.P2 integration correction — failed profiles must stay unavailable. Review found that a failed collection could park a secondary profile while leaving its cron execution handle and epoch registration behind. The added failure path now withdraws only that failed construction's registrations before the caller releases ownership. The valid launch profile and replacement registrations remain intact; a primary failure stays fatal and keeps its original error.
The regression uses a genuinely invalid stored reclamation marker. It failed before the correction, then passed with matching/replacement-state and cancellation controls. Cancellation does not stop a worker thread, and this does not claim a new caller-wide thread-lifetime guarantee or repair every runtime startup/hot-serve failure path.
Review corrections
Addressed the lifecycle findings in review 5205643369, with regression-led changes:
The earlier 16-file / 50 MB task-limit correction is retained. Ordinary messages remain limited to eight files/25 MB; per-file and configured platform byte limits are unchanged.
Scope: 36 owner-only paths, +3,432/−47 against the pinned runtime. Forward updates preserve the previous public history and existing custody/lifecycle contributions. The latest amendments add interrupted native-image retention with lower-owner regressions, the public replay script and instructions, and the retained-input reader; the scoped startup integration and failure rollback remain intact. Eight setup lines across four native/API fixtures are included rather than left only in a private test assembly. No route, spool, Desktop, journal, output-producer or second-executor implementation is imported. #109338 remains intact; integrate its custody slice only once.
Required dependencies
485d5f6848c2598ca00fa7704e50e8ae66d0983a— common runtime base.43b9f02183444de0d48dc72170341346d58e09dc— passive safety and same-owner/post-preparation authorization safeguards.2fb90a347b5a0d7864367b221544dc058c6cf70c— NEW-admission transaction guard.Their implementations are not imported into this diff. Preserve both owners at admission-signature and authorization overlaps. This branch is not presented as independently runnable on the runtime base alone. #98072 supplies complementary Files ownership/provenance, not a competing custody implementation.
Verification and limits
The startup integration finding was reproduced, corrected and closed by one changed-area source re-review. This does not replace maintainer approval or claim a general review of every runtime failure path.
e671cb464b6e7c0d740855f2eabe1fd6bbe87eda. Tested minimal proof:62d548e3a36301922f652f45ec7be32978899309. The two corrected files match the accepted broader assembly89535feffcecfce5678725a1b9a211f47f2d6251; no R/I/O/M implementation was imported into this owner.39955e6063b7: 84 cases across 17 files; parent 30-case and 14-case reruns overlap that historical total.Native/alias reclamation remains exclusive pre-ingress only, not online or immediate TTL deletion. Unknown physical links or replaced files refuse deletion. This does not recover inventory already discarded by older code or claim generic power-loss cleanup: loss between link and unlink can leave a private hardlink that conservatively blocks reclamation.
The bounded input-custody change is ready for review. Final-head maintainer review and the declared dependency gates remain open. At that earlier head, CI, Docker and Nix required maintainer approval with zero jobs executed. This is not a hosted-green result. Exact-head hosted CI and maintainer approval are separate gates; approval-required runs with zero jobs are not passing CI, and the local results are not every-commit hosted-green evidence. No live gateway, receiver activation, native Save, provider execution or host-loss acceptance is claimed.