Repository navigation
refactor(outbound): inline agent result envelope - #138332
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. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Inlining this at the emission boundary makes the ownership much clearer: payload normalization is already complete, so the JSON path only needs to snapshot the array and append optional metadata/status in the established order. The array copy is the important compatibility detail because writeJson is an external runtime boundary and must not be able to splice the delivered result. Removing the second normalization owner also reduces the chance that CLI JSON and delivery drift again.
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 7:51 PM ET / 23:51 UTC. ClawSweeper reviewWhat this changesThe PR assembles agent CLI JSON results at the delivery boundary, removes unused envelope helpers and types, and moves retained checks to the delivery and payload tests. Merge readiness✅ Ready for maintainer review This remains useful, distinct cleanup: fetched main still retains the abstraction, while the reviewed patch preserves the documented JSON contract without a blocking correctness or security finding. Priority: P3 Review scores
Verification
How this fits togetherAgent-command delivery converts completed agent replies into canonical payloads, optionally sends them to a channel, and reports the outcome. Its JSON output feeds CLI consumers, while a separate result callback records delivery evidence. flowchart TD
A[Completed agent reply] --> B[Canonical payload planning]
B --> C[Optional channel delivery]
B --> D[JSON result assembly]
C --> D
D --> E[Runtime JSON writer]
E --> F[CLI stdout]
D --> G[Delivery result callback]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -73, Tests -12, Other -1. Total -86 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep envelope assembly at its sole emission owner, preserve canonical payload planning and callback ordering, and remove the unused parallel abstraction without adding compatibility shims. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR does not claim to fix a user-visible defect; review checks behavioral equivalence of the existing JSON output contract. Is this the best way to solve the issue? Yes. The sole caller already owns canonical JSON projection, so local assembly removes unnecessary branching without duplicating normalization or changing the supported SDK; retaining the generic helper offers no remaining production behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 66fa0bd2be4f. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
37642d2 to
4944a03
Compare
|
Merged via squash.
|
What Problem This Solves
The agent CLI JSON result path retained a one-caller envelope abstraction after payload planning and JSON projection had already moved into the delivery owner. That split ownership made copy and wire-format guarantees harder to follow without providing another supported behavior.
Why This Change Was Made
Build the result envelope at the existing emission boundary, using a shallow copy of already-canonical payloads and a single metadata snapshot. Preserve conditional metadata/status fields, property order and delivery/error/callback sequencing. Remove the unused envelope owner, delivery JSON type, redundant normalization wrapper and obsolete assertion-baseline row; move useful checks to the real owners.
Production: +3/-76 (net -73). Tests: +92/-104 (net -12). Tooling: 0/-1.
User Impact
No intended change to CLI output, channel delivery, public SDK behavior, configuration, storage schema, migration or protocol. The canonical payload planner/projector and delivery policy remain unchanged. This diff does not change dependencies.
Evidence
Reviewed integration head:
4944a0367b014c88a5e00c2dc03996491401cfa0, based on8f986e0ea83969b3d0543b6fdc857ce7ff3ae6bc. The actual conflict was an adjacent assertion-baseline edit; the resolution preserves the upstream storage count and removes only the retired envelope row.origin/mainatc86d5b2d270eb2eb2a98cf5070f5efe19eb068c3for transport/ratchets; explicit changed paths selected the lanes. This is not a claim that exact-head hosted PR CI has passed.Three earlier original standalone invalid-channel attempts timed out after 30 seconds; their cause remains unexplained. Successful same-order comparisons do not erase those observations or establish a cache/timing explanation. Earlier formatting/lint gate failures were corrected and retained before the passing complete gate.
One integration-save guard reported a raw-index mismatch before the signed continuation completed. The resulting parent, tree, source and index semantics were independently verified; the raw-index producer remains unknown. That guard is not reported as passed.
Hosted CI: exact-
4944a0367b01CI run 33916318683 passed on attempt 1. Final fresh GitHub mergeability/review checks and native landing remain pending. The completed integration proof is tied to the named base/head, not every later change on movingmain.