Skip to content

fix(agents): preserve follow-up errors and attachments - #170916

Merged
steipete merged 1 commit into
mainfrom
codex/qa1122-source-reply
Oct 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa1122-source-reply

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes missing error replies and unprepared remote attachments when a new input steers an agent after an earlier input received a final reply through the message tool.

User Impact

Each accepted input keeps its own answer or failure outcome. A final reply for an earlier input no longer suppresses the later input's error reply or attachment preparation. Already delivered replies still avoid duplicate output; no configuration or migration is needed.

Why This Change Was Made

Delivery receipts accumulate across an attempt, but completion belongs to an individual input. The subscriber now retains canonical completion on each sealed answer segment, and both terminal payload selection and host attachment preparation use that state. Historical receipts remain available for transcript mirrors and deduplication.

Evidence

  • Reproduced the missing error through the actual Agent loop, message tool, steering, subscriber, and payload builder: the base omitted input B's error after input A's final reply. The repaired case and a progress-only control pass.
  • Reproduced the attachment sibling through an admitted host media capability: the old path never read B's remote file. The repair stages the exact bytes; the already-delivered control performs no extra read.
  • 149 distinct focused tests pass. Final changed-file runs: message-tool loop 5 cases in 26.416 s wall, payload errors 53 cases in 17.777 s, host media 5 cases in 29.225 s; the real-loop cases themselves take 224 ms and 10 ms. Production and owning test types, scoped lint, and formatting pass. Independent review through P2 is clean. Hosted CI timing will be supplied by the attached run.

These are deterministic production-boundary regressions with synthetic provider output and remote-file bytes. They do not claim fresh live-provider or signed-in browser proof. Lifecycle error events were not suppressed by the original defect; the error regression concerns the reply payload.

Scope source-reply completion to each input while retaining historical delivery receipts. Use the same canonical completion state for terminal replies and remote attachment preparation.
@clawsweeper

clawsweeper Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review October 13, 2026 09:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T09:51:48.676266Z ccc300e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Oct 13, 2026
@steipete
steipete enabled auto-merge (squash) October 13, 2026 09:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ccc300e4ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +157 to +164
const completedSourceReplyViaMessageTool =
sourceReplyDeliveryState !== undefined
? sourceReplyDeliveryState === "delivered"
: ordinarySourceReplies.completedSourceReplyViaMessageTool;
const deliveredSourceReplyViaMessageTool =
sourceReplyDeliveryState !== undefined
? completedSourceReplyViaMessageTool
: ordinarySourceReplies.deliveredSourceReplyViaMessageTool;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve custody for pending source replies

When sourceReplyDeliveryState is "pending"—for example, after a final message-tool send whose delivery observer failed or could not yet confirm settlement—this branch treats it exactly like "missing". That allows the builder to emit the assistant text, attachment, or terminal error alongside a send that may already have succeeded, even though observeReplyDelivery and resolveTerminalReplyDelivery explicitly retain custody for pending delivery to prevent duplicates. Treat pending as suppressing replacement artifacts while reserving "missing" for recovery.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed with negative production-owner tests: pending delivery (including an observation failure) could emit replacement text/media/error, and the admitted-host media path staged an attachment unnecessarily. The PR merged while cancellation was being reconciled, so the corrective follow-up is #170937. It keeps pending distinct from delivered and missing, preserves committed mirrors, and passes 129 focused cases including later-input recovery.

@steipete
steipete merged commit aaa9560 into main Oct 13, 2026
188 of 193 checks passed
@steipete
steipete deleted the codex/qa1122-source-reply branch October 13, 2026 10:01
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash auto-merge.

steipete added a commit that referenced this pull request Oct 13, 2026
* fix(agents): preserve pending reply delivery custody

Keep unresolved source delivery separate from missing delivery when selecting replacement answers, attachments, and errors. Preserve committed mirrors and recovery for later steered inputs with missing delivery. Corrects the pending-custody case from #170916.

* fix(agents): propagate observed delivery custody through terminal preparation
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
Scope source-reply completion to each input while retaining historical delivery receipts. Use the same canonical completion state for terminal replies and remote attachment preparation.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
* fix(agents): preserve pending reply delivery custody

Keep unresolved source delivery separate from missing delivery when selecting replacement answers, attachments, and errors. Preserve committed mirrors and recovery for later steered inputs with missing delivery. Corrects the pending-custody case from openclaw#170916.

* fix(agents): propagate observed delivery custody through terminal preparation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant