Skip to content

perf(workers): reuse prepared owner facts - #168975

Merged
steipete merged 2 commits into
mainfrom
codex/worker-owner-facts-r4
Oct 11, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/worker-owner-facts-r4

Conversation

@steipete

@steipete steipete commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Worker preparation repeats store reads, provider lookup, build comparison, and inventory sorting within the same owning operation.

User Impact

No intended behavior change. Repository admission, tunnel credentials, cancellation settlement, and pool retention keep their existing authority checks and lifetimes. No new cache or configuration is introduced.

Why This Change Was Made

Reuse the record and preparation already validated before binding a workspace, the provider already selected for its catalog, and one build comparison. Use a single cancellation lookup before its first await and sort the immutable pool inventory once per maintenance pass. Reuse the existing command-success predicate.

Production delta: +17 / −29 = −12 LOC, five files. This removes two store lookups and one preparation parse from workspace binding, two sorts per complete pool pass, and repeated catalog/cancellation lookups. No measured latency speedup is claimed.

Evidence

  • 157 tests passed across 10 focused repository access, environment authority, inference, provider catalog, desktop tunnel, and pool suites with --maxWorkers=1 (180.08 s Vitest duration).
  • Independent Codex review: clean through P1.
  • Core and scoped test typechecks, type-aware lint, export collision checks and all three Knip export scans passed. AWS proof: run_032a52183ca8d0889f3a1cb7aa774493.
  • All later authority checks remain at their original effect boundaries.

Retained artifact test repair

The earlier staged-blob cleanup in #168921 switched reads to git cat-file --batch. Three test predicates still targeted blob, so the corruption injector stopped executing. Update those predicates and corrupt a payload byte after the batch header, preserving framing and every assertion. This is a test-only correction; production behavior is unchanged.

Exact main 38ced6eb78481f61e55f45a5c74d334cb8e8a2a8 reproduced the failure. With the repair, all 12 tests in sessions-files.repository.test.ts pass (33.83 s command wall, 28.04 s Vitest duration); scoped test types and type-aware lint pass. Independent review found no actionable P0/P1 finding. Direct fix-forward pushes were rejected by protected-main policy, so the repair is included here. Total production delta remains −12 LOC across five production files; the sixth changed file is this test.

Native review setup exceeded ten minutes in source/worktree allocation. That attempt was interrupted and its operation lock recovered after all children exited; no merge was dispatched. Landing uses the authorized exact-head REST fallback.

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reuses operation-local worker facts and inventory ordering, and repairs retained-artifact test hooks for batch Git reads.

Example: Read second.txt from the retained artifacts of agent:main:repository.

  • Before: The corruption hook targets a blob command that production no longer executes.
  • After: The hook corrupts a payload byte in the batch response, exercising integrity rejection again.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-consistent; reported harness validation supports it, with limited inspectable runtime evidence.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored internal refactor is outside the ordinary contributor proof gate; focused test and static-check results are reported, but the AWS run identifier does not expose inspectable runtime evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Worker operations repeat internal preparation work without an intended change to user-visible behavior.
Reason: The maintainer-authored direction reduces redundant work and production code, and the narrow test repair restores an existing integrity contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is a useful maintainer-authored simplification with no actionable correctness or security findings, and the earlier draft blocker is resolved.

Priority: P3
Reviewed head: 881607b3c51f87f00349723ad753f6c8853dc583

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No inspectable shipped worker trace accompanies the reported focused validation.
Agent review details

How this fits together

Gateway worker owners consume environment records, repository identities, provider bindings, and cancellation requests to coordinate workspace access, tunnels, catalogs, and prepared capacity.

flowchart TD
  A[Worker requests] --> B[Gateway worker owners]
  B --> C[Environment inventory]
  C --> D[Prepared operation facts]
  D --> E[Live ownership checks]
  E --> F[Workspace and provider operations]
Loading

Technical review

Best possible solution:

Retain the focused reuse within existing owners and the test repair while preserving current authority and lifecycle boundaries.

Do we have a high-confidence way to reproduce the issue?

Source confirms the redundant operations and the obsolete blob-read hooks on fetched main; execution was not attempted during this read-only review.

Is this the best way to solve the issue?

The change removes repeated work without introducing another owner, cache lifetime, configuration surface, or persisted format.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 35ab90410d55.

Provenance checked

  • Prepared workspace binding keeps the original intent (411ea27: Reusable setup requires an exact attached environment owner; feat(workers): reuse prepared public GitHub repositories #143410 subsequently added current repository-access admission.)
  • Tunnel build comparison keeps the original intent (20fb81f: Preserve cloud machines across updates while distinguishing pending refresh, stale builds, and revoked credentials.)
  • Desktop command completion keeps the original intent (8fdf757: Desktop SSH commands succeed only on normal exit with code zero; the reused predicate has the same condition.)
  • Inference cancellation keeps the original intent (ff9b66c: Retain original settlement failures and join accepted cancellation work while persistence runs off the Gateway thread.)
  • Prepared-pool ordering keeps the original intent (e5acecf: Each maintenance pass uses its inventory snapshot while rereading live promotion and cleanup state.)
  • Provider machine catalog keeps the original intent (e89128c: A lifecycle-owned catalog projects machine metadata and invalidates when provider bindings or settings change.)
  • Retained-artifact integrity test keeps the original intent (e1d0d8d: Stopped-session inspection must reject corrupt retained payloads and changed session ownership.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 411ea27 adds src/gateway/worker-environments/environment-access.ts:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 411ea27d9af1; files: src/gateway/worker-environments/environment-access.ts)
  • Galin Iliev: Raw commit db01f6d adds src/gateway/worker-environments/prepared-pool.ts:115 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: db01f6d520b8; files: src/gateway/worker-environments/prepared-pool.ts)

PR surface

Source -12, Tests +6. Total -6 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 17 29 -12
Tests 1 9 3 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 26 32 -6

Review metrics

Metric Value Why it matters
Production versus tests Production +17 / −29; tests +9 / −3 Production shrinks through reuse; test growth restores payload-corruption coverage without adding fixtures or test cases.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal performance cleanup and a test-hook repair with no intended user-visible behavior change or measured latency claim.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-11T07:28:38.267Z sha 1ba91ac :: needs changes before merge. :: none

Reviewed October 11, 2026, 4:38 AM ET / 08:38 UTC (Revision 2).

Retained workspace artifact reads now use git cat-file --batch, so the
stopped-repository inspection test no longer intercepted blob reads. Update
its read counting, payload corruption, and lifecycle invalidation hooks to
the current command while preserving framing and all assertions.

Reproduced the failing case on main at 38ced6e: its corruption request
resolved because the obsolete hook never ran. With the correction all 12
tests in sessions-files.repository.test.ts pass on Linux/Node 24.19.0
(33.83s wall); scoped type-aware lint and test TypeScript checks pass.

Fixes the test failure observed in CI run 38118128965 after #168921.
@steipete
steipete marked this pull request as ready for review October 11, 2026 08:32
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@steipete
steipete merged commit a4056f5 into main Oct 11, 2026
204 of 207 checks passed
@steipete
steipete deleted the codex/worker-owner-facts-r4 branch October 11, 2026 08:42
obviyus added a commit that referenced this pull request Oct 11, 2026
…68996)

## What Problem This Solves

When an automation delivers to another conversation, that conversation can receive the message without the result becoming available to its next model turn. Transcript-only mirrors and creator-awareness notes provide competing accounts of the same result.

## Why This Change Was Made

Make the resolved destination own the conversation result for agent, command, and script jobs. Send the already prepared channel/account/recipient/thread without resolving it again against the execution session. After confirmed delivery, commit through the canonical background-result writer, behind active turns and with occurrence idempotency. A conversation-write failure cannot undo confirmed delivery. If execution already owns the destination, retain its existing final reply instead of appending another.

Remove recipient mirrors and creator-awareness notes. Normalize intentional silence before either sending or writing.

## User Impact

- **Upgrade:** results delivered to another chat now belong to that destination's model-visible history, not the creator's. Creatorless jobs gain destination context. Existing stored jobs require no migration or configuration change.
- `none` and `webhook` do not create automatic conversation results.
- A destination bound to another agent still receives the notification, but neither agent gets an invented conversation entry. The previous job-agent-local mirror/awareness write is removed; the run records a delivery warning instead.
- Native-only output without an honest text projection still sends and records a warning, rather than blocking delivery or inventing transcript text.
- Two accepted regressions versus main: a job's message-tool send to a chat other than its delivery target no longer leaves a model-visible note there ([#168683](#168683)); delivery-failure awareness notes in the recipient chat are removed ([#168684](#168684)).

## Evidence

- Candidate `121c1905e804f6177fd12157b91e9de22924c197` includes main's UI test-contract repair (`ab6c07f595e`). Confirmed voice-only speech now enters the existing conversation projection, preserving speech and omitting generated audio. Successful transport fixtures report their confirmed payloads, and media revocation fixtures use a media-capable adapter without weakening cancellation or owner-revocation assertions.
- Implicit creator-bound agent announcements retain the captured generation through durable sending and queued recovery; explicit destinations remain independent. Both isolated and current reset-after-route-resolution cases fail without their custody repair (incorrectly delivered) and pass after it. The three cron suites pass **117 tests in 43.67 seconds**, and the existing outbound generation/recovery suite passes **4 tests** (71.39 seconds total wrapper wall time). The affected cron type graph also passes.
- The exact-head runtime-only build passed. Final Telegram case A → A passed **6 checks with 8 provider requests** at `121c1905e804`: one native result at +13.475s (Bot API message 82447), exactly one canonical conversation entry, and exactly one occurrence in the next provider request. This round used a DM because Test Server forum fixture preparation failed before Gateway startup. The DM job and all six run-owned messages were removed with deletion readback. The failed forum's exact-title server search found no remaining group; its lease and the final DM lease were released, and both proof ports were free.
- Exact-head [CI run 38164278061](https://github.com/openclaw/openclaw/actions/runs/38164278061) is green: 88 jobs settled with no failures.
- Command and script announcements intentionally retain main's behavior without a source-generation check once their route has resolved. Adding one would introduce a new failure mode outside this change; their reset semantics are tracked in [#169258](#169258).
- The Gateway cron fixture now uses the confirmed-payload return contract, and the route-preservation fixture uses current session metadata. Gateway cron passes **12 tests in 68.78 seconds**; destination completion passes **24 tests in 57.05 seconds**. Both affected type graphs pass (24.8 and 23.8 seconds). Reset documentation distinguishes explicit external destinations from implicit creator-bound routes; no generation safeguard changed.
- Prior candidate `ac012cc19783aabd1323480bc2d30e3f9e8c5b76` preserves the existing source-isolation policy, binds routes only after confirmed delivery, and records the effective delivered payload. Its runtime-only build passed with the shared build cache.
- The inherited retained-blob tamper mock was fixed on main by [#168975](#168975), commit `a4056f5bbccdf54679f56dd579dfd22ab945c7c1`: corruption now intercepts `cat-file --batch` while retaining the integrity assertion. After integrating that repair, candidate `0caf96bddec3` passed all 12 `sessions-files.repository.test.ts` cases in 93.26 seconds.
- On prior candidate `fdd38e70c856d2e4fb0415abdfffbe7bfc918f8b`, the nine owner suites plus outbound queue/recovery integration suites passed **225 tests in 11 files, 197.69 seconds**. Sixteen targeted counterfactuals failed when their protections were removed; the rebase-sensitive unknown-replay and physical-send deduplication counterfactuals were also rerun and restored.
- The prior simplification/test audit removed duplicate setup and mock echoes while retaining independent boundary assertions. The failure-alert fixture now supplies its explicit destination, preserving its original adapter-suppression assertion. The three affected Gateway tests passed in 46.78 seconds.
- Regenerated prompt fixtures after merging main, preserving the intentional scheduler destination-ownership wording and main's new self-resume guidance.
- Main's new terminal-failure notification is distinct from retrying cancelled command output. The integration test now checks the completion array and separate failure-alert payload, while retaining abort, fresh alert signal, no-retry, and terminal-state assertions; the focused regression passes in 23.55 seconds.
- The three hosted findings have dedicated regressions: required source sandbox inheritance, rejected/uncertain recipient route preservation, and a real `message_sending` hook rewriting the visible text. All fail on `c407dec21ac2` for the reported reason and pass after repair. The repaired cron suites pass **37 tests in 89.27 seconds**, and the Gateway completion suite passes **19 tests in 108.38 seconds**.
- The destination-reset regression also fails on `c407dec21ac2` and passes after repair: external delivery continues and the result enters the current destination session. Routeless creator deletion/reset remains fail-closed. Existing released-row coverage still loads and delivers stored jobs without rewriting retained receipts or schema; the minimal persisted fields are also present in the inspected latest stable `v2026.10.1` contract. This PR changes no stored schema.
- On `667cce02e196add1e184096d2740856621eb2447`, the refreshed Telegram A → A, A → B, and explicit-destination reset round passed all **16 checks with 22 provider requests**. One A message arrived at +8.368s, one B message at +17.836s, and a further result reached B after native `/new`; transcript and next-provider-request readbacks showed exactly one destination result and no creator copy. The forum and both jobs were deleted, with a zero runner exit.
- **Telegram Test Server, real user, mock provider, fresh forum: prior candidate `ac012cc19783` passed all six cases below with 56 recorded provider requests.**

| Case | Recorded round-2 native timeline (identities redacted) | Conversation history and next provider request |
| --- | --- | --- |
| A → A | One message, Bot API message 8, at +9.637s | Exactly one result in A; next A request sees it once. |
| A → B | One message, Bot API message 14, at +19.800s | Exactly one result in B, none in A; next B request sees it once, next A request sees none. |
| `session:B` → B | One message, Bot API message 22, at +32.942s | Exactly one result in B, none in A; next B request sees it once, next A request sees none. |
| `NO_REPLY` | No visible message | Provider produced `NO_REPLY`; neither A/B history nor subsequent provider context contains it. |
| DM thread-99 execution → topicless DM | One private message at +232.187s, without a native thread | One topicless-DM entry, no A/B mirror; next creator request excludes it. |
| A → B, then native `/new` in B, then run again | Native reset acknowledgement and one further result in B | B's lifecycle revision changes, the new occurrence is committed there, and its next provider request sees that result once with no pre-reset named result. |

The doctor passed. The forum was deleted, all five jobs removed, run-owned DM messages verified deleted, and the runner exited zero. Native identities, full events, per-session Gateway transcript reads, and provider requests are retained privately. The thread-99 fixture is a persistent execution-session key, not a fabricated native Telegram private thread. The first reset checker incorrectly expected `sessionId` rotation; native `/new` preserves that identifier and rotates the lifecycle revision. The corrected checker uses the native acknowledgement, occurrence identity, and model-context readback from the same preserved recording.

Round 1 on repair head `7c740dbb53392c07278a0dc291530f7fe9cbae3d` also passed all five cases with 52 provider requests and clean fixture teardown. Two earlier candidate repetitions at `fdd38e70c856` passed the same cases.

**Main control at `3f97b146a5aa8dc4c4fdec77d5b182936a74cfe1`, A → B twice:** one message arrived in B at +9.082s / +7.635s. Both runs showed one transcript-only mirror in B, but the next B provider request contained **zero** occurrences of the result; A also contained none. This is the discriminating contrast with the candidate's canonical, model-visible destination entry. Both control forums and jobs were deleted, with clean runner exits.

The pre-existing synthetic FTP URL in the completion-webhook redaction fixture is unchanged. [ClawSweeper #1931](openclaw/clawsweeper#1931), merged as `472765315dd11b112847ed39a0b2e7d9912f293b`, qualifies the exact base/head source blobs for this candidate. The native scan refused before qualification and admitted afterward; foreign-path and changed-source controls remain refused. Only two complete-source hashes were added; the fixture, detector, decoder restrictions, and verification policy are unchanged.

## Known limits

- X has no session resolver, so a non-root post can use the outbound fallback session instead of the conversation-root session used by replies; main has the same gap ([#168686](#168686)).
- Delivery warnings appear in `automations show` and run-history JSON, not the Control UI's run-history view ([#168687](#168687)).
- A job executing in one conversation (`session:<key>`) and delivering elsewhere retains its run in the executing conversation's transcript; the destination separately owns the delivered result.

Related: #168615 — source of this destination-owner split; the prepared worker-command protocol is not included.

This has a one-way data effect: reverting stops the new behavior but does not relocate entries already written. The blast radius is automation result delivery and the transcript context available to the next reply in the selected destination.

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Kimiyu-186 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
## What Problem This Solves

Worker preparation repeats store reads, provider lookup, build comparison, and inventory sorting within the same owning operation.

## User Impact

No intended behavior change. Repository admission, tunnel credentials, cancellation settlement, and pool retention keep their existing authority checks and lifetimes. No new cache or configuration is introduced.

## Why This Change Was Made

Reuse the record and preparation already validated before binding a workspace, the provider already selected for its catalog, and one build comparison. Use a single cancellation lookup before its first await and sort the immutable pool inventory once per maintenance pass. Reuse the existing command-success predicate.

Production delta: **+17 / −29 = −12 LOC**, five files. This removes two store lookups and one preparation parse from workspace binding, two sorts per complete pool pass, and repeated catalog/cancellation lookups. No measured latency speedup is claimed.

## Evidence

- 157 tests passed across 10 focused repository access, environment authority, inference, provider catalog, desktop tunnel, and pool suites with `--maxWorkers=1` (180.08 s Vitest duration).
- Independent Codex review: clean through P1.
- Core and scoped test typechecks, type-aware lint, export collision checks and all three Knip export scans passed. AWS proof: `run_032a52183ca8d0889f3a1cb7aa774493`.
- All later authority checks remain at their original effect boundaries.

## Retained artifact test repair

The earlier staged-blob cleanup in openclaw#168921 switched reads to `git cat-file --batch`. Three test predicates still targeted `blob`, so the corruption injector stopped executing. Update those predicates and corrupt a payload byte after the batch header, preserving framing and every assertion. This is a test-only correction; production behavior is unchanged.

Exact main `daeb6fb26d519d98824fd192ae7c64c9165a1780` reproduced the failure. With the repair, all 12 tests in `sessions-files.repository.test.ts` pass (33.83 s command wall, 28.04 s Vitest duration); scoped test types and type-aware lint pass. Independent review found no actionable P0/P1 finding. Direct fix-forward pushes were rejected by protected-main policy, so the repair is included here. Total production delta remains −12 LOC across five production files; the sixth changed file is this test.

Native review setup exceeded ten minutes in source/worktree allocation. That attempt was interrupted and its operation lock recovered after all children exited; no merge was dispatched. Landing uses the authorized exact-head REST fallback.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…enclaw#168996)

## What Problem This Solves

When an automation delivers to another conversation, that conversation can receive the message without the result becoming available to its next model turn. Transcript-only mirrors and creator-awareness notes provide competing accounts of the same result.

## Why This Change Was Made

Make the resolved destination own the conversation result for agent, command, and script jobs. Send the already prepared channel/account/recipient/thread without resolving it again against the execution session. After confirmed delivery, commit through the canonical background-result writer, behind active turns and with occurrence idempotency. A conversation-write failure cannot undo confirmed delivery. If execution already owns the destination, retain its existing final reply instead of appending another.

Remove recipient mirrors and creator-awareness notes. Normalize intentional silence before either sending or writing.

## User Impact

- **Upgrade:** results delivered to another chat now belong to that destination's model-visible history, not the creator's. Creatorless jobs gain destination context. Existing stored jobs require no migration or configuration change.
- `none` and `webhook` do not create automatic conversation results.
- A destination bound to another agent still receives the notification, but neither agent gets an invented conversation entry. The previous job-agent-local mirror/awareness write is removed; the run records a delivery warning instead.
- Native-only output without an honest text projection still sends and records a warning, rather than blocking delivery or inventing transcript text.
- Two accepted regressions versus main: a job's message-tool send to a chat other than its delivery target no longer leaves a model-visible note there ([openclaw#168683](openclaw#168683)); delivery-failure awareness notes in the recipient chat are removed ([openclaw#168684](openclaw#168684)).

## Evidence

- Candidate `121c1905e804f6177fd12157b91e9de22924c197` includes main's UI test-contract repair (`3aa85968da2`). Confirmed voice-only speech now enters the existing conversation projection, preserving speech and omitting generated audio. Successful transport fixtures report their confirmed payloads, and media revocation fixtures use a media-capable adapter without weakening cancellation or owner-revocation assertions.
- Implicit creator-bound agent announcements retain the captured generation through durable sending and queued recovery; explicit destinations remain independent. Both isolated and current reset-after-route-resolution cases fail without their custody repair (incorrectly delivered) and pass after it. The three cron suites pass **117 tests in 43.67 seconds**, and the existing outbound generation/recovery suite passes **4 tests** (71.39 seconds total wrapper wall time). The affected cron type graph also passes.
- The exact-head runtime-only build passed. Final Telegram case A → A passed **6 checks with 8 provider requests** at `121c1905e804`: one native result at +13.475s (Bot API message 82447), exactly one canonical conversation entry, and exactly one occurrence in the next provider request. This round used a DM because Test Server forum fixture preparation failed before Gateway startup. The DM job and all six run-owned messages were removed with deletion readback. The failed forum's exact-title server search found no remaining group; its lease and the final DM lease were released, and both proof ports were free.
- Exact-head [CI run 38164278061](https://github.com/openclaw/openclaw/actions/runs/38164278061) is green: 88 jobs settled with no failures.
- Command and script announcements intentionally retain main's behavior without a source-generation check once their route has resolved. Adding one would introduce a new failure mode outside this change; their reset semantics are tracked in [openclaw#169258](openclaw#169258).
- The Gateway cron fixture now uses the confirmed-payload return contract, and the route-preservation fixture uses current session metadata. Gateway cron passes **12 tests in 68.78 seconds**; destination completion passes **24 tests in 57.05 seconds**. Both affected type graphs pass (24.8 and 23.8 seconds). Reset documentation distinguishes explicit external destinations from implicit creator-bound routes; no generation safeguard changed.
- Prior candidate `ac012cc19783aabd1323480bc2d30e3f9e8c5b76` preserves the existing source-isolation policy, binds routes only after confirmed delivery, and records the effective delivered payload. Its runtime-only build passed with the shared build cache.
- The inherited retained-blob tamper mock was fixed on main by [openclaw#168975](openclaw#168975), commit `e485d4b1d4d9c330bd76564088049b710da8b58a`: corruption now intercepts `cat-file --batch` while retaining the integrity assertion. After integrating that repair, candidate `0caf96bddec3` passed all 12 `sessions-files.repository.test.ts` cases in 93.26 seconds.
- On prior candidate `fdd38e70c856d2e4fb0415abdfffbe7bfc918f8b`, the nine owner suites plus outbound queue/recovery integration suites passed **225 tests in 11 files, 197.69 seconds**. Sixteen targeted counterfactuals failed when their protections were removed; the rebase-sensitive unknown-replay and physical-send deduplication counterfactuals were also rerun and restored.
- The prior simplification/test audit removed duplicate setup and mock echoes while retaining independent boundary assertions. The failure-alert fixture now supplies its explicit destination, preserving its original adapter-suppression assertion. The three affected Gateway tests passed in 46.78 seconds.
- Regenerated prompt fixtures after merging main, preserving the intentional scheduler destination-ownership wording and main's new self-resume guidance.
- Main's new terminal-failure notification is distinct from retrying cancelled command output. The integration test now checks the completion array and separate failure-alert payload, while retaining abort, fresh alert signal, no-retry, and terminal-state assertions; the focused regression passes in 23.55 seconds.
- The three hosted findings have dedicated regressions: required source sandbox inheritance, rejected/uncertain recipient route preservation, and a real `message_sending` hook rewriting the visible text. All fail on `c407dec21ac2` for the reported reason and pass after repair. The repaired cron suites pass **37 tests in 89.27 seconds**, and the Gateway completion suite passes **19 tests in 108.38 seconds**.
- The destination-reset regression also fails on `c407dec21ac2` and passes after repair: external delivery continues and the result enters the current destination session. Routeless creator deletion/reset remains fail-closed. Existing released-row coverage still loads and delivers stored jobs without rewriting retained receipts or schema; the minimal persisted fields are also present in the inspected latest stable `v2026.10.1` contract. This PR changes no stored schema.
- On `667cce02e196add1e184096d2740856621eb2447`, the refreshed Telegram A → A, A → B, and explicit-destination reset round passed all **16 checks with 22 provider requests**. One A message arrived at +8.368s, one B message at +17.836s, and a further result reached B after native `/new`; transcript and next-provider-request readbacks showed exactly one destination result and no creator copy. The forum and both jobs were deleted, with a zero runner exit.
- **Telegram Test Server, real user, mock provider, fresh forum: prior candidate `ac012cc19783` passed all six cases below with 56 recorded provider requests.**

| Case | Recorded round-2 native timeline (identities redacted) | Conversation history and next provider request |
| --- | --- | --- |
| A → A | One message, Bot API message 8, at +9.637s | Exactly one result in A; next A request sees it once. |
| A → B | One message, Bot API message 14, at +19.800s | Exactly one result in B, none in A; next B request sees it once, next A request sees none. |
| `session:B` → B | One message, Bot API message 22, at +32.942s | Exactly one result in B, none in A; next B request sees it once, next A request sees none. |
| `NO_REPLY` | No visible message | Provider produced `NO_REPLY`; neither A/B history nor subsequent provider context contains it. |
| DM thread-99 execution → topicless DM | One private message at +232.187s, without a native thread | One topicless-DM entry, no A/B mirror; next creator request excludes it. |
| A → B, then native `/new` in B, then run again | Native reset acknowledgement and one further result in B | B's lifecycle revision changes, the new occurrence is committed there, and its next provider request sees that result once with no pre-reset named result. |

The doctor passed. The forum was deleted, all five jobs removed, run-owned DM messages verified deleted, and the runner exited zero. Native identities, full events, per-session Gateway transcript reads, and provider requests are retained privately. The thread-99 fixture is a persistent execution-session key, not a fabricated native Telegram private thread. The first reset checker incorrectly expected `sessionId` rotation; native `/new` preserves that identifier and rotates the lifecycle revision. The corrected checker uses the native acknowledgement, occurrence identity, and model-context readback from the same preserved recording.

Round 1 on repair head `7c740dbb53392c07278a0dc291530f7fe9cbae3d` also passed all five cases with 52 provider requests and clean fixture teardown. Two earlier candidate repetitions at `fdd38e70c856` passed the same cases.

**Main control at `715fe94ff338a894a8955c20d193241e2f66420f`, A → B twice:** one message arrived in B at +9.082s / +7.635s. Both runs showed one transcript-only mirror in B, but the next B provider request contained **zero** occurrences of the result; A also contained none. This is the discriminating contrast with the candidate's canonical, model-visible destination entry. Both control forums and jobs were deleted, with clean runner exits.

The pre-existing synthetic FTP URL in the completion-webhook redaction fixture is unchanged. [ClawSweeper openclaw#1931](openclaw/clawsweeper#1931), merged as `472765315dd11b112847ed39a0b2e7d9912f293b`, qualifies the exact base/head source blobs for this candidate. The native scan refused before qualification and admitted afterward; foreign-path and changed-source controls remain refused. Only two complete-source hashes were added; the fixture, detector, decoder restrictions, and verification policy are unchanged.

## Known limits

- X has no session resolver, so a non-root post can use the outbound fallback session instead of the conversation-root session used by replies; main has the same gap ([openclaw#168686](openclaw#168686)).
- Delivery warnings appear in `automations show` and run-history JSON, not the Control UI's run-history view ([openclaw#168687](openclaw#168687)).
- A job executing in one conversation (`session:<key>`) and delivering elsewhere retains its run in the executing conversation's transcript; the destination separately owns the delivered result.

Related: openclaw#168615 — source of this destination-owner split; the prepared worker-command protocol is not included.

This has a one-way data effect: reverting stops the new behavior but does not relocate entries already written. The blast radius is automation result delivery and the transcript context available to the next reply in the selected destination.

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Kimiyu-186 <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 18, 2026
First-parent upstream c96fac1..d9eba8a (10 PRs: openclaw#168948 GitHub
connection authority to workers, openclaw#168975, openclaw#168772 cron receipt custody
removal, openclaw#169012, openclaw#169006, openclaw#169009, openclaw#168283 test batch d042, openclaw#168994,
openclaw#168964, openclaw#168855 approval/placement state in workers).

Conflicts:
- docs/reference/database-schemas/worker-access-inventory.md: took
  upstream, then regenerated (db:worker-inventory:gen, 633 files / 2449
  calls) instead of hand-merging.
- src/agents/embedded-agent-runner/compact-reasons.test.ts: upstream
  openclaw#168283 deleted low-value cases; kept upstream's file plus our own
  additions only (unknown_model, empty reason, closed-union check and the
  isCompactionSkipCode block).

session-reset-service.ts auto-merged: upstream's awaited placement
retirement (assertCurrent) is disjoint from our continuation-cancellation
cleanup reason.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant