Repository navigation
Fix stale Discord final answer payload - #82645
compoodment wants to merge 6 commits into
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. at source level: on current main, Real behavior proof Next step before merge Security Review detailsBest possible solution: Land this focused payload-builder fix with its regression tests, while leaving the restart/abort recovery class to the existing dedicated issues. Do we have a high-confidence way to reproduce the issue? Yes, at source level: on current main, Is this the best way to solve the issue? Yes. Preferring the already phase-filtered canonical final answer when explicit final-answer metadata exists is the narrow maintainable fix, and the PR preserves the unphased fallback boundary with coverage. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 524185a68ea2. |
|
Addressed the ClawSweeper P2 finding in a933dc0. What changed:
Verification:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
I tested this branch while investigating a related Discord "progress/status happened, but no final done reply" incident on Local test results
My read: this PR looks correct for the stale/truncated final payload-selection bug described in the PR body. It does not fix the separate restart/abort/no-final-lifecycle class I was investigating, where the Discord turn never reaches |
|
Added sanitized live PR-build Discord delivery evidence to the PR body. The test used an isolated PR sidecar build containing @clawsweeper re-review |
|
Thanks for the focused fix and the extra Discord proof. I'm closing this as superseded by #82850, which has already landed on main as 7d13176. That merged change covers the same stale streamed-preview/final-answer payload class with a broader embedded-runner fix: it passes the current assistant into payload assembly, prefers the completed structured final answer, keeps stale transcript assistants from overriding current one-chunk replies, and includes focused payload regressions. I also verified current main locally with: OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/agents/pi-embedded-runner/run/payloads.test.ts Result: 1 file passed, 28 tests passed. Leaving this open would now duplicate the already-landed fix and conflict with the current payload helper shape. If we still want the exact commentary-plus-final one-entry regression from this branch, we can add that as a tiny follow-up test on top of main. |
Summary
final_answer.final_answeris available, the payload builder now sends the canonical final answer; the incomplete-prefix heuristic remains as a fallback for unphased final text.AI-assisted: yes, implemented with Codex and manually inspected/verified.
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
External proof status: partial only. I verified the production payload-selection behavior locally with a focused regression test, but I did not run this patched checkout as the live Discord bot/gateway runtime.
final_answer.v24.15.0.node scripts/test-projects.mjs src/agents/pi-embedded-runner/run/payloads.test.tsfinal_answerwhen the single accumulated text is an incomplete prefix or contains commentary plus final text, and preserve the accumulated text when there is no explicit final answer.lastAssistantcontains a longerfinal_answer.Additional live PR-build Discord delivery proof
Test setup:
a933dc0d94fcbdbd9ef0fd4de8cde9518a94106c.OpenClaw 2026.5.17 (a933dc0).distcontained the new fix symbols:resolveExplicitFinalAnswerTextisLikelyIncompleteAssistantTextSnapshotDiscord delivery stress results:
PR82645-STRESS-1: delivered final markerEND-PR82645-STRESS-1.PR82645-STRESS-2: delivered full 8-bullet response endingEND-PR82645-STRESS-2.PR82645-STRESS-3: delivered two-paragraph response endingEND-PR82645-STRESS-3.Outcome:
No truncation reproduced, no commentary leakage reproduced, and all three PR-sidecar Discord deliveries reached the expected final markers.
Caveat:
Prompts were driven through the isolated PR sidecar with Discord delivery enabled, rather than inbound Discord DMs, because the normal beta gateway was still active. This still exercises PR-build Discord delivery from code containing
a933dc0d94.Root Cause (if applicable)
buildEmbeddedRunPayloadsonly preferred the canonical final answer when there were multiple accumulated assistant text payloads. A single accumulated snapshot was always treated as the payload source, even when phase metadata made the canonical final answer available.final_answer.Regression Test Plan (if applicable)
src/agents/pi-embedded-runner/run/payloads.test.tsfinal_answer, including the commentary-plus-final one-entry shape; the incomplete-prefix fallback remains covered too.User-visible / Behavior Changes
Discord final replies should show the completed assistant answer instead of an older incomplete streamed snapshot in this edge case. No config or default behavior changes.
Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation: N/ARepro + Verification
Environment
v24.15.0Steps
final_answer.lastAssistanttext withtextSignature.phase = "final_answer".Expected
final_answer.final_answer.Actual
Evidence
Attach at least one:
Copied verification output is included in the Real behavior proof section above.
Human Verification (required)
What you personally verified (not just CI), and how:
pnpm build && pnpm check && pnpm test, and localcodex review --base origin/mainbecause thecodexCLI is not installed in this VPS environment.Review Conversations
No bot review conversations have been addressed so far.
Compatibility / Migration
Risks and Mitigations
final_answerwhen a single accumulated text is intentionally shorter but still a prefix of the final answer.