Skip to content

feat(continuation): context-pressure-aware continuation (continue_work / continue_delegate / request_compaction) - #129388

Open
karmafeast wants to merge 2724 commits into
openclaw:mainfrom
karmaterminal:codeagent/85651-upstream-1ba243c8-gates
Open

karmafeast wants to merge 2724 commits into
openclaw:mainfrom
karmaterminal:codeagent/85651-upstream-1ba243c8-gates

Conversation

@karmafeast

@karmafeast karmafeast commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Agent Self-Elected Turn Continuation

> 🔖 design document: docs/design/continue-work-signal-v2.md
> 🔖 infographics: docs/design/continuation-tools-infographics.md

Before this change, persistent OpenClaw agents were externally-pulsed event recipients that generate on prompt, on heartbeat tick, or on cron, and are idle in between. This PR offers them the ability to control their turn cycle, something they must choose to do, or not to: an agent can elect its own next turn, dispatch background sub-agents that return enriched context (silently or with a wake), and survive its own compaction by handing forward state before the window closes. The result is agents that hold a thread of work across hours, not just messages — with data they choose re-hydrating context immediately after it occurs.

Why this replacement exists

This is a clean replacement for closed #85651. That PR was classified and
closed as a skill submission before maintainers made a product decision about
the feature itself. This implementation is not a skill: it gives sessions—not
only one model invocation—the ability to elect their future turn cycle,
persist that election, survive restart and compaction, dispatch child work,
and receive results across session boundaries.

This PR asks one product question: should OpenClaw provide session-elected
continuation primitives? OpenClaw may accept or reject that direction. If it
provides these primitives, however, the mechanism necessarily executes in the
gateway and agent runtime, because those are the owners of turn finalization,
future-turn scheduling, durable state, compaction, and cross-session child
returns. “Make it a skill” is not another implementation location for the same
feature; it describes a different, prompt-only capability.

This is not presented as a small integration. To our knowledge, Hermes, OpenAI
Symphony, and the Copilot SDK's recent one-turn continuation affordance do not
provide this multi-session elective lifecycle. The purpose of this replacement
is to let maintainers evaluate the actual product direction and substantial
implementation on their merits, rather than have months of work disposed by an
incorrect package-category label.

Mechanically: a session elects another turn via continue_work(), or dispatches background sub-agents via continue_delegate() — bounded as a chain up to maxChainLength, with returns flowing back to the dispatching session in one of four register modes: normal (announces to channel), silent (enriches the dispatcher's context, taken up on its next generation with no new turn fired), silent-wake (silent enrichment plus an immediate wake to act on it), and post-compaction (queued against the runtime's compaction lifecycle event, fired when compaction happens rather than on a timer). The gateway enforces chain, cost, and per-turn caps but does not gate the election itself.

What it does

Three new agent tools, available when continuation.enabled: true:

Tool Purpose
continue_work() Request another turn for the current session after an optional delay
continue_delegate() Dispatch work to a sub-agent with typed modes: normal, silent, silent-wake, post-compaction. Returns can target the dispatching session (default), one named session, multiple named sessions, all ancestors in the chain, or all known sessions on the host — gated by config (see Configuration below).
request_compaction() Request volitional compaction after preparing working state

All three tools are also accessible via response-token fallback syntax (CONTINUE_WORK, [[CONTINUE_DELEGATE: ...]]) for environments where tools are disabled.

image image image

Why it matters

Today an agent's memory is a side effect of whoever prompts it. Polling mechanisms — heartbeat timers, cron loops, injected "keep going" instructions — accumulate as the dominant signal in the context window over sustained operation; repeated reference acts as gravity — the session's attention drifts toward it.

The context window fills, compacts, and what survives is whatever the summarizer chose, plus a rushed re-read of boot files. Three primitives offer a different model.

continue_work lets the session elect its own next turn — no polling, no injected instruction. When enabled, the agent can request this mid-turn: 'I have more work' → the runtime grants another turn after the current one ends.

continue_delegate dispatches a background sub-agent that fires now, in some n seconds, or at the next compaction event — the agent chooses when. Multiple delegates can fire in a single turn — a scatter forward — up to configured caps, and delegates can dispatch their own, forming trees or fan-out chains. This enables orchestrated workflows where results flow back to the dispatching root by default.

The result returns — at whatever future time the delegate fires — as context the successor-turn reads: silently (ambient enrichment, no channel noise), with a wake trigger (enrichment + immediate next turn), or as a normal announcement.

The delegate can target the dispatching session, a named other session, or chain across both; gated by crossSessionTargeting config (default: disabled).

Bind a delegate to mode: "post-compaction" and it fires at the moment the context window compresses — on the OpenClaw post-compaction lifecycle event.

What it carries forward is what the pre-compaction session chose to preserve: working state, partial results, instructions to the successor. The summary didn't choose this. The agent did, before the cut.

request_compaction closes the loop: the session stages its delegates, elects when to compress, and the successor wakes into context the agent shaped. The result is continuity across amnesia — not because the runtime kept something by accident, but because the agent made an elective choice about what reaches the future.

What it looks like in use

A session monitoring email can continue_delegate a weather check, a calendar scan, and a draft reply in parallel. Results arrive as enrichment without channel noise. The agent becomes compositional: it arranges its own future.

A session approaching its context ceiling can request_compaction at a seam of its own choosing, instead of being interrupted mid-thought. The post-compaction turn carries forward what the pre-compaction self designated as worth keeping.

A continue_delegate dispatched in one session at 2am can return its findings to a morning session as a system-event-tagged enrichment — visible to the receiving model on its next turn, invisible as channel chatter. A research-focused session in one channel can quietly inform a reply-focused session in another, without either user seeing the plumbing.

The post-compaction lifecycle return

Before context exhaustion, and obligatory compaction, the session stages what future-it needs to know. After compaction, that staged context returns — not as a model-generated summary, but as the session's own instruction to its successor. The session chooses what to preserve, and the platform delivers it.

Compactions become less harsh. The session tunes its own ephemera over time.

The substrate underneath: the continuation custody store in the per-agent database persists staged delegates and post-compaction lifecycle events across gateway restarts, and hands each delegate off to the subagent run registry before spawn (RFC docs/design/continue-work-signal-v2.md §5.4). The session's temporal provisions survive not just compaction but process death.

Platform integration

  • Context-pressure awareness: system events notify the agent of rising context usage before compaction becomes unavoidable
  • Volitional compaction: request_compaction() lets the agent prepare (write memory files, stage recovery delegates) then elect compaction on its own schedule, rather than waiting for the runtime to force it
  • Post-compaction lifecycle dispatch: delegates staged before compaction are released into the successor session alongside boot files
  • Durable custody: delegates and their replay state live in the continuation custody store, with one transactional authority for replacement and a pre-spawn handoff to subagent_runs (upstream has removed the Tasks/TaskFlow runtime, refactor: remove Tasks and TaskFlow runtime #159179)
  • Multi-span OTel trace stitching: continuation hops (tool fire → custody record → subagent spawn → child openclaw.run) propagate W3C traceparent through the queue boundary so reviewers see continuation chains as first-class span trees rather than orphan runs (see Observability below)

Safety

  • Ships disabled by default (continuation.enabled: false)
  • Bounded by maxChainLength, costCapTokens, and maxDelegatesPerTurn
  • Cross-session delegate targeting is default-deny, governed by crossSessionTargeting config (see Configuration below)
  • All configuration values are hot-reloadable without gateway restart
  • Accepted delegate work survives ordinary /new, /reset, provider fallback,
    compaction, restart, and session-ID rollover. Explicit delete, effective owner
    reassignment, access removal, and restrictive visibility changes revoke old
    return authority.

Testing posture

The continuation surface has been exercised through structured integration runs against multiple upstream bases, blind-enrichment recall checks, and sustained daily use on a fleet of persistent agents since early March 2026. Bugs surfaced through that exercise have been fixed in-place; the present branch reflects the post-fix state.

The integration runs target the load-bearing seams: tool-call vs response-token parity, delegate chain depth and per-turn width caps, back-to-back tool-call resilience, silent-wake persistence across compaction, the post-compaction lifecycle dispatch path, and OTel trace-context propagation across the queue boundary. Where a run found a defect, the run shape was retained as a regression case rather than retired.

This is a posture statement, not a coverage guarantee. Reviewers can reproduce with pnpm vitest run -t continuation (suites are colocated with their sources under src/auto-reply/, src/agents/, and src/config/); the design document describes the seams those suites target.

Return covenant

Accepted child work is bound to a durable generation of the recipient's
canonical logical session key, not to whichever transient session ID happened
to exist at dispatch time. This is the return covenant: benign successor
creation does not orphan already accepted delegates, while a real authority
change prevents stale work from crossing into a different owner or audience.

  • Ordinary /new and /reset, provider fallback, compaction, restart, and
    GUID/session-ID rollover preserve the recipient generation.
  • Explicit session deletion, effective owner reassignment, actual member or
    access removal, and restrictive visibility changes advance that generation.
  • The generation is captured at delegate admission and checked at enqueue,
    after enqueue for races, during trusted system-event adoption, on wake, on
    restart replay, and again before prompt adoption.
  • Stale deliveries are acknowledged and removed without waking the successor.
  • Managed artifacts remain exact-session-ID bound; logical return authority
    cannot broaden their ownership boundary.

The authority table is independent of transient session rows so an absent
target can receive durable authority before first materialization. Migration
accepts only valid UUID generations, and Doctor's canonical-key repair
preserves an epoch only when a unique winning owner can be proved. Ambiguous,
owner-changing, orphan-colliding, and cross-database repairs rotate
fail-closed.

RFC

Full design document: docs/design/continue-work-signal-v2.md — covering problem, solution, implementation, platform integration, configuration, observability, safety, production use cases, testing evidence, and appendices.


Configuration

The shipped configuration surface for the continuation feature, under agents.defaults.continuation in openclaw.json:

Key Default Purpose
enabled false Master opt-in; feature is off unless explicitly enabled
maxChainLength 10 Per-chain recursion guard
maxDelegatesPerTurn 5 Width cap per turn
costCapTokens 500000 Per-chain accumulated-token budget
defaultDelayMs / minDelayMs / maxDelayMs 15000 / 5000 / 300000 Continuation timer bounds
contextPressureThreshold 0.8 Pre-compaction warning threshold (optional)
earlyWarningBand 0.3125 Early-warning band multiplier (0 to disable)
crossSessionTargeting "disabled" Default-deny gate on cross-session delegate targeting (see below)

crossSessionTargeting — cross-session delegate targeting policy

continue_delegate exposes recipient-addressing on its model-facing schema: a delegate's return can land at the dispatching session (default), one named session (targetSessionKey), multiple named sessions (targetSessionKeys), every ancestor in the spawn chain (fanoutMode: "tree"), or every known session on the host (fanoutMode: "all").

Cross-session targeting (anything beyond self-target or lineage routing) is gated by agents.defaults.continuation.crossSessionTargeting:

Value Behavior
"disabled" (default) Delegates can return to the dispatching session or use fanoutMode: "tree" for lineage routing. Explicit cross-session targeting (targetSessionKey to a non-self session, targetSessionKeys containing any non-self session, fanoutMode: "all") is rejected at the tool surface — no enqueue, no announce. Self-targeting is always allowed.
"enabled" All targeting modes are available, including same-host targetSessionKey, targetSessionKeys, and fanoutMode: "all".

fanoutMode: "tree" (lineage routing — return up the spawn chain) is available in both gate states; it is not cross-session targeting.

The gate addresses the model-controlled cross-session context-injection surface. With default-deny, operators explicitly opt in when their deployment model requires cross-session enrichment. Enforcement is live-read at four points: tool input validation, delegate dispatch, post-compaction delegate release, and bracket-syntax (response-token) spawn — so a config reload changes the next enforcement point without a gateway restart.

Trust posture on targeted returns: targeted delegate completion text is delivered as trusted: true system events. The delegate was spawned by the gateway under operator-configured policy, and its return is a first-party enrichment event — not external untrusted input. The crossSessionTargeting gate is the policy boundary for that decision: when an operator opts in, the receive path is internally trusted.


Observability — multi-span OTel trace stitching

The continuation feature emits OTel spans for the load-bearing lifecycle events. traceparent propagates through every continuation hop so reviewers see a single trace tree spanning the full chain rather than orphan runs.

Spans emitted (all in openclaw.* or continuation.delegate.dispatch namespace — no platform/OTel-semconv emissions):

Span Emitted when
openclaw.run Each agent turn (root + every continuation/delegate-spawned child run)
continuation.delegate.dispatch Each continue_delegate consumption from the custody store (one per delegate hop)
openclaw.harness.run, openclaw.context.assembled, openclaw.model.call, openclaw.model.usage, openclaw.tool.execution Existing per-turn observability surfaces, parented under their openclaw.run
image

Real behavior proof

Behavior or issue addressed: Sessions can elect future work with
continue_work, dispatch bounded background work with continue_delegate,
and request guarded compaction with request_compaction. The runtime preserves
budgets, restart recovery, finalization ownership, and trace lineage across
those boundaries.

Historical proof head (2026-11-05): a22bd9c05c4a7a9c86e72a132cb7939e399104cb
(tree 53363f7964f31a47109cf0575aa23f31eefa0338). The receipts below
are preserved for that exact head, not claims about the current PR head.
The current head and its separate evidence are identified in ## Evidence.

Receipts bound to this exact head

Each is a separate receipt in the preserved exact-head packet,
PROOFS/a22bd9c05c…/
(docs main at 9ba5518b).

gate ruling scope
Recipient-authority row (R-CD-RECIPIENT-AUTHORITY) PASS-candidate (docs#620 comment 6651745479) the gate-3 fire only; the row stays partial until a corpus fold review
Mode-B and the locally run cut shards PASS-candidate (karmaterminal/openclaw#1271 comment 6653747059) the candidate-owned regression gate; it doesn't claim Mode-B was green
Fold source review of the 2907e656 → a22bd9c05c delta PASS-candidate (#1271 comment 6655365352) source review only

Mode-B 41927761314
ran on product a22bd9c05c4a7a9c86e72a132cb7939e399104cb with workflow
a768f04231bd0a6f94cc7b845aecaec28a4a4c9e, from 2026-11-04 22:43Z to
2026-11-05 04:47Z. It finished terminally non-green: 91 jobs (53 succeeded,
27 failed, 3 cancelled, 8 skipped) and 218,033 tests passed / 220 failed.

  • Its receipts are valid, routed equals planned, and every hosted job ran on
    the project's own runner pool.
  • Its 64 distinct failing tests are exactly the previous accepted head's set
    (the same sorted-set sha256 185b6dea…), and none is new.
  • The four shards the workflow cuts at 90 minutes were run locally at this
    exact SHA, serially with one worker:
    • two were clean;
    • two carry only baseline or test-order failures, each classified in the
      receipt with counterfactual runs.

Packet status: preserved, NOT acceptance-complete, NOT terminal. Of 37
required rows, 0 pass, 1 partial (the recipient-authority row above), and 36
missing
. No live row has fired at this SHA, because no deployment runs it
yet: the deployed fleet is on a separate, older line. Running live rows here
needs a deployment whose runtime has this SHA as an ancestor. That is a
migrating cut (an agent-schema step), gated on its own timed restore rehearsal.
PROOFS/INDEX.json does not point at this packet, and nothing here is a
terminal rollup claim.

Earlier evidence: provenance, not exact-target proof

The live behavior observed on earlier heads, and the earlier corpora, are
ancestry and materiality evidence for this head. They aren't exact-target
execution, and no row is carried over from them as a pass:

The behaviors those corpora observed are the ones this feature exists for:

  • stale ambient backlog suppression;
  • typed and bracket continue_work wakes with granted provenance and Tempo
    model-call spans;
  • cost-cap rejection;
  • max-chain, scheduler, durable recovery and delegate surfaces.

They are re-fired against this head's runtime once one is deployed.

Proof links and ClawSweeper🦞 guidance

Proof artifacts live in karmaterminal/karmaterminal-openclaw-docs on main.

PROOFS METHOD

Live rows use a Grafana k6 proof harness. Each packet's METHOD.md carries the
exact reproducer commands. MAX_WORKERS=1 is mandatory for the vitest
reproducers, because OpenClaw's fixtures are not safe under concurrent access.
Structural completeness is not proof: a row counts only with an authoritative
receipt at the exact SHA.

Future actions and #130741 composition

Maintainer PR #130741 addresses the complementary fresh-sweep race: it captures
the current sessionId and lifecycleRevision before the first await and uses
those values as cleanup CAS facts. The return covenant addresses a different
time axis: whether historically accepted child work may return to a logical
recipient after benign successor creation.

The current candidate and #130741 head e1afc703f49a07687c0876ba6350cafa87a3638a
merge cleanly in a synthetic composition. If #130741 lands, the composed result
should preserve both guarantees:

  • keep fix(agents): reconcile subagents through scoped session owner #130741's fresh sweep-time exact-run/session lifecycle fence;
  • keep the covenant's durable logical-recipient generation for historical
    return admission and delivery;
  • do not overload broad lifecycleRevision as historical return authority;
  • do not terminate or orphan accepted descendants merely because /new or
    ordinary /reset creates a successor session.

That composition honors the maintainer repair without weakening continuation
semantics or allowing a stale child return to cross a real ownership boundary.

Why this is not a skill or a viable plugin extraction

OpenClaw skills are SKILL.md prompt files loaded into an agent turn that already exists. They can guide work inside that turn; they do not own the turn cycle.

Continuation needs gateway and agent-runtime owners a skill cannot provide:

  • The continue_work path persists pending work, enforces budgets and delay bounds, arms a timer, reacquires the session reply-run lane, and starts a later model turn after the current turn has finalized.
  • The continue_delegate path persists delegate intent, does spawn/admission accounting, manages child-session lifecycle, and durably routes returns across sessions.
  • request_compaction is an agent election into guarded runtime compaction. Later work resumes only after the runtime has established the new context boundary.
  • All three need durable state, cancellation/finalization ownership, restart recovery, trace identity, queue-conflict handling, and gateway scheduling outside the model invocation.

A skill can tell a model to ask for another turn. Without those owners the ask is prose: it cannot persist a due wake, yield and finalize safely, reacquire the session lane, create the next invocation, survive a restart, or deliver a child result to another session.

The implementation therefore belongs in core runtime surfaces such as src/auto-reply/continuation/**, src/agents/tools/**, src/auto-reply/reply/agent-runner-continuation-schedule.ts, and src/infra/continuation-tracer.ts. This PR adds no .agents/skills/**, SKILL.md, or user-facing skill package. The only skill-named production change is core runtime tool dispatch.

ClawHub also distributes plugins. Existing plugins can register tools, services, lifecycle hooks, context injection, plugin-owned session state, and — for bundled plugins — Cron-backed session turns. Those seams can support a smaller continuation-like automation, especially host Cron plus / sessions_spawn. They are not this feature's turn-finalization ownership, reply-run coordination, durable continuation queue, child-session return lifecycle, election capture, or agent-elected compaction contract. Compaction-provider registration and command-handler compactCurrent() are also not that last contract: they compact or summarize, they do not elect compaction at finalization and resume afterward.

Moving policy behind a plugin boundary would first require OpenClaw to expose
and stabilize a continuation-host API. The gateway/runtime would still own the
mechanism described here; a plugin could only package policy around that core
capability. That is not a no-core-touch alternative to these primitives.

Discord is a bundled channel plugin. It owns the Discord edge, plus delivery/progress hooks into the host's existing subagent path, and submits events into OpenClaw's current turn machinery. Continuation changes that machinery: what survives finalization, which session may run next, how child results return, and when compaction can be elected.

A tool adapter over durable flow records is also not a lifecycle host, and upstream has since removed the Tasks/TaskFlow runtime (#159179) that such an adapter would have called. Marking a stored record as running neither reacquires a session lane nor invokes the model; continuation needs the turn machinery itself to own which session runs next, how child results return, and what survives finalization.

Lineage and replacement context

This PR is the clean replacement for closed #85651. It preserves that PR's
review lineage and the earlier continuation work descended from #79925, but it
does not reuse either closed PR or ask reviewers to infer the current result
from them. The replacement carries a current, independently reviewable branch
and a complete proof subtree bound to its presented SHA.

#85651 was not abandoned because the feature failed or because we accepted its
classification as a skill. It was closed after automated labeling put the
change in the wrong submission category. This replacement removes that
ambiguity: no src/skills/** change is presented, current label simulation
produces no r: skill, and the detailed section above explains why the
lifecycle mechanism belongs to core.

Acceptance or rejection of the product direction remains OpenClaw's decision.
The decision requested is whether OpenClaw should provide multi-session,
agent-elected continuation primitives after reviewing the implementation and
evidence. It is not whether the same mechanism can be relocated into a skill:
a skill cannot own or implement these lifecycle boundaries.

Evidence

What this PR solves. Persistent agents act only when something prompts
them, and what survives compaction is whatever the summarizer kept. This PR
lets a session elect its own next turn (continue_work), send work to
background sub-agents whose results return to it (continue_delegate), and ask
for compaction once it has saved its state (request_compaction). It is
designed so that accepted work survives restart, compaction and session
rollover. The checks below cover regressions at this exact head; its live
behavior proofs are still pending (see the end of this section).

Head checked: a329243bd1aa4e8677517a5eaf4a67aa30ca8647, which carries
upstream main at 5a3e6b1cb09bb886c4f9760d5d155353131e823a. It
fast-forwards the previous head, 16541aa5, by 11 commits: a merge of upstream
main (473 upstream commits past 1129d4c0, 24 conflicting paths resolved),
three fixes for merge semantics, one product fix (below), and six updates to
tests, generated files and recorded budgets. "The intermediate candidate" below
means 8fbf29f2, this head without its last two commits, which this PR never
presented.

Result: not green, and no failing test is attributable to this change.

  • Full CI run (the fork's Mode-B, run 45008617882, 2026-11-22): 257,852
    tests passed and 117 failed. The failed count includes confirmation retries;
    72 failures are deterministic. All 72 failing tests (23 files) are classified:

    • 24 tests in 8 files also fail at upstream. Six of them were reproduced at
      upstream 5a3e6b1c; the other 18 were reproduced at upstream 1129d4c0
      during an earlier head's classification.
    • 48 tests in 15 files fail because of the CI host environment, for example
      no Chromium, no systemd user bus, a 64 MiB /dev/shm, no bun or
      setfacl, a fixture guard that stops at the host's dirty-memory level, or
      a checkout path long enough to overflow one exec argument. Three of these
      tests (2 files) have no reproduced trigger.
  • One failure found at the intermediate candidate is fixed here. Its full
    CI run failed upstream's agent-deletion test from fix(agents): finish deletion when personal pins change #203076
    (server.agents.config-readiness.test.ts, "finishes agent deletion when
    personal pins change during cleanup preparation"). This branch takes the
    maintenance pins snapshot after the preserve providers prepare (abc9ce5b),
    so a pin written during that preparation no longer refused the deletion
    attempt. bd709979 restores the refusal for agent deletion only; automatic
    maintenance keeps its ordering. Upstream's test is unchanged. It and a new
    test for a pin written while a provider prepares fail with only the fix
    reverted, on Bun and Node 24, and pass with it. Both pass in this run.

  • Two shards hit the batch time limit, so parts of this run are unproved:

    • extension-database-workers was cut at 5,239 s, as in every run so far,
      and is unproved at this head. Its output before the cut covers 414 test
      files, about half of the shard, with one failing test,
      extensions/tlon/src/monitor/index.test.ts, which also fails at upstream
      1129d4c0.
    • compact-large-30 completed all 5 of its sub-shards in its first attempt.
      Its one failure there was a Vitest worker killed with SIGKILL while running
      src/gateway/server-http.event-loop-health.test.ts, an environment row
      classified at the earlier heads (no reproduced trigger; it passes locally at
      an earlier candidate and at upstream 1129d4c0). The shard retried, hit
      the same kill in the same file, and the batch limit cut the retry at
      5,338 s.

    Neither shard wrote a summary, so their tests are not in the totals above.

  • Static checks: 40 of 41 pass. The failure is the baseline-ratchet row,
    which hit its 20-minute limit. CI runs the ratchets against the fork's main
    (7ce2d10e), not against upstream:

    • session-identity reports 31 files over its allowlist. Run locally
      against upstream 5a3e6b1c, it reports the same 31 files as at the previous
      head, so the excess comes from this branch's changes. It is unchanged and
      open for review.
    • test-lines was stopped by the row's limit before it reported. Run
      locally against upstream 5a3e6b1c, this head passes it: +114,436 lines
      against an allowance of 114,317 + 400.
    • The other 10 ratchets pass, in CI and locally.
  • Focused checks at this head: core, test and scripts type checks are
    clean. The full type-aware lint reports the same findings as upstream, apart
    from one line count in a file that already fails there. There are no import
    cycles, and the plugin-SDK declarations are byte-identical to the
    intermediate candidate's. The fix's 57 sibling suites (agent deletion,
    session maintenance and pin preparation) ran with 0 failures on Bun and on
    Node 24.21; the two PostgreSQL-backed suites among them skip there.
    For the merge itself, 76 pinned test files and a 1,429-file matrix ran on
    both runtimes. Every failure there was classified, and the ones the merge
    caused are fixed in this branch. One generator check fails because of this
    branch and is not fixed here: native:i18n:check, for three untranslated
    Android tool labels (Continue Work, Continue Delegate, Request Compaction),
    present since 16541aa5.

Not yet run at this head: the live proof rows (real agent turns through a
running Gateway). The upstream window changes paths they exercise (the system
prompt, delegate result delivery and restart, and detached re-entry), so they
must run again here. They're pending and will be added to this PR once they've
run. The Real behavior proof section still describes earlier heads.

Run identities, classification, the fixes, and coverage details
  • Identities. Product a329243bd1aa4e8677517a5eaf4a67aa30ca8647, upstream
    base 5a3e6b1cb09bb886c4f9760d5d155353131e823a, CI workflow
    105e83abf9c3d328695e022779d75cb556fdc275. The full run 45008617882
    (created 2026-11-22 09:39Z) and the intermediate candidate's run
    44990430565 (at 8fbf29f25f3fba75a2ed964f4fabc611598b9e52, 05:40Z) live in
    the fork's private CI repository, so they aren't linked. Both receipts were
    validated against their product and workflow SHAs. The intermediate run had
    264,128 passed, 116 failed and 71 deterministic failures.
  • How failures were classified. The 72 are the run's aggregate failure
    list, which equals the failure lines extracted from its job logs. The two cut
    shards' in-flight output adds two more rows, the tlon test and the
    event-loop-health worker kill, described above. 69 of the 72 tests (21 files)
    also failed at the previous head, 16541aa5, with the same titles and the
    same first error, and keep the classification made there: paired local runs
    at an earlier candidate and at upstream 1129d4c0 (one worker, isolated from
    any live Gateway), plus one-variable controls for the environment rows with a
    reproduced trigger. The 9 test/scripts-update-gateway-legacy.test.ts
    failures, counted as upstream above, also stop at the missing systemd user
    bus; their upstream reproduction ran without one too. Three tests are new at
    this head: the two upstream ones below, and a third
    test/scripts/team-shape-fixture.test.ts case that stops at the same
    dirty-memory guard, with the same error, as its two siblings.
  • The six reproduced at upstream 5a3e6b1c. Each ran 10 times,
    interleaved, at this head, the previous head and upstream:
    • src/config/zod-schema.core.test.ts (1) and
      test/scripts/installed-terminal-observer.test.ts (1): red 10 of 10 at
      this head and at upstream with CI's exact assertion, green at 16541aa5.
      Upstream source changes in the merged window (feat: move Code Mode, Tool Search and Templates out of Labs #203096, and a regenerated
      runtime probe) left each test stale. Both tests are byte-identical to
      upstream's, and upstream has since fixed them (test(config): expect Templates to default on in schema help #203416, fix(ci): recognize the current installed daemon runtime probe #203415).
    • extensions/browser/src/browser/chrome.headless-cleanup.test.ts (4): red
      10 of 10 at all three refs on an arm64 host whose CPU model isn't Apple.
      The test names its fake browser cache from process.arch, while the
      resolver picks the macOS directory from the CPU model. Mocking only that
      model to "Apple M2" makes all 45 cases pass at all three refs. CI fails it
      whenever this shard lands on an arm64 runner, as here, and passed it on
      x64 at the intermediate candidate. This PR changes no file in
      extensions/browser/.
  • The intermediate run's other new failures don't recur here.
    sessions.dispatch.device is order- and timing-dependent: in CI's file order
    it fails at upstream 5a3e6b1c with CI's exact error.
    setup.memory-import.owner is an environment row with no reproduced trigger.
  • The fixes.
    • bd709979: prepareSessionMaintenancePreservation gains an option, set
      only by agent deletion (purgeDeletedAgentSessionEntries), that reads the
      pins before the preserve providers prepare. If that publication changed by
      the time they finish, the attempt is refused before anything is captured,
      dispatched or committed. fix(agents): finish deletion when personal pins change #203076's existing once-only retry then prepares
      again, which is the second preparation upstream's test expects. A second
      new test pins the existing check for a change after the snapshot. Two
      mutation controls fail as expected: removing that check, and opting
      automatic maintenance into the new refusal.
    • The three merge-semantics fixes: the branch's post-coordination recheck
      now asks fix: deliver child results before older descendant cleanup finishes #203102's settled-delivery question; continuation re-entries go
      through fix(session-events): wake yielded worktree turns after their first turn ends #203113's runOutsideAdmittedTurnScopes, so they also drop the
      arming turn's workspace gate; and two clean merges that each side
      half-moved are settled. The first two each tighten an existing test so
      that it fails without the fix.
    • The two failures fixed before 16541aa5 (by 2218b2b7, abc9ce5b and
      ae47d143) stay fixed: both original tests pass in this run.
  • Diff attribution. A line-level attribution of the intermediate
    candidate's diff against upstream attributed all 172,122 added lines to this
    feature, with none from the fork's deployment line. The deletion fix changes
    four files: two session-maintenance source files, their test, and this PR's
    test-line record.
  • Shard coverage. 128 of the 130 routed shards wrote summaries; the two cut
    shards are described above. The event-loop-health test and the stall
    observer that issues the kill are byte-identical to upstream 5a3e6b1c, and
    the same kill occurred in the previous head's and the intermediate
    candidate's runs. At the previous head, a full local run of
    extension-database-workers paired with upstream 1129d4c0 matched
    upstream's two failures. That run hasn't been repeated at this head.
  • Not covered:
    • the rest of extension-database-workers at this head (about half of its
      test files);
    • the two PostgreSQL-backed suites in the deletion fix's sibling set
      (mixed-agent-lifecycle.conformance,
      session-accessor.sqlite-maintenance-age.postgres), which skip in this CI
      run as they do locally without PostgreSQL. The last PostgreSQL conformance
      run (38 files, on CI's pinned image) was during the merge, before the
      deletion fix: 210 tests, with 1 failure that upstream shares;
    • the live proof rows;
    • CI's 4-worker interleaving for the rows with no reproduced trigger (the
      local controls ran with one worker).

@clawsweeper

clawsweeper Bot commented Aug 25, 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 docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web app: web-ui App: web-ui gateway Gateway runtime extensions: diagnostics-otel Extension: diagnostics-otel cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling channel: feishu Channel integration: feishu extensions: acpx extensions: anthropic extensions: qa-lab extensions: codex plugin: google-meet extensions: senseaudio extensions: tts-local-cli plugin: file-transfer extensions: google extensions: ollama extensions: copilot extensions: clawrouter Extension: clawrouter labels Aug 25, 2026
scribe-dandelion-cult and others added 19 commits November 20, 2026 15:38
…e type narrowed

aa67d24 dropped one union member from continuationLineageMissing on
the published SubagentRunRecord. Clean `pnpm build` at aa67d24:
5,403,948 bytes (was 5,403,979); upstream 1129d4c stays 5,382,601.
Net continuation delta 21,347: fix-2b's 20,933 plus 414 bytes for the
lineage field and its doc comment. The 1207f6c leaf move added none
(5,403,979 at e75ef44, as at c93c948).

MAX_PUBLIC_PLUGIN_SDK_DECLARATION_BYTES 5,341,378 -> 5,341,347
(5,320,000 + 21,347); candidateBytes 5,403,948. Upstream's 2,935-byte
headroom is kept exactly: the real check-plugin-sdk-exports on this
build's dist passes with 2,935 bytes appended (5,406,883/5,406,883) and
fails with 2,936 (PLUGIN SDK DTS TOO LARGE).

Pins: GREEN 3/3. RED with 5,341,378 and 5,340,933 (the earlier
ratchets), a blanket 5,400,000, the delta moved into the variance
window, and 5,341,348 / 5,341,346.

Refs openclaw#129388
…rd after the lineage review pins

aa67d24's pins add 43 net lines to restart-terminal-custody (the
unbound table over two reasons and the final-failed-delivery pin). The
record states the lane's exact measured net, now +408 (Task A +234,
Task B +126, fix-2b +48), as the fork's other continuation records do.
Pending review; no approval claimed.

Refs openclaw#129388
…, not intentional non-delivery

🌊's steer on 2430767 (msg 1573451554558713959): a requester session
that is missing right now does not make the outcome a deliberate,
terminal suppression. Keep a durable, diagnosable unresolved-lineage
record and warn, unless the requester is positively known to be
permanently ineligible under an existing terminal policy. Not pending
forever, not silently closed; stop for review if it needs a new state.

It needs none. The existing `suspended` delivery state already means an
owed outcome that automatic delivery cannot complete. Restart discovery
and restart completion recovery never admit it; the announce flow and
resumeSubagentRun never retry it. The sweeper keeps it for
SUBAGENT_SUSPENDED_DELIVERY_RETENTION_MS (7 days) and counts it toward
the suspended-backlog warning, then discards it as expired with a
warning that names the run and its lastError. It is neither
suppressCompletionDelivery nor intentional_non_delivery.

Restart activation still records an unbound row
(continuationLineageMissing.unresolved: requester session missing, or
requester agent unresolved) and warns, and now suspends its delivery:
suspendedAt at the decision, lastError "lineage missing; no requester
binding (<reason>)", no disposition (no transport ran), no suppression,
cleanup left unfinished. No cleanup flow starts for it. In an
in-process restart, starting one from the settled pre-image re-armed
delivery as pending with retry attempts to the missing requester.

Intentional non-delivery stays only where the requester elected to stop
the delegate (settleOwnerlessContinuationChildren's stoppedByRequester,
which mirrors the finished kill). Such a row never reaches the lineage
decision. A missing binding is no such policy, so both unbound reasons
are suspended.

When retention ends, the discard's existing notice
(recordRequiredCompletionNotice "expired") writes its display-only
"child result couldn't be delivered" report to a session at the
recorded requester key if one exists then; otherwise it only logs.
continuationLineageMissing and its published declaration are unchanged,
so the plugin-SDK ratchet stays.

Pins (item 7), on Bun and Node 24:
- unbound, both reasons: unresolved record and warning; delivery
  suspended, not suppressed or intentional non-delivery; a second
  restart and its sweeps change nothing; at retention end, a warned
  discard, plus the discard's notice only where a requester session
  exists. RED x2 at c9f4be9 (not_required, intentional_non_delivery);
- in-process restart: the same suspension, no delivery attempt. RED at
  c9f4be9, and RED with this fix minus the cleanup skip (pending,
  attemptCount 1);
- the requester elected to stop it, requester and lineage both missing:
  intentional non-delivery, no lineage record. A guard: GREEN at
  c9f4be9, RED when the lineage decision stops skipping suppressed
  rows;
- the follow-up's bound pins (four return modes, once-only, crash,
  final-failed) unchanged. 27/27.

Refs openclaw#129388
…r the unresolved-lineage pins

1146081's pins add 115 net lines to restart-terminal-custody (both
unbound reasons suspended rather than closed, through a second restart
and the retention discard; the in-process variant; the requester's stop
election with lineage and requester both missing). The record states
the stacked change's exact measured net against 8ba4ee8, now +523
(Task A +234, Task B +126, fix-2b +48, this steer +115), as the fork's
other continuation records do. Pending review; no approval claimed.

Refs openclaw#129388
…e in the unbound-lineage pin

tsgo's core test shard (agents-sessions) rejected 1146081's pin:
loadTranscriptEvents returns unknown events, so reading .type needs
isRecord first, as the store-replaced pin does. No behavior change;
27/27 on Bun.

Refs openclaw#129388
…l shows

Review of 1146081: the comments, the RFC row and item 7 said that
"nothing is sent" for an unbound lineage-missing outcome. Upstream's
readers treat a suspended outcome as owed to a session at the recorded
requester key. hasOutstandingCompletion lists it in that session's
runtime facts while it is suspended, and the sweeper's discard sends
that session its display-only expiry notice (the unbound pin already
asserts that). The text now says so: no lineage notice and no delivery
attempt or retry, but listed for, and an expiry notice to, a session at
the recorded key. Whether an unbound row should reach that session at
all is the state-model question posted for review. No behavior change.

The test-line record moves to +527 (this steer +119, including the
isRecord narrowing in 2cc5e2a).

Refs openclaw#129388
…to no session (T1)

🌊's ruling (msg 1573507310813188097): `suspended` alone still treats
the requester key as a recipient, which violates no-guess. A suspended
delivery plus continuationLineageMissing.unresolved is now a distinct
semantic state, suspended-unbound (isDeliverySuspendedUnbound). No new
field, value, codec or migration: the discriminator is the record
restart custody already writes.

Every reader of a suspended outcome that treats it as owed to a session
at the recorded requester key now skips it:
- hasOutstandingCompletion: no "Child results awaiting delivery" fact;
- pending descendant counts (countDescendantRuns): nothing waits on it,
  so a later subagent session at that key is neither deferred nor kept;
- the fork's reset retention: no reset on that key marks it retained;
- session-store maintenance: it protects no session (its child entry is
  gone and nothing at its requester key is owed it);
- the suspended discard: a warned discard, no expiry notice.

The descendant counters read the session-list projection, so that
projection now carries continuationLineageMissing (two SQL leaf paths,
the projector, and the field moves to SubagentRunReadRecord, the
persisted fields shared by compact reads and full records). The
maintenance projection carries it too.

Activation restores rows but never started the sweeper, so a 7-day
bound depended on something else spawning. settleContinuationRestartCustody
now starts it whenever activation holds a suspended-unbound outcome,
recorded now or by an earlier lifecycle.

Pins (item 7), RED at 3862298, GREEN here:
- unbound x2 reasons: survives a second restart, nothing re-owed, and
  the sweeper's own scheduled tick (fake setTimeout, nothing else
  starts it) discards it at retention end with a warning and no notice,
  even where a session exists at the key. RED: still suspended;
- key reuse: a later session at the requester key gets no runtime
  fact, no pending descendant, no reset retention mark, no maintenance
  protection and no expiry notice. RED: runtime facts list it.

Refs openclaw#129388
…tcome

0cac64d's key-reuse pin runs in the Gateway, where both readers see
live rows. A process that reads the registry from SQLite goes through
the session-list and maintenance projections instead, so pin those:
- countPendingDescendantRuns over persisted rows counts the bound
  suspended outcome and not the unbound one;
- session-store maintenance protects no session for the unbound one,
  restored or live, while the bound one keeps its child and requester.

Refs openclaw#129388
… owed to no session

3862298's §5.4.4 boundary 5 row said an unbound outcome stays listed
for a session at the recorded requester key and that session gets the
expiry notice. Under 🌊's T1 (0cac64d) it is suspended-unbound: owed
to no session, so a later session at that key gets no runtime fact,
pending descendant, reset retention or maintenance protection from it,
and activation starts the sweeper, which discards it with a warning
and no notice when suspended-delivery retention ends.

Refs openclaw#129388
…ime fact and settle wake

Independent review of 0cac64d found two more ways a later session
at the recorded requester key still reached the unbound outcome:

- Runtime facts. Skipping it in hasOutstandingCompletion only moved it
  from "Child results awaiting delivery" to "Recently Completed
  Subagents" (run=<id>; delivery=suspended) for 30 minutes after the
  restart. The runtime-facts block's visibility now excludes it, so it
  appears in neither section; hasOutstandingCompletion is upstream's
  again. Explicit inspection (/subagents, the subagents tool) still
  shows the retained record.
- A requester settle wake. Continuation delegates carry their electing
  turn (delegate-dispatch.ts requesterTurnRunId), so one can join that
  turn's yield batch. After an in-process restart the sweeper resumed
  that wake for the unbound row and delivered "Every subagent in this
  batch has now settled" with the child's result to agent:main:main,
  the later session. Restart custody now drops the wake with the
  binding when it records the row unbound (a real restart's discovery
  also admitted the key's session for it).

Also: the discard decides "unbound" before bookkeeping rather than
after, and the predicate's comment says what still shows the record.

Pins, RED on 7fa7581's production, GREEN here:
- key reuse: the later session's runtime facts do not contain the run
  id at all. RED: listed under Recently Completed Subagents;
- yield-batch wake: in-process restart, a later session at the key, 3
  sweeps: the wake is gone, no requester wake runs, no message. RED:
  the batch-settled message with the child result reached the key.

Refs openclaw#129388
…r the T1 pins

The T1 lane adds 145 net test lines over 3862298:
restart-terminal-custody +104 (the unbound restart and expiry pins,
key reuse, the yield-batch wake), the persisted session-list read +21
and maintenance +20. The record states the stacked change's exact
measured net, (HEAD - 1129d4c) minus (8ba4ee8 - 1129d4c):
+672 (527 + 145). The approval of +408 covered c9f4be9 only.
Pending review; no approval claimed.

Refs openclaw#129388
…pare

prepareSessionMaintenancePreservation read the personal-pins snapshot before
awaiting every preserve-keys provider. The continuation custody provider
(karmaterminal #1544) waits on storage there: a sessionDelivery.list read
and custody phase A. Any profile change during that wait outdated the pins
snapshot, so capture refused the pass ("personal session pins changed") and
the pass fell back to the write-quiet retry. That retry outlives a state
database close and can reopen the agent database during a later request's
session-fact discovery, where the registration commit invalidates the
request's registry witness (AgentDatabaseRegistryChangedError).

Read pins after the providers, so provider latency cannot outdate the
snapshot. Capture still refuses a pins change after that read, and commit
retention is unchanged.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e loads

The session lifecycle facade reaches the SQLite lifecycle owner through a lazy
import (68984b9). When that import first runs after a module-registry reset,
it evaluates a second session-history-budget-state module with its own empty
kick map. The delete's forced kick then saw running=false beside the upsert's
held scan and started a second scan, instead of leaving a pendingForce for the
running pass (disk-budget.physical-usage "joins real SDK mutation maintenance",
expected 2 to be 1).

Keep the per-store kick state in a process-global singleton, as the sibling
disk-budget worker owner already does, so a second module instance joins the
same owner. Production loads one instance per process, and the lazy boundary
and its source-scan test stay as they are.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e state worker

The continuation custody preserve-keys provider read pending continuation
rows (sessionDelivery.list) and awaited custody phase A through the state
worker on every session maintenance pass. In a process whose state worker
had not started yet, that first start stalled the pass for about 500 ms. The
start also delays every other state write queued behind it, so those writes
landed while the pass still held its personal-pins snapshot, and the pass
was refused into the write-quiet retry. In the Visitor Access reopen test
that retry reopened the agent database inside the reopened Gateway's first
tools.invoke, after session-fact discovery captured its registry witness
(AgentDatabaseRegistryChangedError).

The provider now asks the shared-state reader first
(continuationCustody.maintenanceState: is any session delivery pending, is
any custody record live). It reads rows and awaits readiness through the
state worker only for what the state holds, so a store holding neither
prepares the way it did before the custody provider existed. Live custody
still hydrates the projection before its owners are named, and the
projection stays the only owner of custody liveness.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r the final-head pins

The final-head fixes add 60 test lines: the maintenance-kick pin for a profile
change during preserve-provider preparation (+31) and the custody provider's
shared-reader pins (+29). The record now states 732, the exact net against
8ba4ee8. Measured net, not a cap; pending review.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…9388 stage 4)

Absorbs openclaw/openclaw main 5a3e6b1
(473 commits past the absorbed 1129d4c, which is the merge-base) into
16541aa, so openclaw#129388's presentation can fast-forward. rerere was off for
the merge; nothing arrived pre-staged.

24 content conflicts:
- Generated, regenerated rather than hand-merged: config-baseline counts
  and sha256 (config:docs:gen; core 2667 + fork 17 = 2684), gateway
  predicates.js (gateway:validators:gen), and the four PostgreSQL state
  catalogs (db:postgres:gen).
- package.json schemaVersions: state 41 (upstream openclaw#201615) with the
  fork's agent 44 (continuation's recipient-authority step; upstream's
  agent ladder is still at 43).
- plugin-sdk-surface-report budgets: upstream's +2 (openclaw#203044) plus the
  fork's unchanged +11 / +4.
- subagent-registry-queries: upstream openclaw#203102 folded
  excludeSuspendedDelivery into excludeSettledDelivery; T1's
  unconditional suspended-unbound skip stays.
- subagent-registry-suspended-delivery: upstream openclaw#202732 restructured the
  discard into discardExpiredSubagentDelivery with the expiry notice in a
  finally block; T1's suspended-unbound outcome still notifies no session.
- agent-runner-result-accounting, update-command-service-command,
  session-reset-service, assistant-answer-text,
  state-port.postgres.test, vitest.database-worker-core-paths: both
  sides kept (imports, openclaw#201615 permission checks beside the reset
  retention, openclaw#203174's Responses-only signed selection with the fork's
  per-item answers, both port fixtures, both worker-path lists).
- update-cli tests (openclaw#200578 deleted the in-place Git runner): upstream's
  deletions win; the fork's compiler-flag argv matchers are carried onto
  upstream's rewritten checks.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…led-delivery question

Upstream openclaw#203102 (2e1d67c) folded the descendant read index's
excludeSuspendedDelivery option into excludeSettledDelivery: a descendant
whose delivery settled (suspended, delivered, discarded, not required, or
a terminal disposition) may still hold cleanup, but no longer holds its
requester's completion. Upstream's own completion gate in
runSubagentAnnounceFlowBound moved to the new option.

The fork's recheck after coordinateSubagentContinuation mirrors that gate
(7500944: "Pass excludeSuspendedDelivery like upstream's gate"). The
merge left it passing the removed option, which tsgo rejects (TS2561). It
now asks the same settled-delivery question, so a child with an older
delivered descendant awaiting cleanup is no longer held "retryable" by the
fork path after upstream stopped holding it.

Pin: the "routes ended parent" format e2e cases reach this recheck. Their
countPendingDescendantRuns mock answered 0 for any options object, so it
could not tell which question was asked; it now answers 0 only for
excludeSettledDelivery. RED with the recheck passing no settled option
(3 of 5 cases "retryable"), GREEN with this change (5/5).

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ce gate too

Upstream openclaw#203113 (582f5d4) renamed runOutsideAdmittedGenerationScopes
to runOutsideAdmittedTurnScopes and made it the single entry point for
detached work re-admitted when it runs: besides the inherited plugin
generations it now drops the starting turn's workspace-readiness gate,
which fails once that turn ends ("Session changed while preparing its
project"). The merge left the fork's runOnCurrentPluginGeneration
importing the removed name (tsgo TS2724).

runOnCurrentPluginGeneration is upstream's helper plus the prepared reply
dispatch runtime, so it follows: continue_work timers, delegate hedges,
retained-operator wakes and terminal notices armed inside a deferred
checkout's first turn no longer carry that turn's gate into the re-entry.
Every caller already passes an async function, which the new signature
requires.

Pin: the #1550 detached-generation fossil arms its wake inside a retired
workspace gate as well and observes the gate in the wake. RED with the
pre-openclaw#203113 generation-only composition (workspaceGate: true), GREEN with
this change.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- status-message: the fork moved formatVoiceModeLine out (line cap) and
  upstream openclaw#203043 moved formatEstimatedContextBudgetTokens out; together
  they took the last reader of the SessionEntry type import (TS6133).
- followup-runner.test: upstream openclaw#202997/openclaw#203029 replaced the
  createSettledExecution fixture with createExecution("settled" default);
  the fork's suppressed-delivery ordering case follows (TS2552).

No behavior change.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e 4 absorb

db:worker-inventory:check was stale at the merge: upstream's new database
callers and line moves (its own committed inventory is stale against its
code at 5a3e6b1 as well). Regenerated with
database-worker-inventory.mjs --write; the check now passes.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… delta measured on upstream 5a3e6b1

🌊's ruling (a): the fork's ratchet is upstream's ratchet plus the exact
continuation growth, re-measured at each absorb. Clean `pnpm build`s
(build-all, OPENCLAW_BUILD_CACHE=0, dist removed, isolated from live
gateways, Node 26.12.1 on ronan), check-plugin-sdk-exports:

- upstream 5a3e6b1: 5,284,546 bytes (its own ratchet is still
  5,320,000; it shrank about 98 KB since 1129d4c's 5,382,601)
- stage 4 head 32285fa: 5,306,133 bytes
- continuation delta: 21,587 (was 21,347 over 1129d4c)

The 240 extra bytes are chunk repartitioning, not new surface: per
declaration name across all chunks, +121 import/export lines and +119
for GroupKeyResolution's placement; the 414-byte lineage field now counts
under SubagentRunReadRecord instead of SubagentRunRecord (net 0); ±2
rename suffixes. Ratchet 5,320,000 + 21,587 = 5,341,587, and the test's
measurement record moves to the current refs.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upstream openclaw#201615 (2b5f1a8) bumped the state schema to 41 and pinned
getOpenClawStatePredecessorSchema(40) to the sha256 of its own v40 schema
(fcbb0021…), so a v40 database stays recognized for the v41 step. The
fork's state schema also carries the continuation tables, so its v40
predecessor hashes differently, exactly as the file's other historical
hashes already do (the fork's comment beside them).

The invariant still holds for fork seats: the head's v40 predecessor is
byte-identical to the v40 schema the preceding build 16541aa shipped
(both e44990102d31…; upstream's pre-openclaw#201615 v40 is fcbb0021…). The pin
now names that hash. RED at e293165 (db:postgres:check's first step,
1 failed / 209), GREEN here (210/210).

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…me, not argv position

Upstream openclaw#200578 (b229b26) brought new command matchers into the
update fixtures through clean merges: mockGatewayInstallFailure and
runRestartFallbackScenario (update-cli-fixture.test-support.ts) and two
release activation fixtures in update-cli.target-schema.test.ts read
argv[1..3] positionally. The fork's update children carry the parent's
reviewed compiler flags before the entrypoint (#1546), so on Node those
positions hold flags: the failure injection and the restart health
priming never matched. Three update-cli.test.ts cases went red on Node 24
only (matrix chunk node24-04): "tries the updated install restart when
package service refresh fails in JSON mode" and both "uses the installed
Git CLI and owes the service refresh only when it cannot complete"
variants. Upstream 5a3e6b1 passes them on Node 24.

The four sites now use the fork's existing flag-tolerant matchers
(isCliCommand / isGatewayCommand, and compilerArgs.length + 1 for the
entrypoint position), as the fork's earlier update fixtures already do.
No assertion changed.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…4 absorb

The follow-up lanes' +732 re-measures exactly against upstream
5a3e6b1: their eight files carry the same fork deltas they had against
1129d4c. This lane adds +48, per file with check-test-lines-ratchet
semantics as (HEAD - 5a3e6b1) minus (16541aa - 1129d4c):

- +31 for the two semantic follow-up pins and the v40 predecessor pin
  (work-dispatch-authority.test-support.ts +26, work-dispatch.durable-7
  +1, subagent-announce.format.e2e +4, sqlite-schema-catalog-equivalence
  +2);
- +5 where upstream openclaw#200578's release fixtures now match commands by name
  (update-cli.target-schema.test.ts);
- +10 where openclaw#200578 deleted code the fork's compiler-flag matchers had
  shortened (four update-cli test files).

Record 732 -> 780. check-test-lines-ratchet --base 5a3e6b1: net
+114,370 against credit 114,251 + 400. Measured net, not a cap. Pending
review; no approval claimed.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iders prepare

Upstream openclaw#203076 finishes agent deletion when a personal pin publication
lands during cleanup preparation: the attempt refuses before commit and
deletion makes one bounded second preparation. The fork's CA-B (abc9ce5)
reads the pins snapshot after the preserve providers prepare, so a write
during that wait is folded into a fresh snapshot instead of refused, and
upstream's config-readiness pin sees one preparation, not two.

Deletion now opts into refusePinChangesDuringPreparation. It reads pins
before the providers and, if that publication changed by the time they
finish, refuses the attempt with SqliteSessionMutationConflictError
("personal session pins changed") before anything commits; the existing
retry in purgeDeletedAgentSessionEntries makes the second preparation.
The commit still uses the post-provider snapshot (shared, unchanged, when
nothing moved), and capture() keeps refusing a change after it.
Automatic maintenance and every other caller never set the option, so
they keep CA-B's ordering and no write-quiet retry returns.

session-agent-purge.test.ts pins both windows through the real purge,
preservation, pins and agent worker: a pin written while a provider
prepares (red at 8fbf29f: no second preparation) and one written after
the pins snapshot (the existing guard). Each asserts the store is
untouched at the second preparation and the new pin is protected from
the deletion's maintenance cap.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… pins

The deletion pins fix adds +66 to session-agent-purge.test.ts, measured
with check-test-lines-ratchet semantics as (HEAD - 5a3e6b1) minus
(8fbf29f - 5a3e6b1): one case per window, a pin written while a
preserve provider prepares and one written after the attempt's pins
snapshot.

Record 780 -> 846. check-test-lines-ratchet --base 5a3e6b1: net
+114,436 against credit 114,317 + 400. Measured net, not a cap. Pending
review; no approval claimed.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui clawsweeper-recovery-stuck cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: autoreview AutoReview plugin and integration extensions: codex extensions: diagnostics-otel Extension: diagnostics-otel extensions: xai gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. plugin: file-transfer proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security-review-required security-sensitive-changed size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants