Skip to content

refactor(copilot): keep session binding storage off the host thread - #149577

Merged
steipete merged 2 commits into
mainfrom
codex/copilot-async-storage
Sep 16, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/copilot-async-storage

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144592, #146557

What Problem This Solves

Copilot session binding storage still performs synchronous SQLite work during agent attempts, reset, and compaction.

User Impact

Session binding persistence moves off the host event loop while preserving SDK session continuity and the existing best-effort memory fallback. Reset and shutdown wait for admitted binding work and cleanup. No configuration, storage format, expiry, capacity, or public SDK change is required.

Why This Change Was Made

Use the existing worker-backed keyed store, await the private attempt callbacks, and serialize binding checks, writes, and publication per session within each harness. Deferred compaction cleanup retains its binding work through disposal. Stale compaction compares SDK session IDs so metadata updates do not prevent invalidation and a different replacement session survives.

Evidence

  • 265 focused tests passed: 100 harness, 10 registration, and 155 attempt tests. Coverage includes actual synthetic SQLite close/reopen/reset, delayed writes and deletion, disposal, storage failures, replacement races, and cancellation.
  • The delayed-publication regression fails against the original harness because the attempt continues before its pending binding write completes.
  • The normal full build, selected type/lint/boundary checks, and fresh independent P2 review passed. A final lint-only local rename was typechecked and linted, and external-plugin distributions were regenerated from the final source.
  • Initial CI found three stale routing expectations after the harness moved to the database-worker lane. The test-only follow-up preserves both exact test targets and the host-discovery assertions while expecting the correct two lanes; all three focused cases pass. Production source is unchanged.
  • No live provider credentials or native fault-injection campaign was used.

@clawsweeper

clawsweeper Bot commented Sep 16, 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 extensions: copilot size: XL maintainer Maintainer-authored PR labels Sep 16, 2026
@steipete
steipete marked this pull request as ready for review September 16, 2026 01:45
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 10:06 PM ET / September 16, 2026, 02:06 UTC (Revision 2).

ClawSweeper review

What this changes

Moves Copilot session-binding storage to the existing SQLite worker and makes attempts, reset, compaction cleanup, and shutdown await pending binding work.

Merge readiness

✅ Ready for maintainer review

Keep open: current main and v2026.9.4 still use synchronous Copilot binding storage. No blocking introduced defect was found, and the follow-up preserves the prior review’s clean findings.

Priority: P2
Reviewed head: f01ba79ef0276eb826676248b2b27da13983f84b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused refactor with meaningful persistence and lifecycle coverage and no blocking correctness findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected tests cover the Copilot harness with real synthetic SQLite persistence and mocked SDK execution; the body explicitly disclaims live-provider and native fault-injection proof. No material authority change requires an exception to that exemption.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected tests cover the Copilot harness with real synthetic SQLite persistence and mocked SDK execution; the body explicitly disclaims live-provider and native fault-injection proof. No material authority change requires an exception to that exemption.
Evidence reviewed 9 items Current-main necessity: Fetched main still opens the synchronous keyed store for Copilot session bindings; the merged worker infrastructure did not convert this caller.
Released behavior: The v2026.9.4 source also uses openSyncKeyedStore. The annotated tag was separately resolved to the supplied release commit.
Introduced lifecycle changes: The merge-base-to-head diff serializes binding reads, writes, and publication; reset releases the queue before joining deferred cleanup; disposal joins admitted operations before releasing the pool. Stale compaction checks the SDK session identity before deleting a replacement binding.
Findings None None.
Security None None.

How this fits together

The Copilot harness connects OpenClaw conversations to GitHub Copilot SDK sessions. Its stored bindings let later turns resume compatible sessions and let reset and compaction target the correct session.

flowchart TD
  A[Conversation attempt or reset] --> B[Copilot harness]
  B --> C[Per-session binding queue]
  C --> D[SQLite worker]
  D --> E[Compatible session binding]
  E --> F[Copilot SDK session]
  B --> G[Cleanup and shutdown]
  G --> C
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +56, Tests +124, Docs +6. Total +186 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 5 379 323 +56
Tests 6 290 166 +124
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 675 489 +186

Review metrics

Metric Value Why it matters
Production versus test growth Production +56; tests +123 net lines Production growth implements per-session serialization and lifecycle tracking; added tests cover delayed persistence, restart continuity, and replacement races.

Root-cause cluster

Relationship: partial_overlap
Canonical: #144592
Summary: This PR completes the Copilot caller portion of the broader asynchronous-storage program.

Members:

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

Technical review

Best possible solution:

Keep binding persistence with the existing SQLite worker while preserving session compatibility, best-effort memory fallback, and complete lifecycle settlement.

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

Not applicable as a discrete bug reproduction: this is a storage-boundary refactor. Source confirms the existing synchronous caller; runtime latency was not measured during this read-only review.

Is this the best way to solve the issue?

Yes. Reusing the existing worker-backed keyed store and awaiting private callbacks is a focused solution that preserves the persisted format and public plugin contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6cf521932af0.

Labels

Label justifications:

  • P2: This is a bounded runtime-storage improvement without evidence of an urgent user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR. Inspected tests cover the Copilot harness with real synthetic SQLite persistence and mocked SDK execution; the body explicitly disclaims live-provider and native fault-injection proof. No material authority change requires an exception to that exemption.

Evidence

What I checked:

  • Current-main necessity: Fetched main still opens the synchronous keyed store for Copilot session bindings; the merged worker infrastructure did not convert this caller. (extensions/copilot/index.ts:42, 6cf521932af0)
  • Released behavior: The v2026.9.4 source also uses openSyncKeyedStore. The annotated tag was separately resolved to the supplied release commit. (extensions/copilot/index.ts:42, 3a9d69db306c)
  • Introduced lifecycle changes: The merge-base-to-head diff serializes binding reads, writes, and publication; reset releases the queue before joining deferred cleanup; disposal joins admitted operations before releasing the pool. Stale compaction checks the SDK session identity before deleting a replacement binding. (extensions/copilot/harness.ts:540, f01ba79ef027)
  • Existing storage owner reused: The existing asynchronous keyed store dispatches register, lookup, and delete through the shared SQLite worker. This PR consumes that contract without adding a public API, schema, namespace, retention policy, or configuration option. (src/plugin-state/plugin-state-store.ts:271, f01ba79ef027)
  • Persistence and failure coverage: Inspected coverage exercises actual synthetic SQLite close/reopen/reset, legacy bindings, asynchronous storage failures, delayed publication, disposal, and replacement-session races. The SDK attempt remains mocked in the SQLite test. The captured PR body reports 265 focused passes and a regression failure against the original harness; this read-only review did not execute tests. (extensions/copilot/harness.test.ts:1997, f01ba79ef027)
  • Re-review continuity: Compared with the previously reviewed head, only the CI routing expectation changes. Both exact Copilot test targets remain selected, and host-discovery assertions remain intact. The supplied completed-review projection contains no prior findings or published rank-up moves. (test/scripts/ci-changed-node-test-plan.test.ts:436, f01ba79ef027)

Likely related people:

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

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 (1 earlier review cycle)
  • reviewed 2026-09-16T01:52:02.253Z sha 2a2e162 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 0e19700 into main Sep 16, 2026
147 of 148 checks passed
@steipete
steipete deleted the codex/copilot-async-storage branch September 16, 2026 02:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 16, 2026
…penclaw#149577)

* refactor(copilot): await session binding persistence

* test(copilot): expect database-worker harness routing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: copilot maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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.

1 participant