Repository navigation
fix(infra): relay exec-completion replies on WebChat-internal sessions - #148360
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. |
vincentkoc
left a comment
There was a problem hiding this comment.
This still does not safely deliver an exec completion to WebChat.
-
The no-channel path cannot settle success.
src/infra/heartbeat-dispatch.ts:564-572returnsvisibleReplySent: false;src/auto-reply/reply/reply-dispatch-outcome.ts:56-68maps that todelivered-not-visible; andsrc/infra/heartbeat-dispatch.ts:516-555consequently callsfinish(..., false). The run reportsran, but the exact exec event is not consumed (src/infra/heartbeat-dispatch.ts:276-306), so a later wake can rerun the turn and duplicate the completion. -
conversationEntry.delivery.kind === "internal"is not a WebChat discriminator.src/config/sessions/types.ts:71-80uses this state for internal sessions generally, including hidden internal-effects sessions (src/agents/internal-session-effects.ts:63-108). Please use an explicit client-visible internal projection fact instead of widening relay eligibility for all internal sessions. -
The new tests in
src/infra/heartbeat-runner.webchat-exec-completion.test.ts:8-82prove only prompt wording. They do not prove transcript/Gateway projection, exact-event consumption, dedupe, reconnect history, stale-session fencing, or hidden-session exclusion.
Please revise at the owning boundary: carry an explicit client-visible internal projection target or receipt, deliver through the canonical session transcript/Gateway projection path, and consume the exact event only after the owner confirms an idempotent accepted write for the current session lifecycle.
Required proof: exactly one completion for an active subscriber; exactly one history entry after disconnected reconnect; event consumption only after success; no duplicate on a second wake; stale/reset and hidden-internal sessions remain fenced; external-channel, cron, and failed-turn behavior remains unchanged.
Exact-head CI is also red for related lint and test-type failures:
- https://github.com/openclaw/openclaw/actions/runs/34866334497/job/104051964068
- https://github.com/openclaw/openclaw/actions/runs/34866334497/job/104051963578
The PR-context gate requires an authored ## What Problem This Solves section:
ClawSweeper produced no verdict because its exact-head input scan timed out:
|
Thanks for the detailed review — all three points are addressed in
Also fixed the exact-head CI failures from the same push: an unnecessary Full re-verification (targeted tests, full heartbeat suite 501/501, gateway chat suite 235/235, both failing CI type-check stripes, both failing lint stripes, full build) is in the updated PR body under "Review Response (2026-09-14)". |
|
Codex review: blocked before merge. Reviewed September 17, 2026, 5:32 PM ET / 21:32 UTC (Revision 12). ClawSweeper reviewWhat this changesThe PR publishes background-command completion replies into eligible WebChat sessions, settles their events after transcript acceptance, and preserves legacy media replay. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: the defect remains on main, and this PR provides a useful repair with sufficient current-head proof and no actionable patch findings. Priority: P1 Review scores
Verification
How this fits togetherBackground command completions wake OpenClaw’s heartbeat runner, which prepares a reply and chooses its delivery path. This change connects eligible internal conversations to the existing transcript owner, feeding live Gateway notifications and reconnect history. flowchart TD
A[Background command completes] --> B[Heartbeat wake]
B --> C{Eligible conversation and delivery enabled}
C -->|No| D[Preserve suppression]
C -->|Yes| E[Validate session and writer]
E --> F[Commit or reconcile transcript reply]
F --> G[Live notification and reconnect history]
F --> H[Settle accepted completion event]
Decision needed
Why: The concrete concerns appear addressed, but an automated review cannot replace the human reviewer’s disposition. Before merge
Agent review detailsSecurityNone. PR surfaceSource +383, Tests +1915, Other 0. Total +2298 across 18 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep completion publication under the canonical transcript owner, with one accepted reply per occurrence and preserved suppression, session fencing, and legacy replay. Do we have a high-confidence way to reproduce the issue? Yes: an internal WebChat session with target:last reaches main’s external-route-only relay check and channel-less rejection. The report and historical browser differential corroborate this; no current-main execution was performed in this review. Is this the best way to solve the issue? Yes: the repair uses the existing transcript and delivery owners, confirms an accepted receipt before settlement, and preserves explicit suppression and upgrade replay behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 928dba98c56a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
- Extract the indicatorType condition from prepareHeartbeatDispatchReply into a named helper function shouldSetIndicator for improved readability - The helper clearly documents when each indicator type is returned: 'alert' when alerts are disabled, 'sent' when delivery succeeds, undefined in all other cases
- Consume the triggering system event for a WebChat exec-completion reply too. deliverHeartbeatDispatch previously reported visibleReplySent: false unconditionally for channel === "none", which the settle callback maps into consume: false, leaving the event pending and letting a later wake relay the same completion again. Report it as visibly sent specifically for the isWebChatExecCompletion case, since the reply already reached the session's own transcript via the ordinary turn-completion path. - Narrow isWebChatExecCompletion so it cannot match hidden internal-effects sessions. delivery.kind === "internal" also covers sessions created by internal-session-effects.ts and voice bare rows, which are never a real WebChat/Companion client. Exclude sessions explicitly created via that path (createdVia === "internal"). - Add a regression test proving a hidden internal-effects session (createdVia: "internal") still gets the original suppressed prompt, not the relay prompt. - Fix two exact-head CI failures: an unnecessary Boolean() wrapper flagged by no-unnecessary-type-conversion, and two test-file HeartbeatSessionSeed seed calls missing the now-required lastProvider/lastTo fields (upstream main added them as required since this branch's base).
d80e6ff to
1148b94
Compare
|
Thanks for picking this up @jalehman — the publication-receipt approach is right, and it matches where I'd independently landed after a few iterations (settling on a confirmed transcript write rather than inferring delivery). I'm still actively working this one and have a revision close. Specifically I'm on the So we don't duplicate effort or race each other's pushes: I'd like to take the next revision. Very happy to hand it over if you'd rather own it — just want to avoid us both writing the same patch. Either way, shout and I'll follow your lead. Should have something up shortly. |
|
@etzelm — thanks for flagging the overlap. Please take the next revision; I am holding my push so we do not race. I have a reviewed follow-up against It covers both the explicit
Validation: the suppression regression failed before repair (1 failed / 20 passed); the repaired runtime snapshot passed 190 focused tests. After correcting the new test's typed event reader and formatter output, the final patch passed every changed-file gate, including core and core-test types, lint, dead exports, boundaries and ratchets (sanitized direct AWS run Patch SHA256: Real Control UI proof remains outstanding: my previous attempt reached the UI but the exec failed before the expected approval, so it is not successful completion proof. I will not start a competing proof run while you own the next revision. Once your revision/proof is posted, I can reconcile the remaining checks and evidence against that exact head. No merge is being attempted. Additional current-head CI resultThe remaining Validated six-file follow-up patch against 1148b94diff --git a/config/assertion-safety-baseline.txt b/config/assertion-safety-baseline.txt
index d170d0f8d57..6aa9de15e2c 100644
--- a/config/assertion-safety-baseline.txt
+++ b/config/assertion-safety-baseline.txt
@@ -2526,7 +2526,7 @@ src/config/sessions/transcript-recent-window.ts 1
src/config/sessions/transcript-replay.ts 1
src/config/sessions/transcript-stream.ts 1
src/config/sessions/transcript-tree.ts 3
-src/config/sessions/transcript.ts 15
+src/config/sessions/transcript.ts 14
src/config/sessions/types.ts 1
src/config/state-dir-dotenv.ts 1
src/config/talk.ts 1
diff --git a/src/config/sessions/transcript.ts b/src/config/sessions/transcript.ts
index fa0f067ec27..e31eca4cbc9 100644
--- a/src/config/sessions/transcript.ts
+++ b/src/config/sessions/transcript.ts
@@ -49,6 +49,7 @@ import type {
SessionLifecycleRevisionExpectation,
SessionTranscriptTurnLifecyclePatch,
} from "./session-transcript-turn-lifecycle.types.js";
+import { recordAssistantManagedMediaUrls } from "./transcript-assistant-delivery.js";
import {
applyBeforeMessageWriteToAssistant,
type AssistantBeforeMessageWrite,
@@ -454,7 +455,7 @@ export async function appendAssistantMessageToSessionTranscript(params: {
config: params.config,
...(params.beforeMessageWrite ? { beforeMessageWrite: params.beforeMessageWrite } : {}),
message: {
- role: "assistant" as const,
+ ...recordAssistantManagedMediaUrls({ role: "assistant" as const }, params.mediaUrls),
content,
...(displayContent ? { [ASSISTANT_DISPLAY_CONTENT_FIELD]: displayContent } : {}),
api: OPENCLAW_TRANSCRIPT_ARTIFACT_API,
@@ -580,22 +581,20 @@ export async function appendExactAssistantMessageToSessionTranscript(params: {
reason: "blocked by before_message_write",
};
}
- const identifiedDeliveryMirror =
- Boolean(explicitIdempotencyKey) && isIdentifiedDeliveryMirror(params.message);
const target: SessionTranscriptAppendTarget = {
...(transcriptAgentId ? { agentId: transcriptAgentId } : {}),
sessionId: currentEntry.sessionId,
sessionKey: resolved.normalizedKey,
storePath,
};
- if (isRedundantDeliveryMirror(params.message) && !identifiedDeliveryMirror) {
+ if (isRedundantDeliveryMirror(params.message) && !explicitIdempotencyKey) {
// Reconciliation needs the writer queue. Wait before entering it, then
// read the current projected tail again inside the guarded append.
await waitForSessionTranscriptProjection(target);
}
let latestEquivalentAssistantId: string | undefined;
- // Identified delivery mirrors, including suppressed finals, dedupe only by
- // key so same-text markers from different source ids remain separate rows.
+ // Keyed mirrors use strict replay identity; text-only suppression must not
+ // hide conflicting media or collapse distinct source messages.
const turn = await persistSessionTranscriptTurn(
{
sessionId: currentEntry.sessionId,
@@ -642,7 +641,7 @@ export async function appendExactAssistantMessageToSessionTranscript(params: {
: {}),
shouldAppend: async (appendTarget) => {
latestEquivalentAssistantId =
- isRedundantDeliveryMirror(params.message) && !identifiedDeliveryMirror
+ isRedundantDeliveryMirror(params.message) && !explicitIdempotencyKey
? await findLatestEquivalentAssistantMessageId(
appendTarget,
preparedUnkeyedMessage as SessionTranscriptAssistantMessage,
@@ -761,18 +760,6 @@ async function readLatestVisibleTranscriptMessage(scope: {
}
}
-function isIdentifiedDeliveryMirror(message: SessionTranscriptAssistantMessage): boolean {
- const marker = (message as { openclawDeliveryMirror?: InternalSessionTranscriptDeliveryMirror })
- .openclawDeliveryMirror;
- return (
- isRedundantDeliveryMirror(message) &&
- (marker?.kind === "channel-final" ||
- marker?.kind === "channel-final-suppressed" ||
- marker?.kind === "message-tool-source-reply" ||
- marker?.kind === CRON_DIRECT_DELIVERY_CONTEXT_KIND)
- );
-}
-
function extractAssistantMessageText(message: AgentMessage): string | null {
if (message.role !== "assistant" || !Array.isArray(message.content)) {
return null;
diff --git a/src/gateway/internal-source-reply-persistence.ts b/src/gateway/internal-source-reply-persistence.ts
index 0188666f2bc..f597f78390b 100644
--- a/src/gateway/internal-source-reply-persistence.ts
+++ b/src/gateway/internal-source-reply-persistence.ts
@@ -14,7 +14,6 @@ import {
readTranscriptEventMessage,
} from "../config/sessions/session-accessor.sqlite-read.js";
import { sessionMatchesExpectedTranscriptTurn } from "../config/sessions/session-transcript-turn-state.js";
-import { recordAssistantManagedMediaUrls } from "../config/sessions/transcript-assistant-delivery.js";
import { getOwnedSessionTranscriptWriterFence } from "../config/sessions/transcript-write-context.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
import { getAgentScopedMediaLocalRootsForSources } from "../media/local-roots.js";
@@ -188,11 +187,7 @@ export async function persistInternalSourceReply(params: {
...(writerFence ? { expectedWriterRunId: writerFence.expectedWriterRunId } : {}),
content: retainAssistantModelContent(content),
displayContent: content,
- beforeMessageWrite: ({ message }) =>
- recordAssistantManagedMediaUrls(
- message,
- media.map((item) => item.url),
- ),
+ mediaUrls: media.map((item) => item.url),
idempotencyKey: params.idempotencyKey,
runId: params.runId,
...(params.sourceReplyFinal !== undefined
diff --git a/src/infra/heartbeat-runner-execution.ts b/src/infra/heartbeat-runner-execution.ts
index 6d1ecc4150d..c158d6ce334 100644
--- a/src/infra/heartbeat-runner-execution.ts
+++ b/src/infra/heartbeat-runner-execution.ts
@@ -338,6 +338,7 @@ export async function prepareHeartbeatRunStage(wake: ReadyHeartbeatWake) {
// Capture the client-owned generation before routing can await. The inspected
// completion queue owns publication eligibility, not the coalesced wake source.
const internalProjection =
+ heartbeat?.target !== "none" &&
scheduledTasks.length === 0 &&
preflight.shouldInspectPendingEvents &&
preflight.pendingEventEntries.some((event) => isExecCompletionEvent(event.text)) &&
diff --git a/src/infra/heartbeat-runner.webchat-exec-completion.test.ts b/src/infra/heartbeat-runner.webchat-exec-completion.test.ts
index 68b1fb33a71..3975e472fdd 100644
--- a/src/infra/heartbeat-runner.webchat-exec-completion.test.ts
+++ b/src/infra/heartbeat-runner.webchat-exec-completion.test.ts
@@ -309,6 +309,42 @@ async function readProjectionMessages(scenario: ProjectionScenario) {
return events.map(readTranscriptEventMessage).filter((message) => message?.role === "assistant");
}
+it("preserves explicit target:none before target:last delivers in the same WebChat session", async () => {
+ await withProjectionScenario(async (scenario) => {
+ const heartbeat = scenario.cfg.agents?.defaults?.heartbeat;
+ if (!heartbeat) {
+ throw new Error("projection scenario heartbeat is missing");
+ }
+ for (const target of ["none", "last"] as const) {
+ heartbeat.target = target;
+ const marker = `EXPLICIT_TARGET_${target}`;
+ enqueueSystemEvent(`Exec completed (target-proof, code 0) :: ${marker}`, {
+ sessionKey: scenario.sessionKey,
+ });
+ const reply = vi.fn<NonNullable<HeartbeatDeps["getReplyFromConfig"]>>().mockResolvedValue(
+ createHeartbeatToolResponsePayload({
+ outcome: "done",
+ notify: true,
+ summary: "private",
+ notificationText: marker,
+ }),
+ );
+ await runProjectionWake(scenario, reply);
+ expect(reply).toHaveBeenCalledOnce();
+ const context = reply.mock.calls[0]?.[0];
+ const messages = await readProjectionMessages(scenario);
+ if (target === "none") {
+ expect(messages).toEqual([]);
+ expect(context?.Body).toContain("user delivery is disabled");
+ } else {
+ expect(messages).toHaveLength(1);
+ expect(JSON.stringify(messages[0]?.content)).toContain(marker);
+ expect(context?.Body).toContain("Please relay the command output to the user");
+ }
+ }
+ });
+});
+
it.each([
{
name: "queued exec completion inspected by a manual wake",
diff --git a/src/config/sessions/transcript.media-identity.test.ts b/src/config/sessions/transcript.media-identity.test.ts
new file mode 100644
index 00000000000..a8384cb7123
--- /dev/null
+++ b/src/config/sessions/transcript.media-identity.test.ts
@@ -0,0 +1,55 @@
+import { describe, expect, it } from "vitest";
+import { loadTranscriptEvents, replaceSessionEntry } from "./session-accessor.js";
+import { readTranscriptEventMessage } from "./session-accessor.sqlite-read.js";
+import { useTempSessionsFixture } from "./test-helpers.js";
+import { appendAssistantMessageToSessionTranscript } from "./transcript.js";
+
+describe("assistant mirror media identity", () => {
+ const fixture = useTempSessionsFixture("transcript-media-identity-");
+
+ it.each([false, true])("records media identity with content=%s", async (explicitContent) => {
+ const scope = {
+ agentId: "main",
+ sessionId: "media-session",
+ sessionKey: "agent:main:media",
+ storePath: fixture.storePath(),
+ };
+ await replaceSessionEntry(scope, { sessionId: scope.sessionId, updatedAt: 1 });
+ const params = {
+ ...scope,
+ expectedSessionId: scope.sessionId,
+ idempotencyKey: "media-reply",
+ text: "Chart",
+ ...(explicitContent ? { content: [{ type: "text" as const, text: "Chart" }] } : {}),
+ mediaUrls: ["https://example.com/chart.png"],
+ };
+ const first = await appendAssistantMessageToSessionTranscript(params);
+ expect(first.ok).toBe(true);
+ expect(await appendAssistantMessageToSessionTranscript(params)).toEqual(first);
+ await expect(
+ appendAssistantMessageToSessionTranscript({
+ ...params,
+ mediaUrls: ["https://different.example/chart.png"],
+ }),
+ ).rejects.toThrow("conflicts with the admitted message");
+ await expect(
+ appendAssistantMessageToSessionTranscript({
+ ...params,
+ text: "Different",
+ ...(explicitContent ? { content: [{ type: "text" as const, text: "Different" }] } : {}),
+ }),
+ ).rejects.toThrow("conflicts with the admitted message");
+ const events = await loadTranscriptEvents(scope);
+ expect(
+ events.filter((event) => readTranscriptEventMessage(event)?.role === "assistant"),
+ ).toEqual([
+ expect.objectContaining({
+ message: expect.objectContaining({
+ role: "assistant",
+ openclawDelivery: { mediaUrls: params.mediaUrls },
+ content: [{ type: "text", text: explicitContent ? "Chart" : "Chart\nchart.png" }],
+ }),
+ }),
+ ]);
+ });
+}); |
|
@etzelm — updating our coordination: I am taking the next repair revision back now to publish the validated suppression/media-replay fixes and address the remaining CI feedback. Please hold branch pushes while I publish; I will check the remote head and use an explicit expected-head lease so your work cannot be overwritten. Please share any additional local changes or proof you have prepared so I can reconcile them. I will post the resulting SHA and remaining evidence here. No merge is being attempted. |
- Replaces the config-level `heartbeat?.target !== "none"` guard added in 4572570 with a resolver-level gate: `projectionCandidate` is still captured before the routing await, and `internalProjection` is derived after it from `delivery.reason === "target-none"`. - The config check missed the explicit-but-unresolvable target. In src/infra/outbound/targets.ts:231 an explicit `target` string starts at "none"; a value that is not none/last/owner and not a deliverable channel falls through :236-241 with no `to`, so :257-260 returns `reason: "target-none"` while `heartbeat.target` is still that string. Such a run projected the completion into the WebChat session. - Gating on the resolver verdict suppresses both cases at once, covering the relay prompt, `deliverHeartbeatDispatch` publication, and settlement bookkeeping, which all read `internalProjection`. - Adds three arms asserting `getLastHeartbeatEvent()` and the `onSessionTranscriptUpdate` emission the gateway fans out as `session.message`, layers the existing prompt/row test does not reach. The unresolvable-target arm fails on 4572570 and passes here. - Keeps jalehman's prompt/row test and media-identity work unchanged.
CI triage for run 35171694990 (head
|
| Check | Failing test or rule | Verdict | Evidence |
|---|---|---|---|
check-lint-core-5 |
typescript(unbound-method) at dispatch.ts:623:49 |
caused by main, already fixed |
Introduced by a90b969ae26 (#150407), fixed by a13ecd23b32. Job 105044773505 |
check-additional-runtime-topology-architecture |
madge: 1 cycle, ingress.ts -> thread-resolution.ts |
caused by main, already fixed |
Introduced by edc1fa85c6c (#150457), fixed by a13ecd23b32. Job 105044773603 |
checks-node-compact-small-15 |
test/scripts/worktree-setup.test.ts, 16 tests, Cannot find module .../scripts/lib/bundled-plugin-source-utils.mts |
caused by main |
Import added by aceff326809 (#148907); the synthetic fixture repo does not copy the new file. In this merge head, absent from the prior run's base. Job 105044777240 |
checks-node-compact-small-40 |
test/scripts/pr-wrappers.test.ts:886, ERR_MODULE_NOT_FOUND for src/plugins/discovery-availability.js |
caused by main, already fixed |
scripts/pr-lib/wrapper-components.txt was missing the entry; c5cff2f122e (#150453) adds it. Job 105044779123 |
checks-node-compact-small-24 |
test/scripts/pr-operation-lock.test.ts, 2 tests |
pre-existing | Identical test names failed in run 35168002167 job 105033512339, before cb4e63b5 existed. Job 105044777195 |
checks-node-compact-small-26 |
test/scripts/pr-main-refresh.test.ts, 7 tests |
pre-existing | Identical test names in prior run job 105033512454. Job 105044777196 |
checks-node-compact-small-42 |
test/scripts/pr-worktree-provision.test.ts, 17 tests |
pre-existing | Identical test names in prior run job 105033514283 (shard small-39, different number, same tests). Job 105044779180 |
checks-node-changed-extensions-bundle-11 |
extensions/qwen/video-generation-provider.test.ts:74, expected 119999 to be 120000 |
repo-wide flake | Same assertion and same numbers on unrelated branch fix/session-projection-convergence, run 35173901358 job 105051431092. Job 105044774837 |
checks-node-compact-large-20 |
src/infra/session-delivery-queue-runtime.test.ts:709, expected "vi.fn()" to be called 1 times, but got 0 times |
flake, not this PR | Fake-timer retry race. The module under test imports nothing in this diff; this PR's only src/infra/ files are heartbeat-*. Job 105044775064 |
control-ui-performance |
startup JS gzip: 354.2 KiB exceeds 354.1 KiB |
repo-wide baseline drift | Measured 362706 B against limit 362588 B. Fails on five unrelated branches in the same window. Job 105044773470 |
openclaw/ci-gate |
rollup only | derived, no independent signal | Body is failures=0 ... exit "$failures" over other jobs' results. Clears automatically once its inputs clear. Job 105049942664 |
Longer evidence strings
checks-node-compact-small-15, at test/scripts/worktree-setup.test.ts:324:44:
AssertionError: Cannot find module '<tmp>/repo/scripts/lib/bundled-plugin-source-utils.mts'
imported from '<tmp>/repo/scripts/lib/static-extension-assets.mts'
The edge comes from aceff326809:
+import { collectTrackedBundledPluginSourceCandidates } from "./bundled-plugin-source-utils.mts";
checks-node-compact-small-40, at test/scripts/pr-wrappers.test.ts:886:37:
AssertionError: expected 'node:internal/modules/esm/resolve:271...' to contain 'Usage: worktree-provision.mts'
+ Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../src/plugins/discovery-availability.js'
imported from .../src/plugins/discovery.ts
The entire diff of c5cff2f122e (#150453) is three added lines to scripts/pr-lib/wrapper-components.txt, one of which is +src/plugins/discovery-availability.ts.
control-ui-performance enforcement math: baseline 362012 B in config/control-ui-startup-budget-baseline.json, plus 512 B growth allowance, plus 64 B build variance, gives 362588 B. Measured 362706 B. The five unrelated branches failing it in the same window are runs 35174188849 (codex/sqlite-mcp-prefix-filter-0916), 35173963121 (fix/show-categorized-spawned-sessions), 35173901358 (fix/session-projection-convergence), 35173683868 (fix/chat-history-sanitize-input-image) and 35174266725 (refactor/ui-config-factory-contracts).
openclaw/ci-gate emits ::error title=CI job did not succeed for control-ui-performance, checks-node-core-test-nondist-shard, check-lint-hosted-core-shard and check-additional-shard.
What clears on a rebase, and what does not
main at a434e7f53f5 carries a13ecd23b32 (Slack cycle and unbound method), c5cff2f122e (pr-wrappers manifest) and the tooling fixture fixes. Main push run 35174052050 at that SHA is green on all 49 compact shards, both check-lint-core-* jobs, and check-additional-runtime-topology-architecture.
Everything except control-ui-performance should clear on a rebase onto main at or after a434e7f53f5.
control-ui-performance will not clear. The committed baseline in config/control-ui-startup-budget-baseline.json has drifted repo-wide and needs a maintainer-approved bump. Two things make it easy to miss: main push runs skip that job entirely (it is skipped on run 35174052050), which is why main never surfaces it, and it fails on five unrelated branches in the same window. It blocks every PR in this window, not just this one.
Two genuine flakes worth their own issues
Both unrelated to this PR:
extensions/qwen/video-generation-provider.test.ts:74assertsexpect(request.timeoutMs).toBe(120_000)against a deadline-derived timeout and loses to 1 ms of clock drift, givingexpected 119999 to be 120000.src/infra/session-delivery-queue-runtime.test.ts:709races a fake-timer retry:await vi.advanceTimersByTimeAsync(0); await stop();then asserts the delivery happened.
Correction to my earlier comment
My previous comment said pr-wrappers.test.ts "gets a named cause and no independent reproduction", attributing it to 387f69830a8 (#149585) touching the file by path. That is now resolved, and the attribution was wrong. The real cause is base-state dependent: a missing entry in scripts/pr-lib/wrapper-components.txt, fixed on main by c5cff2f122e (#150453). The lack of reproduction on the comparison branches followed from their different merge bases, not from the cause being unconfirmed.
cc @jalehman, since cb4e63b5 is yours. Nothing here implicates it. The main-side breakage was caught and fixed inside 36 minutes, which is why the surviving signal is this narrow.
Live re-run on the current head
|
| arm | image | heartbeat.target |
model on the relay turn | expected | rendered client | chat.history, 2nd connection |
|---|---|---|---|---|---|---|
| s1 | merge base 4e44dbf |
last | scripted | absent | absent | 0 |
| s2 | head cb4e63b5 |
last | scripted | present once | present, 1 row | 1 |
| s3 | head cb4e63b5 |
none | scripted | absent | absent | 0 |
| s4 | head cb4e63b5 |
last | scripted, relay carries MEDIA: |
present once with image | present, 1 row, image rendered | 1 |
| h1 | merge base 4e44dbf |
last | Claude Sonnet 5 (claude-cli) | absent | absent (model answered NO_REPLY) |
0 |
| h2a | head cb4e63b5 |
last | Claude Sonnet 5 (claude-cli) | marker present once | present, 1 row | marker present |
| h2b | head cb4e63b5 |
last | Claude Sonnet 5 (claude-cli), repeat | marker present once | present, 1 row | marker present |
| h3 | head cb4e63b5 |
none | Claude Sonnet 5 (claude-cli) | absent | absent (model answered NO_REPLY) |
0 |
Scripted arms, prompt actually handed to the model: relay prompt count 0 / 1 / 0 / 1, suppression prompt count 1 / 0 / 1 / 0 for s1 / s2 / s3 / s4. delivery.kind was internal and createdVia was operator at wake time in every arm, with no hand seeding.
Real-model nondeterminism, reported as observed: both head runs relayed, with different wording. h2a: "This was a background test/marker job I kicked off earlier: it ran sleep 40; echo EXEC_MARKER_H2A and just finished successfully (exit code 0), printing EXEC_MARKER_H2A as expected ..." h2b: "... It finished successfully (exit code 0), output: EXEC_MARKER_H2B ..." In h2a the model also called the sessions_history MCP tool before replying. Neither ack row contained the marker. h1 and h3 ran once each; h2 ran twice.
Baseline 4e44dbf, scripted (s1): no completion row.
Head cb4e63b5, scripted (s2): completion row present once.
Head cb4e63b5, real model on the relay turn (h2a): Sonnet's own wording, marker present once.
Baseline 4e44dbf, real model on the relay turn (h1): suppression prompt, no relay.
s3 (head, target none, scripted), s4 (head, media relay), h2b (head, real model repeat), h3 (head, target none, real model), r2a (pure claude-cli, harness limit)
Runtime-owned receipt variants, live
publishHeartbeatSessionReply outcomes and which live client run reached each:
| variant | live run | evidence |
|---|---|---|
owned text-only receipt, replayed (receipt.appended false) |
s2, h2a, h2b | exactly one assistant row carries the completion (transcript rows and chat.history both 1); no automation-result row was written; the receipt row is the runtime's own (provider=scripted or provider=claude-cli, idempotencyKey=cli-assistant:<run id>) |
owned receipt with media (matchesMedia, managed media attach) |
s4 | relay carried MEDIA:/state/ws/<marker>.png; one row, image rendered in the client, history 1 |
suppressed (target: none) |
s3, h3 | no publication, suppression prompt, 0 rows |
non-owned automation-result publication; source-reply mirror receipt; the rejection branches |
not reached live | unit coverage only; every live completion was runtime-owned |
Legacy media replay (cb4e63b5), one store across three gateways
- v2026.9.4 (
3a9d69d): a real browser creates the session; the legacy runtime's own constructor (appendAssistantMessageToSessionTranscript, run through the repo'stsxin the container) writes a keyed delivery-mirror row withmediaUrlsandidempotencyKey: legacy-media-reply. Stored bytes:provider=openclaw model=delivery-mirror api=openclaw-transcript, noopenclawDeliveryat all, textLegacy chart\nlegacy-chart.png. The browser renders it;chat.historyover a second connection shows it. - parent
4269449on the migrated store (openclaw doctor --fix, exit 0, the real upgrade step): the browser renders the legacy row, then replaying the identical keyed candidate fails withTranscript idempotency key "legacy-media-reply" conflicts with the admitted message.A changed-media candidate also conflicts. - head
cb4e63b5on the same restored store: the browser renders the legacy row, the identical candidate replays (ok: true, same message id99197e32-..., still exactly one row), and the changed-media candidate still conflicts.chat.historyafterwards: one row.
| store written by | replayed on | identical candidate with mediaUrls |
changed media |
|---|---|---|---|
| v2026.9.4 | parent 4269449 |
conflict | conflict |
| v2026.9.4 | head cb4e63b5 |
match, no new row | conflict |
The replay candidate is produced by the runtime module against the live store rather than by a client action, because no client RPC rebuilds a keyed media mirror for an internal session (chat.inject carries neither idempotencyKey nor mediaUrls, and message-tool source replies short-circuit through completePersistedInternalSourceReply). Browser rendering and the second-connection history read were live at every phase.
Two-destination screenshot gate (AGENTS.md, "Product and validation")
The inspected before/after pair (arm1-03-final.png, arm2-03-final.png) was attached in the originating implementation chat on 2026-09-17 at 02:35 UTC and verified to render there, and is embedded in the PR body, where every image URL was re-checked to return 200 image/png. The PR body's evidence section now states this explicitly.
Not verified
- A real model on the first, exec-starting turn (see r2a above; a property of the claude-cli backend, not of this PR).
- Non-owned
automation-resultpublication, source-reply mirror receipts, and the rejection branches were not reached by any live client run. - The legacy replay trigger is a runtime-module call on the live store, not a client action.
- Session key is
agent:main:main; onlymessages.visibleReplies: automatic; the unresolvable-target arm remains unreachable from a schema-valid config.
One observation for maintainers, not caused by this PR: on the claude-cli path the heartbeat prompt itself is rendered as a user row in the Control UI (visible in the h-arm screenshots on both the merge base and the head), because the CLI backend records the prompt as a user message. The scripted arms do not show it.
Sanitization: gateway token is the literal fake-local-token-not-a-secret in a URL fragment only; the claude-cli credential file was bind-mounted read-only at runtime and never copied into an image or printed; no real keys, IPs, phone numbers, private hostnames, or names appear in any image or excerpt.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@vincentkoc if you have a chance, would you mind taking another look at this one? Where it stands:
No rush at all, and happy to rebase or drop anything that is in the way. I also posted in the clawtributor channel on Discord. Thanks! |
Inspected exact-head Gateway / Control UI evidenceSource: Real Gateway, built Control UI, browser approval (
These six existing screenshots were individually visually inspected after authorized media staging. No visible credentials or private user data were found; no redaction was necessary. The first image is the pre-action state on the fixed head, not an unfixed-code baseline. The remaining images show connected completion/reload, and the disconnected case running/reopened/reloaded. These are our own worker artifacts, distinct from the contributor's previously published screenshots. Scope: these images and this run substantiate the connected/disconnected cases above. They do not independently establish every sibling/reset/second-wake case, historical CI failure causality, or overall CI success. Current CI failures and the maintainer's blocking review remain unresolved. This is evidence publication, not merge approval. |
CI recovery integrated — new candidate, validation pendingPublished This incorporates the landed Qwen, cold-fixture, wrapper-closure, UI performance, Slack, and exact queue-test-site repairs. The only manual integration resolves the two independently extracted assistant-answer selectors into one shared implementation used by payload construction, canonical-silence classification, and heartbeat receipt validation. Main's silence/unfinished-work guards are preserved. Fresh isolated static review of the resulting candidate reported no actionable P0–P2 findings. This is not runtime validation. The new-head CI has started. The previous cb4 test/browser evidence remains evidence for cb4 only; fresh c6bb validation is pending. The credential-free public-PR identity prerequisite for the sanitized AWS run currently returns HTTP403 with rate remaining0 and reset September17,2026 at19:38:29UTC. No validation worker was allocated after that failed prerequisite. The prepared run will only proceed after fresh identity admission succeeds; credentials will not be forwarded as a workaround. The prior queue baseline/trace did not prove historical CI failure causality; the integrated150631 repair is an exact-site upstream test correction, not a retrospective proof. GitHub publication of our inspected screenshots also remains incomplete after an upload timeout. No merge readiness or maintainer approval is claimed. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
The new Separate upstream repair: #151083 at This PR remains at |
|
Published The reused main commits are #151080 ( Integration was conflict-free, with no path overlap between this feature and incoming main changes. The 18-file feature delta remains +2364/-66. Fresh static integration autoreview: scoped-clean, no actionable P0–P2 findings. This does not establish runtime or UI success on the new commit. Current-head CI/re-review, the human changes-requested disposition, and final-head sanitized direct-AWS Gateway/UI proof remain outstanding. The credential-free public identity preflight is paused until September 17 at 20:41:56 UTC (13:41:56 PDT) following HTTP403/rate-limit exhaustion. No worker was allocated. No PR merge is authorized or performed. |
|
@clawsweeper re-review Current head 7e22264 integrates landed main CI/regression repairs. The PR body now preserves historical proof attribution and explicitly records new-head runtime/UI proof as pending. Human changes-requested review remains separate. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Exact-head Gateway / Control UI proof — PASSTested head: This uses the actual Gateway, served Control UI, browser approval, background shell processes, transcript persistence, and WebSocket/history paths. The model/provider is a deterministic local fixture, not a live-model proof. The fixture does not synthesize completion events or replace the UI/history assertions. Results
Isolation and cleanupCredential-free live-head checks accepted this exact SHA before allocation and again inside the worker before installation. The worker verified IMDSv2 and IAM role endpoint HTTP 404. No hydration, Tailscale, production credentials, or local candidate execution. Toolchain: Node 24.19.0 / pnpm 12.4.0. Browser, subprocess, and fixture-server cleanup passed. Owned AWS lease Screenshots and provenanceThe attached images are exact-head captures, individually visually inspected with no secrets/private user data found and no redaction required. They were also delivered in the originating chat. In order: connected before launch; connected after reload; disconnected while running; disconnected after reopening. The first image is a before-action view, not a reproduction on an older source revision.
Exact-head CI was green (178 successful, 1 neutral, 42 skipped; aggregate gate successful). This proof supplies the current-head runtime evidence requested by revision 11 of the automated review. The separate human changes-requested review remains unresolved; nothing here dismisses it or authorizes a merge. |
|
@clawsweeper re-review New evidence for unchanged head 7e22264: #148360 (comment) now contains the completed exact-head sanitized AWS Gateway/UI run and four inspected screenshots, also delivered in the originating chat. Public image bytes were verified against the inspected originals. The PR body preserves historical proof and now identifies current-head execution. Please reassess the previously missing new-head runtime evidence. @vincentkoc — the revised implementation now has green exact-head CI and the linked fresh runtime/connected/reconnect proof. Please disposition your outstanding changes-requested review against this head and evidence when available. I have not dismissed it or attempted a merge. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
openclaw#148360) * fix(infra): relay exec-completion replies on WebChat-internal sessions Closes openclaw#147387 * refactor(heartbeat-dispatch): extract indicator type logic into helper - Extract the indicatorType condition from prepareHeartbeatDispatchReply into a named helper function shouldSetIndicator for improved readability - The helper clearly documents when each indicator type is returned: 'alert' when alerts are disabled, 'sent' when delivery succeeds, undefined in all other cases * fix: address maintainer review on openclaw#148360 - Consume the triggering system event for a WebChat exec-completion reply too. deliverHeartbeatDispatch previously reported visibleReplySent: false unconditionally for channel === "none", which the settle callback maps into consume: false, leaving the event pending and letting a later wake relay the same completion again. Report it as visibly sent specifically for the isWebChatExecCompletion case, since the reply already reached the session's own transcript via the ordinary turn-completion path. - Narrow isWebChatExecCompletion so it cannot match hidden internal-effects sessions. delivery.kind === "internal" also covers sessions created by internal-session-effects.ts and voice bare rows, which are never a real WebChat/Companion client. Exclude sessions explicitly created via that path (createdVia === "internal"). - Add a regression test proving a hidden internal-effects session (createdVia: "internal") still gets the original suppressed prompt, not the relay prompt. - Fix two exact-head CI failures: an unnecessary Boolean() wrapper flagged by no-unnecessary-type-conversion, and two test-file HeartbeatSessionSeed seed calls missing the now-required lastProvider/lastTo fields (upstream main added them as required since this branch's base). * fix: confirm WebChat exec completion publication before settlement * fix: preserve silent exec delivery and strict media replay * fix(heartbeat): gate exec-completion projection at the delivery resolver - Replaces the config-level `heartbeat?.target !== "none"` guard added in 4572570 with a resolver-level gate: `projectionCandidate` is still captured before the routing await, and `internalProjection` is derived after it from `delivery.reason === "target-none"`. - The config check missed the explicit-but-unresolvable target. In src/infra/outbound/targets.ts:231 an explicit `target` string starts at "none"; a value that is not none/last/owner and not a deliverable channel falls through :236-241 with no `to`, so :257-260 returns `reason: "target-none"` while `heartbeat.target` is still that string. Such a run projected the completion into the WebChat session. - Gating on the resolver verdict suppresses both cases at once, covering the relay prompt, `deliverHeartbeatDispatch` publication, and settlement bookkeeping, which all read `internalProjection`. - Adds three arms asserting `getLastHeartbeatEvent()` and the `onSessionTranscriptUpdate` emission the gateway fans out as `session.message`, layers the existing prompt/row test does not reach. The unresolvable-target arm fails on 4572570 and passes here. - Keeps jalehman's prompt/row test and media-identity work unchanged. * fix: preserve legacy delivery mirror replay identity --------- Co-authored-by: etzelm <[email protected]> Co-authored-by: jalehman <[email protected]>
Block: inline raw-answer resolver in run/payloads.ts (drift residue). Home: restored to upstream (drift residue). Upstream moved resolveRawAssistantAnswerText into its owner src/shared/assistant-answer-text.ts (0863f26 openclaw#150539, then 06e6c06 openclaw#148360). Our payloads.ts kept a private copy (isAssistantTextContentBlockType, readAssistantTextContentBlock, sanitizeCanonicalAssistantItemText, resolveRawAssistantAnswerParts). It also kept assistantTextsHaveMedia / normalizedRawAnswerText and a redundant !assistantTextsHaveMedia guard that 162c33e (openclaw#133264) removed. Restore upstream's import and media-comparison bytes. The continuation need (one raw part per final-answer block, optionally keeping item whitespace) moves to the owner as resolveRawAssistantAnswerParts; resolveRawAssistantAnswerText now joins its parts and keeps upstream's output for every input. payloads.ts keeps only rawAnswerHasContinuation, the earlier-continuation per-hop split and preserveTextWhitespace. Refs #1418 Co-Authored-By: Claude Opus 5.5 <[email protected]>















Closes #147387
Current published and demonstrated head:
7e22264fa0ee40084afa45f59825a7e4510fd0d5. This ancestry-preserving merge integrates main4520c88d8c9e0146f05a9ab5ae0431f57f884e65, including #151080 and #151086. The original 18-file feature delta and contributor history are preserved.Fresh exact-head proof: Gateway / Control UI results and four inspected screenshots. Sanitized direct-AWS execution passed 569 tests across 22 files, changed-file checks, builds, connected exactly-once delivery, and disconnected/reopen/reload history. The worker and fixture processes were cleaned up, and lease absence was independently verified. This is an actual Gateway/browser/background-exec run using a deterministic local provider fixture, not a live-model proof. Screenshots were also published in the originating chat. Exact-head CI is green; static/current-head code review found no actionable patch defects. The human changes-requested disposition remains unresolved, and no merge is being attempted.
Historical evidence below: Contributor live-model observations were collected on
426944919981395990cfdf45c52cd9a76cb66dc3; earlier deterministic Gateway/UI observations were collected oncb4e63b5e052f61bbaf53bc36aaadca715f2de87. Those observations retain their original scope. The new linked run, rather than source equivalence alone, supplies execution evidence for the current integrated head.Most of what is in the tree is @jalehman's work. The per-commit breakdown is under Attribution.
Related historical reports: #31348 and #31375. Neither substitutes for the current repair or its proof.
What Problem This Solves
A background
execcommand started from an internal WebChat session (Control UI or the Windows Companion) runs to completion and no completion reply ever appears in that session. The command really ran and the follow-up turn really executed, so the work is done, but the person who started it sees nothing and has to ask again by hand. The same flow on Telegram or any other external channel delivers the completion normally, so the behaviour differs silently by client surface.User Impact
execstarted from a WebChat session now receives its completion reply in that same session, the way it already worked on external channels.heartbeat.target: "none"publishes nothing, and neither does an explicit target that never resolves to a deliverable route. Both are the delivery resolver'sreason: "target-none"verdict.delivery.kind === "internal",createdVia !== "internal", and either an operator-created row, a row withlastReadAtset, or aspawnrow under adashboard:key.provider: "openclaw"withmodel: "automation-result", which is deliberately not inTRANSCRIPT_ONLY_OPENCLAW_ASSISTANT_MODELS(src/shared/transcript-only-openclaw-assistant.ts), so replay, web push, run waits and the composer treat it as the reply instead of skipping it as a mirror.Why This Change Was Made
Root cause. Relay eligibility recognised only an external route. At base
f9584dc,src/infra/heartbeat-runner-execution.ts:394-396reads:A WebChat-internal session never has an external channel or recipient by design, so the first two conjuncts fail regardless of
visibility.showAlerts. Every exec-completion wake on such a session therefore took the suppressed branch: the model was told "An async command completion event was triggered, but user delivery is disabled for this run. Handle the result internally. ... Do not mention, summarize, or reuse command output." (src/infra/heartbeat-events-filter.ts:130-141), and the dispatcher's no-channel gate discarded whatever came back anyway. Nothing was wrong with the exec run itself. The reply was suppressed twice before it could reach the session.An earlier revision of this branch answered that by mirroring the reply into the transcript. That approach is gone. It wrote the primary publication as an unmarked delivery mirror, a shape the rest of the codebase classifies as bookkeeping rather than as the reply. What is in the tree now is a guarded publication that settles the completion event on a real receipt.
What the current implementation does
Publication path. New
src/infra/heartbeat-session-publication.ts(+284).publishHeartbeatSessionReplywrites the completion into the originating session's own transcript under that session's current generation, fenced onexpectedSessionId,expectedLifecycleRevisionand the active writer run id, and re-checks ownership before the write, inside the append transaction, and again at commit. When the run already committed its own final (assistantMessageIndex,assistantTranscriptOwned, or a source-reply transcript mirror), the publication reconciles against that committed row instead of appending a second one, and refuses if the runtime final's text or media do not match the committed receipt.Settlement on the receipt. In
src/infra/heartbeat-dispatch.ts, the channel-less branch (:582) no longer returnsvisibleReplySent: falseunconditionally. It captures the pending completion occurrence ids, calls the publication, and returnsvisibleReplySent: committed.ok, soconsumeSelectedSystemEventEntriesruns only after the canonical transcript owner accepted the write or the replay. A refused publication records its reason and leaves the event pending rather than consuming it silently.Committed custody before the write can yield.
onMessageCommittednow fires synchronously insideappendExpectedSessionTranscriptTurn(src/config/sessions/session-accessor.sqlite-transcript-turn.ts), directly after the guarded SQLite commit and before cancellation, owner drain or transcript publication can run at an async boundary. Pinned by a new case insession-accessor.transcript-owner.test.ts, "completes committed custody before a queued cancellation can interrupt the receipt".One canonical definition of the final-answer bytes.
resolveRawAssistantAnswerTextmoved out ofsrc/agents/embedded-agent-runner/run/payloads.tsinto newsrc/shared/assistant-answer-text.ts, so the receipt comparison and the runner's own payload resolution read the same bytes rather than two copies of the same logic. Net-67/+1inpayloads.ts, and its entry drops out ofconfig/assertion-safety-baseline.txt.Strict media replay for keyed mirrors, with pre-upgrade compatibility.
src/config/sessions/transcript.tsdropsisIdentifiedDeliveryMirror, so a keyed mirror is held to strict replay identity instead of being exempted from it. Media identity enters the canonical assistant message throughrecordAssistantManagedMediaUrls, andpersistInternalSourceReplyrecords its media urls. The legacy replay follow-up restores identical replay for rows written before the upgrade:messagesMatchForIdempotentReplayprojects awayopenclawDelivery.mediaUrlswhen the stored row is a v2026.9.4-shaped mirror that never carried the field, and stays strict otherwise. Covered bysrc/config/sessions/transcript.media-identity.test.ts. Thetranscript.tsassertion-ratchet entry goes from 15 to 14.Resolver-level
target-nonegate.src/infra/heartbeat-runner-execution.tscaptures the projection candidate before the routing await, so the client-owned generation is still read before anything can await, then decides after the resolver returns:The preceding revision gated on the config string
heartbeat?.target !== "none". That catches the literal"none"but not an explicit target that never resolves to a route. Insrc/infra/outbound/targets.tsan explicit target starts at"none"(:231); a value that is notnone/last/ownerand not a deliverable channel falls through:236-241, and with notoset it never reassignstarget, so:257-260returnsreason: "target-none"whileheartbeat.targetstill holds the original string.HeartbeatSchema.targetisz.string().optional(), so such a config typechecks. Gating on the resolver verdict rather than the string keeps both the relay prompt and the publication path from seeing a target the resolver already declined to deliver to. See Blast radius for how reachable that state actually is.Attribution
Branch history in
git logorder, basef9584dc:f7904dfaa1056eshouldSetIndicatorextraction inheartbeat-dispatch.tsf88a795Clawplaceholder author1148b944572570target:noneguard4269449target-nonegate, rebased onto4572570cb4e63b5c6bb45957e22264f@jalehman wrote the bulk of the current implementation:
src/infra/heartbeat-session-publication.tsand its 641-line unit test,src/shared/assistant-answer-text.ts,src/gateway/session-message-events.exec-completion.test.ts(+202), thesession-accessorcustody changes, and thetranscript.tsmedia-identity work including the pre-upgrade replay fix on the head commit.Whole branch against
f9584dc: 17 files changed, 2422 insertions, 119 deletions.Evidence
Live before and after in a real Control UI WebChat client
This is the artifact the review has asked for on every revision. A real gateway, a real browser client, a real background
exec, and the real heartbeat path. Only the model call is scripted, by a deterministic OpenAI-compatible server; this is not a fully live model run, and the distinction matters, so it is stated up front. The scripted model is compliant in both directions: told "user delivery is disabled ... reply NO_REPLY only" it repliesNO_REPLY, and told "Please relay the command output to the user" it relays. So the rendered differential reflects the code path, not a model ignoring instructions.The prompt is
RUN_JOB:<MARKER>. The model answers by callingexecwithbash -lc 'sleep 40; echo <MARKER>'in background and replyingSTARTED. The completion, if relayed, renders asBACKGROUND JOB DONE :: <MARKER>.Arm 1, merge base
4e44dbf,heartbeat.target: last. Completion absent.Arm 2, head
4269449, identical harness. Completion present exactly once.Arm 3, head
4269449,heartbeat.target: none. Suppression still honored, no user-visible row.4e44dbf,last)4269449,last)4269449,none)delivery.kindat wakeinternalinternalinternalcreatedViaoperatoroperatoroperatorchat.historyoccurrences over a second connectionThe
chat.historyrow is read by a new process over a new connection after the run finishes, which is what a reconnecting client sees. Arms 1, 2 and 3 use the identical harness, session shape and scripted model on the same host; only the image (1 vs 2) or the target (3) differs.A real Control UI client produces the gated session shape with no hand seeding. An earlier report could not explain how a real session acquires
delivery.kind: "internal"and seeded it by hand. It does not need seeding. A sampler recorded the session entry every 3 seconds during arm 2:createdVia: "operator"plusdelivery: { kind: "internal" }is exactly the gate atheartbeat-runner-execution.ts:340-351. The value isinternalat wake time andnoneafterwards, which is why reading the entry after the fact was misleading.Harness, the two prompts as the model actually received them, and settlement log lines
Three images built from
node:24-bookworm+corepack pnpm, each from a detached worktree at the exact sha, alldocker buildexits0:openclaw-repro:MB184e44dbfb428ad11cb20dbaf9ba82b87be7853651main, pre-fixopenclaw-repro:HD18426944919981395990cfdf45c52cd9a76cb66dc3openclaw-repro:PR184572570321d146260ed40ee4df15f33bf5e99897Real in every arm: the gateway process (
openclaw gateway run), the Control UI served by the gateway itself from its owndist/control-ui(control-ui http=200), a real headless Chromium client driven with the same selectors the repo'sui/src/e2esuite uses,chat.sendover the Gateway WebSocket, the exec tool, the real background process,maybeNotifyOnExitinto the heartbeat wake,prepareHeartbeatRunStage, dispatch, the on-disk SQLite session store, andchat.historyover a second connection. The native WebChat app is macOS/iOS only and cannot run in a Linux container; the Control UI chat tab is a real WebChat client over the same RPCs and is the surface the production session shape comes from.Arm 1, merge base
4e44dbf, the prompt the model received:Arm 2,
4269449, same harness:chat.historyread bygateway call chat.historyin a new process over a new connection:The wake fired in all three arms and reached
outcome=completedin all three. Arm 2, from the gateway log:Arm 1 is identical in shape and also reaches
outcome=completed. The entire difference is which prompt the run assembled, and therefore whether anything reached the client.Sanitization: the gateway token in every arm is the literal string
fake-local-token-not-a-secretand appears only in a URL fragment, never on screen. The scripted provider usesapiKey: "unused-local". No real keys, tokens, IPs, phone numbers, private hostnames or personal names appear in any image. The UI shows only the genericAssistant,Owner, workspacewsandScripted Deterministic Model. Each arm ran on throwaway config and a throwaway/state.Live re-run on the current head
cb4e63b5, scripted control plus a real modelRe-run with the same harness on the current head
cb4e63b5(baseline arms on the merge base4e44dbf), with two model configurations: the scripted control (deterministic, compliant), and a real model, Claude Sonnet 5 through the bundledclaude-clibackend on the heartbeat turn that receives the relay or suppression prompt (sessionmodelOverrideset by/model claude-cli/claude-sonnet-5; the first turn stays scripted so that OpenClaw's ownexecstarts the job, because the claude-cli backend mapsexeconto Claude's nativeBashand does not expose it over its MCP bridge). Real-model assertions look for the exec output marker in a new assistant row, never for wording. Full detail, receipt variants and the legacy media replay are in the re-run comment.heartbeat.targetchat.history, 2nd connection4e44dbfcb4e63b5cb4e63b5cb4e63b54e44dbfNO_REPLY)cb4e63b5cb4e63b5NO_REPLY)Legacy media replay (
cb4e63b5) on one real store: a v2026.9.4 gateway wrote a keyed media mirror row with no media identity; on the parent4269449the identical replay candidate conflicts, on the head it matches with no new row, and a changed-media candidate conflicts on both. Browser rendering and second-connection history were live at each phase.Two-destination screenshot gate (AGENTS.md, "Product and validation"): the inspected before/after pair above (
arm1-03-final.png,arm2-03-final.png) was attached in the originating implementation chat on 2026-09-17 at 02:35 UTC and verified to render there, and is embedded here, where every image URL was re-checked to return200 image/png.What the live run does not establish
4269449. The re-run on the current headcb4e63b5is in the subsection above.agent:main:main, not theagent:main:dashboard:<uuid>seen in production. The driver did not find a "New session" control, so the Control UI reused the agent default session.createdViaanddelivery.kindstill match production, and those are what the gate reads.transcript_eventsdurable-row counts were not captured in this run; the query returned empty, so that table or column name is wrong in this harness. An earlier run measured transcript publication successfully. Nothing here contradicts it, but nothing here re-proves it either.heartbeat.target: "none"atagents.defaults, not per session. The container has exactly one session so the effect on the session under test is the same, but no session-scoped field exists.automaticvalue ofmessages.visibleReplieswas exercised.Blast radius of item 6, narrower than it looks
The unresolvable-target arm is proven at unit level and is a real code path, but I could not reach it from a static, schema-valid config, and that is worth saying rather than implying a live repro exists. Both candidate targets were rejected by config validation before the gateway could start:
agents.defaults.heartbeat.targetis validated against an allowlist, so an arbitrary unresolvable string cannot be set there. The resolver state the gate guards against needs a target that passes validation at load and fails normalization at resolution: a channel plugin present when the config validated and absent when the heartbeat resolved, or a non-config heartbeat source. Neither was reproducible in a container in the time available, and a session-scoped override does not exist insrc/config/sessions/types.ts. So the fix is correct and cheap, its unit coverage is real, and its reachability from a static config is not demonstrated.The discriminating unit before and after
Three arms at the end of
src/infra/heartbeat-runner.webchat-exec-completion.test.ts, reusing @jalehman's existingwithProjectionScenario/runProjectionWake/readProjectionMessageshelpers:heartbeat.targettarget:last"last"target:none"none""pagerduty", notoWith only
src/infra/heartbeat-runner-execution.tsreverted to4572570and the test file held at4269449:Patched (
4269449):Test Files 1 passed (1)/Tests 24 passed (24), all arms green.Exactly what that proves, and what it does not. Line 395 is
expect(messages).toHaveLength(publishes ? 1 : 0), the committed assistant row. vitest stops at the first failing assertion, so the committed-row layer is the only layer demonstrated failing on the unpatched arm. TheonSessionTranscriptUpdatebroadcast assertion (:396) and thegetLastHeartbeatEvent()status and reason assertions (:399-403) sit after it and were never evaluated unpatched. Patched, all of them pass. So: one layer proven differentially, every layer proven passing on the new gate, and nothing more is being claimed.Per-arm output, both sides
Unpatched (
heartbeat-runner-execution.tsat4572570, test file at4269449):Patched (
4269449):Plain
expectthroughout, noexpect.soft. Prompt body assertions were left to @jalehman's existingtarget:nonetest rather than duplicated.What the rest of the suite covers
src/infra/heartbeat-session-publication.test.ts(641 lines) exercises the publication owner directly: cancellation and authority loss during queued work, publish-once on replay, receipt reconciliation by key, by stream index and by owned transcript, source-mirror and media receipts, refusal when ownership metadata has no committed final, fences on session, revision, writer and archive, a revision-less generation that later materialises one, and refusal to revive an abandoned completion.src/gateway/session-message-events.exec-completion.test.tsdrivesrunHeartbeatOnceagainst a real gateway WebSocket client, connected and disconnected, and asserts the events drain, exactly one committed completion in history, one live notification when a client is connected and none when it is not, and that a second wake is skipped with the reply generator called once.src/config/sessions/session-accessor.transcript-owner.test.tsandsrc/config/sessions/transcript.media-identity.test.tscover the custody ordering and the media replay identity described above.Local checks on the demonstrated revision
pnpm tsgooxfmt --checkon both changed files--tsconfig config/tsconfig/oxlint.core.json src/infrasrc/infra/sqlite-worker-broker.ts:744 eslint(max-lines), in a file this PR does not touchsrc/infra/heartbeat-runner.webchat-exec-completion.test.tsTest Files 1 passed (1)/Tests 24 passed (24)src/infra/heartbeat*plussrc/gateway/session-message-events.exec-completion.test.tsTest Files 36 passed (36)/Tests 574 passed (574), projectsinfraandgateway-coreheartbeat-runner.returns-default-unset.test.tsruns an exec-event wake for a configured agent when cadence is disabledandruns the agent when an explicit heartbeat target is rejectedboth passNot run: full
pnpm lint, full test suite.CI
The CI analysis below is pinned to run 35168002167 on the demonstrated revision
4269449: 8 failing jobs, 143 passing, 16 skipped. The eight arecontrol-ui-performance, sixchecks-node-compact-*shards, and theopenclaw/ci-gateaggregate that rolls them up. The newer run on headcb4e63b5reports additional failures that are not analysed here.control-ui-performanceis a repo-wide budget failureThe shortcut here would be to call it pre-existing on this branch, and that is not true: the earlier head
1148b94e7e77passed this check at 2026-09-16T22:41:46Z measuring 360695 B (job 105004415143), and it first went red at4572570. The accurate claim is narrower.mainitself fails the same check, with the identical violation:mainhead4e44dbfb74345aa26dbf1873mainat4e44dbfbis exactly the base revision this PR's run merged against, and it measures 362706 B standalone, already past the 362588 B enforcement limit, with none of this PR's code in the tree. Three unrelated branches fail identically in the same window:codex/qa-message-tool-location-sanitizer-20260825, run 35167724806, 362716 Bupd/fleet-snapshot-batch-block, run 35167882651, 362706 Bcodex/fs-safe-paths-reads-20260916, run 35167699554, 362706 BEvery one of them, and this PR, emits the same line verbatim:
Nothing in this PR feeds that bundle. All 17 changed files are absent from all three lists in the committed boot-module manifest
ui/config/control-ui-boot-modules.json(shared2036,new86,chat24, total 2146 entries), no file underui/imports any of the changed modules, and the PR does not touchconfig/control-ui-startup-budget-baseline.json. It touchesconfig/assertion-safety-baseline.txt, which is a different file.Baseline arithmetic, per-head measurements, and the growth explanation
Against the committed baseline in
config/control-ui-startup-budget-baseline.json(startupJsGzipBytes: 362012, last updated 2026-09-14 in #148010):That is 694 B of drift on
main, 118 B past the enforcement limit.Per head on this branch:
1148b94e7e7745725704269449The growth from 360695 B to 362706 B tracks the advancing
mainbase rather than anything on the branch. Scoping the toolchain claim precisely: the three runs on this branch are constant at Node v24.19.0, Vite 8.2.2, Pako 3.0.1. Themainperf jobs quoted above ran Node v24.20.0, so the branch-to-maincomparison is not on a constant toolchain and is not being presented as one. What themainjobs do establish independently is thatmainalone exceeds the limit, and thatmainalone produces both 362706 B and 362716 B on different runs, which is the same 10 B spread seen between4572570and4269449and sits inside the check's own documentedbuild-variance allowance 64 B.Not every branch is red, which is consistent with the merge-base explanation:
codex/claw-882-contextual-help(job 105031877326) and an earliermainrun (job 105030093589) both passed in the same window, having merged against an oldermain.Which
maincommit introduced the roughly 694 B of growth has not been established. There are 9maincommits between the two run basesa11a431eand4e44dbfb, and the builds were not diffed across them.Five of six shard failures have a named cause
checks-node-compact-large-13src/skills/loading/plugin-skill-read.test.tsmainand on 4 unrelated brancheschecks-node-compact-small-26test/scripts/pr-main-refresh.test.tschecks-node-compact-small-24test/scripts/pr-operation-lock.test.tschecks-node-compact-small-39test/scripts/pr-worktree-provision.test.tschecks-node-compact-small-40test/scripts/pr-wrappers.test.tschecks-node-compact-large-29src/gateway/server-methods/models-auth-login.catalog.integration.test.tsThe
test/scripts/pr-*group is merge-base drift, not this branch.maincommit387f69830a8(#149585), "improve(pr): reuse managed source clones for cold worktrees", landed 2026-09-17T00:17:15Z. It sits in the 9-commit window between the base of the4572570run (a11a431e) and the base of this run (4e44dbfb), so it entered this PR's merge base between the two CI runs and was absent from the earlier one. It modifiesscripts/pr,scripts/pr-lib/worktree-provision.mtsand exactly the fourtest/scripts/pr-*.test.tsfiles that fail here.Three of those four, plus
plugin-skill-read.test.ts, fail identically on four unrelated branches whose runs merged against the samemainin the same window:upd/fleet-snapshot-batch-block, run 35167882651codex/qa-message-tool-location-sanitizer-20260825, run 35167724806codex/fs-safe-paths-reads-20260916, run 35167699554refactor/provider-request-resolved-contracts, run 35167506392The failure mode there is the provisioning change, not a test assertion:
test/scripts/pr-wrappers.test.tsis modified by the same commit but did not reproduce on those four branches, so it has a named cause and no independent reproduction. I am not claiming more for it than that.models-auth-login.catalog.integration.test.tsis unexplained. It passed on4572570(job 105026582011) and did not reproduce onmainor on any of the four unrelated branches. This PR touches no file undersrc/gateway/server-methods/, which is an argument from paths rather than from a reproduction, and it is flagged as such.Happy to rebase once the startup budget baseline is refreshed on
main.Review status
ClawSweeper posted Revision 5 at 2026-09-17T01:52Z against head
cb4e63b5. Patch quality is now platinum hermit (4/6) with no actionable review findings; the publication, explicit-suppression and legacy-media replay findings are all recorded as addressed. The single remaining gate is proof confidence (2/6), whose text asks for successful real Control UI background-exec delivery, settlement and reconnect diagnostics, and inspected sanitized before/after screenshots. The live arms above are offered against exactly that item.Limitations
Stated plainly rather than buried:
cb4e63b5(scripted control plus Claude Sonnet 5 on the relay turn); the earlier parent-only limitation no longer applies.exec).pnpm lint, no full test suite. A type-aware oxlint pass oversrc/infraand a 36-file heartbeat plus gateway vitest run were used instead.target: "none"case. It runs withheartbeat: { every: "5m", target: "last" }. The suppression proof sits one layer below the WebSocket, at theonSessionTranscriptUpdatelistener that feeds it, and is now also shown end to end by arm 3. Happy to add the boundary case if the assertion is wanted at the WebSocket layer.assistantTranscriptOwnedand source-mirror paths are exercised byheartbeat-session-publication.test.tsfixtures, not by a run against a real CLI or Codex runtime. "Closes [Bug]: exec-completion wake succeeds but visible reply is dropped in WebChat / Companion #147387" is claimed on the basis that the settlement path is shared, not on a reproduction against the reporter's own runtime.No merge is being attempted.
View the OpenClaw team session