Repository navigation
refactor(transport): share outgoing transfer phase ownership - #4551
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 10 files
You’re at about 91% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Apex Sentinel · ✅ ApproveSince the last review: 0 new · 0 still open · 0 no longer raised No open findings. 2 findings below 💬 Talking to SentinelIn a finding's thread, reply with:
On this conversation, comment Earlier reviewsReview of
|
| Where | Finding |
|---|---|
packages/host-kit/src/internal/transport.ts:257 |
🆕 Phase sequencing moved out of the digested wire declaration, silently narrowing the gate |
1 finding below minor hidden (user_settings.min_severity).
Reviewed with this repository's own Sentinel configuration (d78be6c88715).
Review of 217528ae · 14.11.2026 15:34 UTC
Apex Sentinel · ✅ Approve
1 finding(s): 1 minor.
🟡 Minor (1)
| Where | Finding |
|---|---|
packages/host-kit/src/internal/transport.ts:175 |
New watchdog.suspend() has no production caller |
1 finding below minor hidden (user_settings.min_severity).
Reviewed with this repository's own Sentinel configuration (d78be6c88715).
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 217528a. The verdict and the full list are in the summary comment.
|
I found no code defects at 217528a that stop this PR. It is not ready to merge yet, because the Coverage check failed and its log is cut off before any failure line. The changed host-kit and remote upload tests run in that job, so I cannot say whether this diff caused the failure. Please rerun the job or share the full log, and confirm the failure is not in the moved transport tests. Not blocking, and you can take or leave these: Could the PR move only what has a production consumer, which is the watchdog without Of the open inline threads, #4551 (comment) (guard test passes anyway) and #4551 (comment) (comment says minutes) still apply, as does #4551 (comment) (no I did not re-run your mutation controls or the closure, import-budget and layering gates, and I did not reproduce the Coverage run locally. The lazy-loading claim rests on reading the type-only imports. |
|
I accepted the smaller surface: The drain thread has new runtime evidence beyond the default CLI path: a real HTTP loopback at 217528 completed four 1 KiB writes and received 4096 peer bytes with zero drains, then incorrectly expired at request-body/120000. The 64 KiB file path stayed alive. I am correcting the shared write-completion boundary while preserving backpressure, callback semantics and phase guards; this does not claim the current default file path reproduced it. I reran the failed Coverage job once per your request. The original log contains no failure summary and remains failed with cause unproven; I will capture the rerun outcome and moved-test collection, then post final heads and validation after the review-round push. No merge. |
|
The single requested Coverage rerun also failed at the unchanged published head. Its text log is still truncated, but the check-run annotations identify 6 failures in this PR's remote loopback tests: progress/stall phase cases and resume, redirect, connected-stall and completion lifecycle cases. The stalled-body case hits the existing 5000 ms test limit; the other failures are assertions. These are captured candidate-test failures, not a passing rerun or an infrastructure diagnosis. The existing source owner now has the exact annotations and is reconciling real I/O with the controlled clock while making the already-assigned write-progress and fixture corrections. No additional worker, timeout increase, test deletion or CI retry is being started. No moved host-kit test is named in these annotations, but that alone does not establish its successful execution; final-head Coverage remains required. Original and rerun failures retain their heads and logs. |
217528a to
10ea602
Compare
|
Addressed the review at Removed One pinned pnpm 11.17.0 The old Coverage failure and its authorized rerun remain failed. The captured rerun annotations identify six remote loopback failures, with none naming host-kit; that absence does not prove the moved tests passed in the failed job. Revised fixtures wait for actual I/O and use structurally unfinished sources. Corrected-head Linux CI must establish the moved-test and Coverage result; macOS passes and delayed-I/O modeling do not establish the old Linux root cause. No additional blind retry was made. The unused standalone-download clause remains an optional comment cleanup; no download adoption is claimed. Node-floor, Bun, proxy and daemon work remain outside this layer. |
|
I found no code problems at 10ea602, but the PR is not ready to merge yet because the CI run that proves the fix has not finished. The earlier loopback-test failures are addressed. The six loopback fixes live in #4552, not in this PR. The old drain listener and Not blocking, and fine to take or leave: upload-stream.ts:159 composes two host-kit observers that are always installed together, and three exits repeat the same three dispose calls. If The five review threads, #4551 (comment), #4551 (comment), #4551 (comment), #4551 (comment) and #4551 (comment), are fixed at this head and can be resolved. |
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 10ea602. The verdict and the full list are in the summary comment.
|
The CI run I was waiting for has finished at 10ea602: Coverage and Integration Tests pass, so the host-kit transfer-phase and remote upload-stream suites now run green in the Linux lane, and the smoke jobs pass too. With no code problems found in the earlier review, this is ready for human review. |
|
The completed CI run for the reviewed head I captured the full Coverage log. Its instrumented command was The newer Apple run also passed. The failed aggregator in the rollup belongs to the superseded cancelled run 43628394595; its log says I am leaving the optional observer composition unchanged: the accepted ownership split keeps the first-layer write observer consumed independently and the upper phase observer separate. The current caller installs one of each and retires both. This avoids a new composition contract in this correction round. This evidence belongs to published |
10ea602 to
af5c634
Compare
|
Restacked and pushed af5c634 over #4552 at 77a5e16. The phase owner still composes with the lower completed-write owner; no unused suspend API is retained. The lower layer now treats typed control-request expiry as terminal and preserves caller cancellation, with corresponding wire-manifest coverage. Independent source review and the final test-only recheck found no findings. Focused tests passed 127/127; the exact affected gate passed once (19,847 unit tests, 10 skipped; 376 related tests; nine checks passed, seven CI-owned/manual checks skipped; full-unit fallback retained). Counterfactuals and historical failures keep their exact-head attribution. Coverage, Integration and smokes passed at the predecessor 10ea602, as previously captured. New-head Linux CI and reviews are still required; no old result is transferred to af5c634 and no failed job was blindly retried. The optional observer-composition/producer-loop reshaping remains deferred; phase-observer disposal has source/listener-unit evidence rather than a runtime-detected call-site claim. No merge. |
|
The PR is ready at af5c634. The earlier review of 10ea602 (#4551 (comment)) found no problems, and the changes since then are comment edits, a type-union reformat and pinned test literals, with no runtime change. Not blocking, take or leave: the ordering comment "Move the phase before the request's response callback runs." now sits on the The wire-surface thread on Some checks did not pass on this head. The Smoke Tests run has one failure plus cancelled sibling jobs, and the lint, coverage and integration run was cancelled. The smoke jobs drive local device flows and do not reach remote upload transfer, so these look like cancellation fallout rather than this change, but I have no failure log to confirm that. I did not rerun the focused tests, so the author-reported results are unverified here. Before merge, please rerun the cancelled and failed checks on af5c634 until they are green. |
|
The completed replacement runs at af5c634 are green:
The older aggregate132579429731 actually logs The wire-surface thread4575183705 is already replied to and resolved with the local-policy versus peer-payload rationale; Sentinel now reports no open findings. I accept the optional wording correction: the completed-write observer stops counting writes rather than moving a phase. It is recorded for the existing correction round after the frozen source review finishes; no source was changed by this backstop. These CI results belong to published af5c634 only. The pending #4552 request-finish fix requires restacking and fresh exact-head validation before publication, followed by CI on the pushed heads; current passes do not transfer to those local pins. No merge. |
…going-request phase observer Move the transfer phase watchdog into host-kit/transport, add suspend() for demand-aware idle, and extract the node:http outgoing-phase observation that remote upload adopts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ort internals internal/transfer-phase.ts was a new module that every client, daemon, proxy and remote entry evaluated eagerly through the transport barrel. The phase watchdog, its typed expiry classifier and the outgoing-request phase observer now live in internal/transport.ts, which those closures already evaluate. The barrel exports only what production consumers import: createTransferPhaseWatchdog, isTransferPhaseTimeoutError, observeClientRequestPhases and TRANSFER_CONNECT_TIMEOUT_MS. The remote loopback tests pin the response-header and body-inactivity policy values as literals in their shared fixtures; the host-kit tests import the owner module directly and are renamed for it (transport-phases.test.ts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ttempt wire digest Moving the outgoing-request phase observation into host-kit/transport and retiring it per attempt changed streamFileToHttpRequestAttempt's digest without a ledger update. The digest is the one wire-compat.test.ts prints for the current source; requests on the wire are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he agent-docs budget docs/agents was 40081 bytes against the 40000-byte guidance budget. The one module that owns transfer phase budgets and its host-kit/transport export already state that ownership. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The outgoing-request phase observer stops treating drain as body progress and owns only the connection, flush and response phases. The upload attempt composes it with host-kit's observeCompletedRequestWrites once per request and disposes both at every settlement. Generic write cases live with the write owner; the phase suite keeps the composition cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…upload attempt digest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The phase suite installs its controlled clock once per test and disposes every watchdog when its test finishes; the phase and watchdog docs say what the code does without repeating it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
af5c634 to
024cb04
Compare
|
Pushed and restacked The smaller attempt removes duplicate success disposal and maps an aborted signal's reason once in The focused suite passes 127 tests. The exact affected gate passed once with exactCommit=true, checkoutChanged=false and failOpen=false: nine checks passed, seven CI-owned/manual checks skipped, 376 related tests, 19,847 unit tests passed and 10 skipped; full-unit fallback retained. Actual gross sizes are lower 2404, this layer 699 and combined 2497. Current-head |
|
I reviewed the changes since af5c634 at 024cb04 and found no problems. The new source-close assertions look like valid regressions, as long as the spy's 20s release timer runs on the installed transfer clock under fake timers. I did not run the tests locally, and I did not verify the claim that dropping the abort-reason preference fails three assertions. CI is green at this head: an earlier run was superseded and cancelled, and a rerun passes every required job. No further changes are needed from this review. |
Summary
Transfer phase timing has one owner in host-kit. Remote uploads compose its connection/finish/response observer with #4552's completed-write observer. Completed hops retire both observers before any next hop.
This changes 8 files against #4552. The attempt now has one abort-reason mapping and no duplicate success disposal. Its sole response-path join is inlined; failure paths retain the outer final join. Existing watchdog tests move with the owner. The unused suspend API remains deferred. Refs #4441. Proxy, daemon and download deadlines remain separate.
Validation
Tested
024cb04a4d38de644148233ae79108191a28507d, parent13a4c1d9, merge-based78be6c8.Pinned pnpm 11.17.0
check:affected --run --head <sha> --jsonpassed once: exactCommit=true, checkoutChanged=false, failOpen=false. Nine checks passed, including wire compatibility, 376 related tests and 19,847 unit tests (10 skipped). Seven CI-owned/manual checks were skipped; #4050 full-unit fallback remains. Focused baseline passed 127 tests.Cold review found no findings. Removing the central abort-reason preference fails three typed-reason assertions; restored controls pass. The phase-observer disposal call site retains source/listener-unit evidence rather than a runtime-discrimination claim.
Gross sizes: lower 2404, this layer 699, combined 2497. Current-head Coverage, Integration, Apple and other required checks are green. Sentinel approves with no open threads; two below-minor items are hidden. Linux Coverage passed 20,196 tests (70 skipped), plus 11 fuzz tests. Earlier failed/cancelled runs stay recorded. Node-floor, Bun and remaining #4441 runtime obligations are unproven.