Repository navigation
refactor: make transport stream writer types honest - #124587
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 9:45 AM ET / 13:45 UTC. ClawSweeper reviewWhat this changesThis PR replaces unsafe transport stream assertions with canonical assistant-event types and materializes legacy provider events at the shared plugin wrapper. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open: the prior partial-less-delta blocker appears addressed by the latest commit, but this checkout cannot retrieve the PR head or declared current-main objects, and the exact-head extension check is failing. Priority: P1 Review scores
Verification
How this fits togetherProvider transports emit incremental assistant events, which plugin wrappers may normalize before the agent loop consumes them. Those events drive streamed assistant text and final tool-call results. flowchart LR
Provider[Provider transport] --> Events[Assistant stream events]
Events --> Wrapper[Plugin stream wrapper]
Wrapper --> Normalize[Event normalization]
Normalize --> Agent[Agent loop]
Agent --> Response[Assistant response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +167, Other -2. Total +164 across 21 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Validate the retrievable exact head, confirm the wrapper-to-agent partial-less-delta regression coverage, and land only after the failed extension shard is green. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the prior failure shape: Is this the best way to solve the issue? Unclear: the latest commit targets the prior blocker directly, but the exact PR-head implementation and its regression test could not be fully inspected locally. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2ceb18118ced. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Land-ready proof for head
Before/after: 62 same-family unsafe assertions to 0; assertion baseline -62; chained-assertion ledger -2. Production LOC +183/-184 (net -1); tests +236/-69; tooling/baseline +7/-9. ClawSweeper's partial-less-delta move is applied. Its latest review has no actionable findings, and its exact-head CI concern is now resolved. No known proof gaps remain for this behavior-neutral type repair. |
|
Merged via squash.
|
* refactor(ai): give transport streams an honest writer type * test(ai): use canonical transport stream fixtures * fix(ai): preserve partial-less stream deltas
What Problem This Solves
Resolves a maintainer-requested type-safety gap where provider transports and the shared provider normalizer needed unsafe assertions to write valid assistant stream events. Those assertions obscured malformed partial snapshots and kept two files outside the chained-assertion guard.
Why This Change Was Made
The public creator already implements design A: it returns the concrete writer-capable assistant event stream, while consumer-only callers use the separate read-only contract. This change preserves that compatible public shape and makes each transport's mutable output structurally derive from the canonical assistant message. The generic plain-text tool-call normalizer now crosses one explicit adapter that restores required model identity, usage, stop state, and indexes before events reach the typed writer.
No creator return shape, public helper name, or Plugin SDK subpath changed.
User Impact
There is no intended user-visible behavior change. Provider and plugin developers now get compile-time checking for stream events instead of assertion-based type erasure, while legacy identity-light normalizer snapshots are materialized into the canonical event contract at one boundary.
AI-assisted; the implementation and evidence were reviewed with the repository autoreview workflow.
Evidence
pnpm run lint:no-chained-type-assertionsnode --import tsx scripts/check-assertion-safety-ratchet.mtsnode scripts/check-changed.mjs(green local fallback because no remote ci-fast provider was ready)pnpm plugin-sdk:surface:check