Skip to content

fix(agents): reconcile subagents through scoped session owner - #130741

Closed
steipete wants to merge 3 commits into
mainfrom
codex/sweep-subagent-session-scope-20260826
Closed

steipete wants to merge 3 commits into
mainfrom
codex/sweep-subagent-session-scope-20260826

Conversation

@steipete

@steipete steipete commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Split landing progress

Twenty-nine focused fixes have merged while the remaining Swarm repair continues.

Each split receives independent review and exact-head required CI. Optional scanner acquisition or SARIF-upload failures are recorded separately and are not described as an all-checks-green result. The unchanged 500 ms responsiveness target has not yet passed; final composed-source, real-provider UI and active-deletion acceptance remain outstanding. Historical test and media evidence below predates these split heads and does not establish current acceptance.

What Problem This Solves

Subagent reconciliation could miss completed Incognito or secondary-agent children, and copied store snapshots could miss completion committed while a sweep awaited another child. Real OpenAI Swarm stress testing also exposed avoidable tasks.list instability: a session-scoped page scanned unrelated task history and could exhaust its revision attempts during churn.

The existing reset/cleanup hold identified a separate reachable ownership failure. If a failed collector launch's first cleanup attempt failed, a reset between sweeps could publish a successor that the old collector subsequently deleted. This refresh retains the scoped-reader repair and resolves that hold at the reset owner; it does not attribute the pre-existing between-sweep defect to this PR.

Why This Change Was Made

Reconciliation now uses one canonical loadSessionEntryReadOnly call with the child's agent, configured store, and session key. The whole-store reconstruction/cache plumbing and duplicate reader are removed. Completion metadata stays fresh across awaits, while cleanup retains the session ID and lifecycle revision captured before the sweep's first await, bound to the exact run object. New or replaced group members wait for the next pass.

Session reset now durably sets the existing terminal-run execution.suppressSessionEffects flag before publishing its next lifecycle generation. The existing lifecycle controller, completion lock, strict targeted persistence, and synchronous reset commit guard own this transition. A failed revocation blocks reset; a later reset-store or postcommit failure cannot revive deletion authority. Pending completion capture, retained kill claims, earlier memory-only suppression, missing-row recreation, and yielded continuations are covered explicitly.

Session-scoped task pages now enumerate the existing related-session index rather than global history. That index includes requester, owner, and child relationships and is maintained when they change. Global/cursor revision checks, 32-entry fairness, ordering before pagination, detached output, and final authorization remain intact. ACP generation lookup explicitly retains its former owner/child scope.

User Impact

Completed Swarm work is reconciled through its correct session owner, unrelated history no longer expands small scoped task scans, and delayed terminal cleanup cannot delete a reset successor. Swarm remains enabled by default; the existing 8 concurrent / 50 live / 200 lifetime / 600-second wait limits are unchanged. Code Mode remains a separate opt-in.

The maintainer explicitly accepted the fail-closed reset tradeoff: if revocation cannot persist, reset fails; if reset fails after revocation persists, the original session may remain with old cleanup suppressed. Reset asks the caller to retry when completion is still settling. Collector results, task outcomes, normal retention, unchanged-session retries, and active/yielded continuations remain available. Ordinary reset retains the session ID and transcript history while advancing the lifecycle revision/context boundary.

No schema, persistent field, config key, protocol, dependency, or public Plugin SDK surface is added. The assertion baseline changes only to record a removed assertion (4 → 3). No changelog is edited.

Evidence

Source and regression proof

The original cleanup hold was reproduced before editing with real collector registration, required task persistence, real SQLite stores, and real reset/delete handlers. The unchanged-session retry passed while reset-between-retries lost its successor. Additional failing regressions caught completion rollback, kill-claim resurrection, memory-only suppression, and yielded-continuation mistakes before the final repair.

The integrated candidate passed 703 tests across the standalone reset boundary suite and grouped registry, task, Gateway, and archive siblings, plus the full changed gate and a full build. Independent Codex autoreview found no actionable P0–P2 findings. The clean rebase retains every changed source/test/doc file byte-for-byte; current-main dependency/owner drift is separately checked.

The exact rebased head d13b7876e7b2702b73935acfa5eed5cafaaf21c2, above frozen main 903980a972d4ea2652290bcd7bc9a8f71ef7624a, passed a full build, 798 tests across 27 files, and all 30 changed-check stages. This includes 95 focused tests for relevant upstream owner/dependency drift. A fresh two-part Codex review was scoped-clean through P2. No source changes followed those checks.

Write-failure proof uses real temporary SQLite abort triggers. Reopen proof closes both database owners, clears in-memory registry/task state, and reloads durable rows. It is not described as an OS-kill crash experiment.

Real OpenAI stress

A session-owned local Gateway used isolated home/state/workspace/auth, loopback port 19489, no channels, and openai/gpt-5.6-luna with a real API key. The operator's Gateway and state were untouched. Source, complete build tree, exact Gateway boot, observer version, and parent/child/group identities were frozen and checked.

The original baseline matrix failed tasks.list: UNAVAILABLE during its second warm twenty-child burst; a separate baseline UI20 run reproduced the same error. Later independent observations found all children and parents settled, but neither failed trial was relabeled as passing.

The candidate passed native-tool collection and the complete nine-case Code Mode matrix: 2/8/9/20-child bursts, three additional twenty-child bursts, Stop with eight running tasks plus one queued task, and recovery afterward. Real UI20, Stop9, and recovery2 also passed. The queued child was never admitted; started children and the parent settled. Gateway task state is not claimed to prove eight simultaneous physical guest starts or OS-worker exit.

On the exact rebased build, unmodified managed Codex 0.153.0 completed two direct collector spawns, collected both structured results, emitted both exact child terminal events, and left parent/children idle in 13.741 seconds after Send. Its first observer attempt rejected Codex's toolResult content envelope because the decoder handled only plain text parts. The original history reproduces that decoder defect; a separate source-backed observer correction and one fresh live run passed without changing runtime, model, limits, or error/identity assertions. The original attempt remains failed.

A new synthetic-avatar UI recording pass also completed UI20, Stop9, and recovery2 with all 79 task-page requests successful. One normal child /clear action was acknowledged; separate read-only verification showed cleared context, persisted cleanup suppression, the still-completed task, and byte-identical cached collector completion. That extra reset script initially expected a new physical session ID, which is not the reset contract; its failed assertion is retained, and the separate readback—not a retried reset—established the resulting state. This is ordinary live reset proof, not a substitute for the SQLite write-failure/order regressions.

Performance and LOC

On canonical SQLite fixtures containing 1,000 completed sessions with 16 KiB prompts, the warm median selected-session read was 24.613 ms through the old whole-store path versus 0.109 ms through the canonical singleton. Parsed session JSON fell from roughly 16.8 MB to 16.8 KB per warm read. Real baseline main-thread profiles independently show full-listing/parsing work beneath collector completion and cleanup.

For a stable in-memory page selecting 20 related tasks from 10,000 total records, the bounded benchmark median was 5.001 ms versus 0.016 ms, and event-loop yields fell from 312 to zero. These are helper/selection measurements, not a claimed universal live Swarm speedup. Live model timings varied, and some validation shared the host; all original measurements and failures were retained.

Classification Added Removed Net
Production 192 137 +55
Tests/support 1,216 76 +1,140
Documentation 7 0 +7
Shrink-only assertion metadata 1 1 0

The production reduction goal was not achieved overall: the original reader simplification removes 39 lines, the approved durable ownership guarantee adds 79, and complete scoped task selection adds 15. The repair uses existing owners and persistence instead of adding another authority store, cache, or fallback. Removing the new ownership checks would weaken the accepted guarantee.

Historical sidebar-readiness and persistence-resume timing observations from the earlier PR proof remain separate follow-ups; this refresh does not claim to fix them.

Browser proof

These recordings use the real running Gateway, real OpenAI responses, the OpenClaw runtime, and synthetic task data. They were captured on the integrated build before the clean rebase; every changed source/test/doc file matches the rebased PR byte-for-byte. They are not presented as Codex UI recordings or as a live reproduction of the storage-fault race.

Twenty children complete and return the exact aggregate:

swarm-completion.webm

Stop cancels the active swarm, including its queued child:

swarm-stop.webm

Completed child before reset:

Completed synthetic collector child before reset

Same child after context reset; its old collector result remains retained in the registry:

Synthetic child after context reset

Earlier initials-containing recordings remain local and are not uploaded. The final fixture uses a neutral synthetic avatar through the normal profile API; it does not hide UI elements or alter rendered behavior. Agent transcripts and credentials are not attached.

@clawsweeper

clawsweeper Bot commented Aug 27, 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 agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Aug 27, 2026
@steipete
steipete marked this pull request as ready for review August 27, 2026 05:59
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 13, 2026, 8:12 AM ET / 12:12 UTC (Revision 21).

ClawSweeper review

What this changes

The branch reads child sessions through their correct storage owner, fences delayed cleanup across resets and waits, and bounds task-index scans when registry records disappear.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open as the maintainer-owned combined-acceptance tracker. The central repairs have landed separately, but the latest discussion explicitly retains the Swarm acceptance hold. No new blocking defect was established in the pinned patch.

Priority: P1
Reviewed head: 96f043a28b08124f5d8ad628e5e7d04bcd669696

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Sound owner-boundary repairs with useful real behavior evidence; the separate composed-system acceptance hold remains.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Historical real-Gateway observations and recorded SQLite reset/delete boundary results support the scoped repair, including successor preservation and unchanged-owner retries; inspected images corroborate visible reset behavior. They do not establish final composed-source acceptance, which remains an explicit maintainer hold.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Historical real-Gateway observations and recorded SQLite reset/delete boundary results support the scoped repair, including successor preservation and unchanged-owner retries; inspected images corroborate visible reset behavior. They do not establish final composed-source acceptance, which remains an explicit maintainer hold.
Evidence reviewed 12 items Pinned introduction: Inspected the merge-base-to-head production diff and numstat. The remaining task-query change bounds inspected IDs per batch; the broader related-session index implementation is already present in the base. Endpoint drift was not treated as PR authorship.
Session reader ownership: The reader passes agent ID, configured store, and child key to the canonical read-only accessor. The accessor resolves SQLite scope, including Incognito storage. Regression coverage includes secondary agents, custom stores, shared SQLite, opaque key case, and Incognito isolation.
Reset and final-effect boundary: Reset prepares registry hydration and invokes durable revocation from its synchronous commit guard. The lifecycle controller rejects settling completion, preserves active/yielded owners, and rolls back failed revocation writes. Cleanup retains captured session identity; the delete handler revalidates that identity and current ownership before mutation.
Findings None None.
Security None None.

How this fits together

OpenClaw’s subagent registry reconciles child execution with stored sessions and task outcomes. Its lifecycle and cleanup owners determine when completed work can be retained, reset, or deleted.

flowchart TD
  A[Child execution and stored sessions] --> B[Scoped session reader]
  B --> C[Subagent reconciliation]
  C --> D[Task outcomes and retained results]
  E[Session reset request] --> F[Durable cleanup revocation]
  F --> G[Publish reset generation]
  C --> H[Cleanup with captured session identity]
  F --> H
Loading

Before merge

  • Resolve merge risk (P1) - The final composed system has not yet demonstrated retained-state completion, Stop, recovery, and active deletion within the accepted 500 ms responsiveness target; historical passing trials do not settle the later failed stress case.
  • Complete next step (P2) - Complete the final combined-source build and retained-state Swarm acceptance against the 500 ms target before lifting the hold; keep the unchanged aggregate branch out of the landing path.
Agent review details

Security

None.

PR surface

Source +48, Tests +922, Docs +7. Total +977 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 10 154 106 +48
Tests 6 970 48 +922
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 1131 154 +977

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +48; tests/support net +922; docs +7 The pinned delta replaces snapshot reading and adds an accepted durable lifecycle boundary; the body’s older LOC totals describe a different revision.

Root-cause cluster

Relationship: canonical
Canonical: #130741
Summary: This PR retains combined acceptance; merged focused PRs own its component repairs.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the landed owner-level repairs and complete composed-system acceptance; durable pre-publication revocation justifies the remaining production growth without another store or fallback.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the landed owner-level repairs and complete composed-system acceptance; durable pre-publication revocation justifies the remaining production growth without another store or fallback.

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

No current-main failure was established in this read-only review. The original ordering and stress failures have concrete recorded reproductions, while the targeted repairs are now on main.

Is this the best way to solve the issue?

Yes for the owner-level design: canonical reads and durable revocation address the producers of stale cleanup authority; a downstream delete workaround would not. The appropriate integration path is the landed splits and combined acceptance.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8d37c8a52ff2.

Labels

Label justifications:

  • P1: Real Swarm stress exposed a failed child and storage contention, and combined acceptance remains explicitly held despite the focused repairs landing.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Historical real-Gateway observations and recorded SQLite reset/delete boundary results support the scoped repair, including successor preservation and unchanged-owner retries; inspected images corroborate visible reset behavior. They do not establish final composed-source acceptance, which remains an explicit maintainer hold.
  • proof: sufficient: Contributor real behavior proof is sufficient. Historical real-Gateway observations and recorded SQLite reset/delete boundary results support the scoped repair, including successor preservation and unchanged-owner retries; inspected images corroborate visible reset behavior. They do not establish final composed-source acceptance, which remains an explicit maintainer hold.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • VACInc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the final composed-source build and retained-state completion, Stop, recovery, and active-deletion acceptance against the unchanged 500 ms target, preserving failed trials.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (20 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-13T07:10:47.767Z sha 96f043a :: blocked before merge. :: none
  • reviewed 2026-09-13T08:11:28.918Z sha 96f043a :: blocked before merge. :: none
  • reviewed 2026-09-13T09:29:54.610Z sha 96f043a :: blocked before merge. :: none
  • reviewed 2026-09-13T10:17:04.192Z sha 96f043a :: blocked before merge. :: none
  • reviewed 2026-09-13T10:51:04.636Z sha 96f043a :: blocked before merge. :: none
  • reviewed 2026-09-13T11:12:33.870Z sha 96f043a :: blocked before merge. :: none
  • reviewed 2026-09-13T11:38:27.095Z sha 96f043a :: blocked before merge. :: none
  • reviewed 2026-09-13T11:51:07.491Z sha 96f043a :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Holding this PR for a confirmed lifecycle gap found during follow-up validation. The published head remains e1afc703f49a07687c0876ba6350cafa87a3638a; no additional source has been pushed.

The canonical failed-collector path can retain pending session cleanup after a transport failure. If sessions.reset completes after that sweep returns, the next sweep captures the replacement lifecycle revision and passes it to sessions.delete. The delete handler correctly accepts the supplied identity, but it is the replacement session's identity. The old collector therefore removes the reset session and archives its transcript.

The reproduction uses actual collector registration with required task persistence, settleFailedQueuedSubagentLaunch, registry/SQLite persistence, and the real Gateway reset/delete handlers. Only delete transport is controlled: the first attempt fails, then subsequent attempts reach the real handler. The unchanged-session control retries successfully; the reset-between-attempts case fails its preservation assertion. An independent run and a separate maintainer replay both observed that result. Source was main 9c2b86362030d33a3565068abab456dee5ae3821 plus the frozen local reconciliation candidate; this is not claimed as a newly introduced regression, a full Gateway/provider run, or stable-release attribution.

The relevant owners are subagent-registry-run-launch.ts (terminal row and pending cleanup), subagent-registry-sweeper.ts (recaptured deletion identity), and session-reset-service.ts (replacement publication). Reset's postcommit notifications do not revoke the retained registry row. The older ordinary cleanup: keep plus manually seeded archive deadline is not a production-reachability proof and is excluded from this finding; the canonical collector producer above supplies that evidence.

The local structural cleanup passes 269 owner/sibling tests and all 29 changed-file checks, with production +292/-301 (net -9). Those checks do not cover this between-attempt ordering and do not establish readiness to merge.

Proposed design for acceptance: the registry owner durably suppresses the outgoing terminal cleanup owners before reset publishes its replacement, using the existing execution.suppressSessionEffects contract. Preserve collector results, task outcomes, and active same-turn reset continuations. No new field, table, schema version, cache, or downstream delete workaround is proposed. Best-effort postcommit listeners are insufficient because persistence failure or a crash can leave stale cleanup authoritative.

This changes cross-store publication and crash semantics, so implementation is held at the persistent-store review checkpoint. The explicit tradeoff is that a crash after durable revocation but before reset commit may retain the original session with cleanup suppressed. Acceptance, rollback behavior, write-failure/restart proof, unchanged-owner retries, and active-continuation sibling coverage are required before proceeding. No approval or implementation is claimed here.

@steipete
steipete force-pushed the codex/sweep-subagent-session-scope-20260826 branch from e1afc70 to d13b787 Compare September 5, 2026 00:03
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XL and removed size: L labels Sep 5, 2026
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up to the reset/cleanup hold: the maintainer-approved pre-publication revocation design is implemented in d13b7876e7b2702b73935acfa5eed5cafaaf21c2.

The original failed-launch collector → failed first delete → reset → later sweep reproduction now preserves the successor. The existing lifecycle controller and synchronous reset guard persist execution.suppressSessionEffects before publication. Persistence failure prevents reset; a later reset failure cannot restore deletion authority. Real SQLite faults and reopen tests cover the accepted retained-session tradeoff, pending completion rollback, retained kill claims, memory-only suppression, missing-row recreation, and active/yielded continuations. No schema, field, configuration, or public SDK addition was needed.

The exact rebased head passed a full build, 798 tests in 27 files, all 30 changed-check stages, and fresh independent Codex review through P2. The full real-OpenAI Swarm matrix passed, as did completion/Stop/recovery in the actual Control UI. Inspected synthetic-only videos and reset before/after images are now in the updated PR body. Normal child reset was acknowledged, and separate read-only storage checks verified persisted suppression with the completed task and cached collector result retained.

Unmodified managed Codex 0.153.0 also passed a fresh two-child direct collector smoke on this exact build. The first observer attempt remains failed: it did not understand Codex history's toolResult content envelope. A separate decoder correction was checked against the actual producer and pinned upstream completion contract; runtime, model, budgets, identity checks, and substantive assertions were unchanged.

Production delta is +55: the original scoped-reader refactor is −39, the approved durable ownership repair adds 79, and indexed scoped task selection adds 15. Tests add 1,140. The PR body records the necessary ownership tradeoff and measured helper improvements without claiming a universal model-latency speedup.

The previous review is from August 27, and this refresh includes the accepted hold repair plus the task-selection improvement. @clawsweeper re-review

Exact-head CI and the native prepare/merge gates still precede landing; this comment is not a merge announcement.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 5, 2026
@steipete
steipete force-pushed the codex/sweep-subagent-session-scope-20260826 branch from d13b787 to 9bf4294 Compare September 5, 2026 01:39
steipete added a commit that referenced this pull request Sep 5, 2026
Persist terminal cleanup revocation before publishing a reset successor,
including previously best-effort suppression and missing-row recreation.
Preserve collector results, unchanged retries, and active/yielded continuations;
a later reset failure retains durable suppression rather than reviving cleanup.

Complete the existing requester/owner/child task index and use it for scoped
pages without weakening revision, cursor, fairness, or access checks. Together
with the retained scoped reader repair, this removes unrelated scan work from
Swarm completion and observation. No schema, config, or dependency changes.

Context: #130741
steipete added a commit that referenced this pull request Sep 5, 2026
Pass the resolved canonical session key directly to cleanup revocation instead of reparsing global aliases. Existing selected-agent rejection and lifecycle guards remain authoritative. Fixes the two global reset-hook failures exposed by PR #130741 CI; 476 focused tests and changed gates pass.
@steipete

steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Final live verification is holding this PR open at 9bf42940e021f083a9e99fb3f043c7ff7e72b6f8.

The global-session reset failure caught by CI was reproduced and repaired by removing redundant agent-ID parsing after canonical target resolution. The required rebase also preserved current-main restart recovery and reset-transcript header initialization. The combined candidate passed a full build, all changed gates, 877 regression tests, and fresh three-part independent review. None of that overrides the failed final live check below.

A new twenty-child Code Mode run on the retained isolated Gateway state produced 19 completed children and one failed child. The failed child hit database is locked; later read-only observation verified the parent and all twenty children idle. The original trial remains failed, and the matrix stopped before Stop/recovery.

Closed profiles and source identify a wait cycle in the existing SQLite reclamation owner: the cleanup worker waits for a parent-thread commit checkpoint while retaining the write transaction, while foreground synchronous transcript/trajectory writers block that parent thread on the same database lock. The sampled worker wait spans about five seconds; parent authorization is first sampled after that wait expires. This is sampled timing, not CPU accounting or an exact lock trace. The relevant checkpoint/reclamation code is unchanged between this candidate and inspected main 3e916e437c6cd08213e4487824c0c87111494575; no introduction is attributed to this PR. A real-SQLite boundary test has now reproduced the cycle twice: an unrelated synchronous append waited 5.106 / 5.142 seconds, succeeded after the worker rolled back, and deletion failed with the expired-checkpoint error. This reproduces the wait cycle, with deletion rather than the child append failing in the controlled ordering. The unchanged in-process branch preserves the live guard but took 3.517 seconds synchronously for 200,000 indexed rows, with a 3.520-second observed event-loop gap; the worker branch's observed maximum gap was 383 ms. These are single diagnostic measurements per fixture/path after archive preparation, not fleet guarantees. Moving guarded deletion wholesale onto the main thread would regress the existing 500 ms responsiveness bound and is not being adopted. A non-regressing checkpoint-coordination design remains under assessment. No production database code, retry, timeout, concurrency cap, or maintenance override has been changed; original database and sidecar hashes are unchanged.

Separately, the session-list availability repair landed independently on main and now overlaps this branch. The next refresh will remove duplicate source/tests where that canonical implementation already provides the behavior.

The latest ClawSweeper review found no actionable code defect and listed the preservation-first reset failure contract as its remaining maintainer risk. That specific tradeoff was explicitly accepted and remains the intended design: failed revocation blocks reset; a later failure must not restore stale deletion authority. This acceptance does not waive the new live failure, current merge conflict, exact-head CI, or native prepare/merge gates. Nothing is merged.

Persist terminal cleanup revocation before publishing a reset successor,
including previously best-effort suppression and missing-row recreation.
Preserve collector results, unchanged retries, and active/yielded continuations;
a later reset failure retains durable suppression rather than reviving cleanup.

Complete the existing requester/owner/child task index and use it for scoped
pages without weakening revision, cursor, fairness, or access checks. Together
with the retained scoped reader repair, this removes unrelated scan work from
Swarm completion and observation. No schema, config, or dependency changes.

Context: #130741
Pass the resolved canonical session key directly to cleanup revocation instead of reparsing global aliases. Existing selected-agent rejection and lifecycle guards remain authoritative. Fixes the two global reset-hook failures exposed by PR #130741 CI; 476 focused tests and changed gates pass.
@steipete
steipete force-pushed the codex/sweep-subagent-session-scope-20260826 branch from 9bf4294 to 96f043a Compare September 5, 2026 11:07
@steipete

steipete commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Maintainer decision: repair the SQLite wait cycle before landing

Explicit acceptance was received in chat on September 5, 2026 for asynchronous admission of conflicting transcript, trajectory, and borrowed-memory writes through the existing per-agent owner. The selected decision is to repair this before landing, not defer the known failed stress case.

A follow-up SDK decision explicitly approves one generic withOpenClawAgentDatabaseWrite export in the existing openclaw/plugin-sdk/sqlite-runtime subpath, with documentation/tests and canonically regenerated SDK baselines. No new subpath is approved. It must reject closed/replaced borrowed handles after waiting and preserve caller-side live-authority validation; a database handle is identity, not permission.

Bulk deletion must remain off-thread. Preserve the exact live authorization and worker-settlement guarantees, rollback and postcommit publication, caller completion ordering, and the existing 500 ms responsiveness target. Revalidate applicable authority after admission waits before mutation. No schema, configuration, authority-lease, timeout, or concurrency-cap expansion is approved, and the measured 3.52-second main-thread bulk-deletion shortcut is not accepted.

The implementation will cover participating foreground and borrowed-memory writers at their canonical persistence/admission boundaries, rather than adding a Swarm retry or disabling cleanup. Required proof includes the deterministic concurrent-write/reclamation regression, authority retirement while waiting, worker/rollback failures, large-deletion responsiveness, and fresh retained-state Swarm completion/Stop/recovery. The earlier failed trials remain failed evidence.

A separate explicit decision waives fresh autoreview for this PR only. It does not waive hands-on source/dependency review, applicable regression and live verification, green exact-head CI, or the native prepare/merge gates. No shared authentication, model configuration, reviewer permissions, or isolation controls will be changed to bypass the unavailable review route.

The tested deduplicated head 96f043a28b08124f5d8ad628e5e7d04bcd669696 has been published to clear the task-index conflict, and its exact-head CI run completed successfully. That is baseline evidence, not proof of the pending SQLite repair. The implementation branch has been aligned with current main 1a13b42b6b75d5d15b47eb966b1c3f5ce5456136; the PR remains held until the approved repair and final proof are complete.

steipete added a commit that referenced this pull request Sep 17, 2026
* test(gateway): cover native reclamation and abort admission

Exercise conversation directory, synthetic send, and durable completion while
native reclamation awaits commit authorization. Cover admitted direct child
cancellation through successful and failed terminal persistence.

Mutation controls verify sensitivity to bypassed writer admission and restart
misclassification; they do not diagnose current main as defective.

Related: #130741

* fix(ci): preserve shard planning without map spreads
steipete added a commit that referenced this pull request Sep 17, 2026
Keep selected session entries complete while child discovery omits unused saved prompt payloads. Find direct children through the existing parent and spawn indexes in one ordered, deduplicated query.

Preserve persisted and retained-run children, visibility and ownership, and deletion freshness. Extend prompt-decoding regression coverage at sessions.describe and single-row reads. Related: #130741.
steipete added a commit that referenced this pull request Sep 17, 2026
Use the existing parent and spawn indexes for direct child discovery, and
load child metadata without unused skill snapshots or prompt reports.
Preserve complete selected entries and current ownership, lineage, and
deletion behavior for persisted and retained-run children.

Keep resident list and describe ownership intact. Exercise the cold loader
used by embedded history while retaining current resident lifecycle tests.
Related: #130741; the broader Gateway latency target remains open.

Source review is scoped-clean through P2. Runtime proof and exact-head CI
for this integration remain pending; earlier proof belongs to fa202e5c.
steipete added a commit that referenced this pull request Sep 17, 2026
Use the existing parent and spawn indexes for direct child discovery, and load compact child metadata without unused skill snapshots or prompt reports. Preserve complete selected entries, current ownership and lineage, and fresh deletion results. Keep ordinary list/describe reads with the resident owner; cover the real cold loader used by embedded history. Related: #130741.

On Linux/Node 24.19.0, the full 35-case baseline/candidate comparison produced exactly four intended failures on baseline and 35 passes on candidate. Nine current consumer selections added 159 passes. All 194 selected candidate cases passed; the TUI history filter intentionally left 128 other cases unselected. All 13 native reports and assertion identities were independently verified. Exact-head CI run 35231150085 succeeded with 142 successful jobs and 16 skipped. The full selected gate passed, including production/core-test types, export scans, lint, formatting and contract guards. The Linux command exited 0; a subsequent portal-sync request timed out. Reports and source bindings were verified before owned cleanup.

Fresh source review and the trusted exact-head ClawSweeper review found no introduced correctness/security defect. Prior SQL medians of 4.119 ms and 0.091 ms belong to b918ab/7a3160e5 and were not repeated. The original live campaign's 17 of 1,316 observations above 500 ms and historical recursive-failure attribution gap remain documented; the broader Gateway target remains open.
steipete added a commit that referenced this pull request Sep 17, 2026
Skip unrelated pending archive publication for fresh session upserts with
maintenance disabled. Preserve publication for existing entries, resets,
removal retries, maintenance, and Doctor work.

A real archive collision reproduces creation failing after its session row
and transcript committed; verify successful creation and later archive
recovery through the lifecycle entry points.

Related: #130741
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
* test(gateway): cover native reclamation and abort admission

Exercise conversation directory, synthetic send, and durable completion while
native reclamation awaits commit authorization. Cover admitted direct child
cancellation through successful and failed terminal persistence.

Mutation controls verify sensitivity to bypassed writer admission and restart
misclassification; they do not diagnose current main as defective.

Related: openclaw#130741

* fix(ci): preserve shard planning without map spreads
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
Use the existing parent and spawn indexes for direct child discovery, and load compact child metadata without unused skill snapshots or prompt reports. Preserve complete selected entries, current ownership and lineage, and fresh deletion results. Keep ordinary list/describe reads with the resident owner; cover the real cold loader used by embedded history. Related: openclaw#130741.

On Linux/Node 24.19.0, the full 35-case baseline/candidate comparison produced exactly four intended failures on baseline and 35 passes on candidate. Nine current consumer selections added 159 passes. All 194 selected candidate cases passed; the TUI history filter intentionally left 128 other cases unselected. All 13 native reports and assertion identities were independently verified. Exact-head CI run 35231150085 succeeded with 142 successful jobs and 16 skipped. The full selected gate passed, including production/core-test types, export scans, lint, formatting and contract guards. The Linux command exited 0; a subsequent portal-sync request timed out. Reports and source bindings were verified before owned cleanup.

Fresh source review and the trusted exact-head ClawSweeper review found no introduced correctness/security defect. Prior SQL medians of 4.119 ms and 0.091 ms belong to b918ab/3d08e342 and were not repeated. The original live campaign's 17 of 1,316 observations above 500 ms and historical recursive-failure attribution gap remain documented; the broader Gateway target remains open.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…148958)

Skip unrelated pending archive publication for fresh session upserts with
maintenance disabled. Preserve publication for existing entries, resets,
removal retries, maintenance, and Doctor work.

A real archive collision reproduces creation failing after its session row
and transcript committed; verify successful creation and later archive
recovery through the lifecycle entry points.

Related: openclaw#130741
steipete added a commit that referenced this pull request Sep 26, 2026
Keep pending reasoning, speed and context choices attached to their field
owners while creation receipts adopt the physical session identity. Preserve
FIFO dispatch and each field's visible failure when later writes settle.

Validated with 125 focused and sibling cases, a failing preview regression
control, changed-source checks, the unchanged UI performance budget, and
a Chromium comparison that reproduces the missing error on the incoming
PR and retains it on this candidate. Independent review through P2 is clean.

Related: #154807, #130741, #152375
steipete added a commit that referenced this pull request Sep 26, 2026
* fix(ui): preserve queued settings across session creation

Keep pending reasoning, speed and context choices attached to their field
owners while creation receipts adopt the physical session identity. Preserve
FIFO dispatch and each field's visible failure when later writes settle.

Validated with 125 focused and sibling cases, a failing preview regression
control, changed-source checks, the unchanged UI performance budget, and
a Chromium comparison that reproduces the missing error on the incoming
PR and retains it on this candidate. Independent review through P2 is clean.

Related: #154807, #130741, #152375

* test(ui): provide preview capability in chat fixtures

Keep existing composer and identity fixtures aligned with the session
capability contract. An undefined preview represents no pending settings;
existing overrides and rendering assertions stay unchanged.

Independent review through P2 and pinned formatter checks pass. This fixes
the missing-method failures observed on both Node and Bun; test replay is
pending on the updated candidate.

Related: #154807

* test(ui): return complete chat header patch receipts

* test(ui): preserve real session capabilities in permission controls
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…law#154807)

* fix(ui): preserve queued settings across session creation

Keep pending reasoning, speed and context choices attached to their field
owners while creation receipts adopt the physical session identity. Preserve
FIFO dispatch and each field's visible failure when later writes settle.

Validated with 125 focused and sibling cases, a failing preview regression
control, changed-source checks, the unchanged UI performance budget, and
a Chromium comparison that reproduces the missing error on the incoming
PR and retains it on this candidate. Independent review through P2 is clean.

Related: openclaw#154807, openclaw#130741, openclaw#152375

* test(ui): provide preview capability in chat fixtures

Keep existing composer and identity fixtures aligned with the session
capability contract. An undefined preview represents no pending settings;
existing overrides and rendering assertions stay unchanged.

Independent review through P2 and pinned formatter checks pass. This fixes
the missing-method failures observed on both Node and Bun; test replay is
pending on the updated candidate.

Related: openclaw#154807

* test(ui): return complete chat header patch receipts

* test(ui): preserve real session capabilities in permission controls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

2 participants