Repository navigation
refactor(worker): unify inference payload handling - #139245
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 1:47 PM ET / 17:47 UTC. ClawSweeper reviewWhat this changesUnifies worker model-stream events and final results under one handler and reuses the existing error normalizer without changing observable behavior. Merge readiness✅ Ready for maintainer review Keep open as useful maintenance work. No blocking correctness findings: the refactor preserves sequencing, callback rejection, and terminal settlement, and remains absent from current main. Priority: P3 Review scores
Verification
How this fits togetherCloud workers request model inference through the Gateway. This client orders incoming stream updates and final results before passing them to the worker’s agent loop. flowchart LR
A[Worker agent loop] --> B[Inference request]
B --> C[Gateway inference service]
C --> D[Validated stream frames]
D --> E[Identity and sequence checks]
E --> F[Stream updates]
E --> G[Final result or error]
F --> A
G --> A
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -30. Total -30 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep sequence admission and settlement with the inference operation owner, preserving transport validation and replay reset at their existing boundaries. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR claims behavior-preserving cleanup rather than a bug fix; source comparison and existing coverage support that premise. Is this the best way to solve the issue? Yes. Consolidating the two paths inside their existing operation owner removes duplicated policy without moving operation state into the transport dispatcher or changing sibling clients. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3e4becea5e2c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
The final one-file refactor is ready to land at All 47 existing tests in the three selected suites passed before and after, alongside one temporary characterization covering 22 ordered scenarios with byte-identical traces. The full classified gate, managed P2, peer and separate exact-head review passed. Exact-head CI is green, with its actual tested merge and both parents verified. No live-provider run or full build is claimed. I read the completed ClawSweeper review at this exact head. It has no findings, security concerns, Before merge items or outstanding Rank-up moves. Proceeding through native prepare/merge under the requested codebase cleanup. |
|
Merged via squash.
|
* commit '911d7d5b0c107f7274f2415ca9655dcc6105f0e8': (867 commits) fix(skills): deliver pending Workshop approval controls (#139248) fix(gateway): deliver loopback ask_user prompts to the originating channel (#138831) docs: keep root agent instructions focused on repository policy (#139258) fix(matrix): exclude archived state roots from scans and selection (#112329) perf(agents): prepare exact tool names once per catalog batch (#139267) fix: preserve Swarm progress and simplify owner plumbing (#139269) fix(tailscale): release claims after gateway process-group exit (#139261) refactor(cli): simplify lazy command registration (#139108) test(ui): retain synthetic widget failure evidence (#139229) fix(buzz): keep implicit replies at thread root (#138879) test(diagnostics): await graceful Gateway shutdown before cleanup (#139247) fix(ci): unblock releases with different tooling package managers (#139259) feat(ui): add social preview links for private sessions (#139250) fix(codex): retain failed conversations for guarded continuation (#139246) chore(ui): refresh control ui locales (#139200) fix(ci): run browser checks for real-gateway inputs (#139256) fix(llama-cpp): reconcile managed router state before requests (#136363) chore(i18n): refresh native locales (#139237) refactor(worker): unify inference payload handling (#139245) refactor(terminal): replay wrapped prefixes in one pass (#139240) ...
What Problem This Solves
Maintainer-requested maintenance of worker inference streaming. Stream events and terminal results share one operation sequence, but keeping their admission and callback-failure behavior aligned required maintaining duplicate paths.
Why This Change Was Made
Use one operation-owned handler for identity checks, sequence admission, gap notification, event delivery and terminal settlement. Reuse the existing error normalizer and remove the four duplicated private methods. Frame validation, replay reset and connection lifecycle retain their existing owners.
User Impact
No user-visible behavior change. Reconnect/replay, callback rejection and terminal results preserve their existing behavior. Production is +24/−54, net −30 lines; tests are unchanged.
Evidence
Head:
cdce21b73a239ca6b99a983fee13001f6e02c0a1, based onbdd75d44c56154a24123be1a4218647b5f6712f3. The committed patch matches the tested and reviewed source. The separate final-head review is clean and exact-head CI passed. The first completed ClawSweeper review covers this exact head and reports no correctness or security findings, Before merge: None, and no outstanding Rank-up or checklist items. Its full report has been reviewed.core/coreTestsgate passed all 28 actual check phases, including typechecks, formatting, lint and all selected guards. Managed P2, independent peer and final committed-head reviews are clean.CI actually tested merge
a403932e15be57a3986645e8442ce774dc3f40a5, with verified ordered parents main886aaa689076b7b7c2f7a4d8d0048e89f5855698and this exact PR head. That main snapshot has no overlapping change in the worker neighborhood, inference producer/schema, shared error normalizer or dependency pins since the candidate base.