Repository navigation
refactor: prepare message action discovery asynchronously - #168484
Conversation
Plugin state callbacks can perform SQLite work on the Gateway thread, including APIs that return a Promise. Plugin authors gain a versioned worker-owned keyed store; existing synchronous and callback APIs keep their completion semantics through the current Plugin SDK major.
Native session bindings still expose host-thread persistence and synchronous preparation through harness adapters. Native binding preparation and ordinary lifecycle mutations can complete through the worker while released synchronous integrations remain supported.
Conversation presentation and capture read native ownership on the Gateway thread even when their callers can await prepared facts. Session rows and conversation capture retain their existing meaning while ordinary ownership preparation runs through workers.
Channel account inspection, setup and status can read persisted plugin state synchronously on the Gateway thread. Channels can prepare saved-account state asynchronously without losing configured-account, saved-login or explicit report-scope behavior.
Command authorization and approval routing can force channel persistence reads onto the Gateway thread. Command and approval preparation can await persisted channel state while retaining current authorization at dispatch and delivery.
Conversation binding APIs include synchronous writes and reads that prune state, and existing async methods can fall back to synchronous adapters. Plugin authors gain a V2 binding contract with required async operations and coherent source assertions; released structural adapters remain compatible.
|
Landing under Peter's relaxed landing v4. Final head 6a2dd44 merges main while preserving its current owners outside this part's message-action changes. No budget or limit increased. AWS Crabbox run_de5be8b8ec837a92cb375dfc570cbc72 passed all 89 focused tests for channel tools, message-action discovery, and action parameters (59.151s total command). Coordinator review/build proof remains applicable; the merge was conflict-only. Required CI was pending at last observation; no green CI claim. Reusing the passing published-driver 2026.9.9 × candidate update proof from #168478, run_3d6590a7c9c48b16a12382d7e111cda1, per the intermediate-stack instruction. Native allocation/preparation is subject to the explicit ten-minute fallback, with the final head pinned and any submission reconciled first. Remaining non-product policy failures are follow-ups under v4. |
…68484) * refactor(plugin-sdk): share legacy persistence warning budgets * feat(plugin-sdk): add worker-owned keyed state Plugin state callbacks can perform SQLite work on the Gateway thread, including APIs that return a Promise. Plugin authors gain a versioned worker-owned keyed store; existing synchronous and callback APIs keep their completion semantics through the current Plugin SDK major. * refactor: move native binding preparation to workers Native session bindings still expose host-thread persistence and synchronous preparation through harness adapters. Native binding preparation and ordinary lifecycle mutations can complete through the worker while released synchronous integrations remain supported. * refactor: prepare conversation ownership off the Gateway thread Conversation presentation and capture read native ownership on the Gateway thread even when their callers can await prepared facts. Session rows and conversation capture retain their existing meaning while ordinary ownership preparation runs through workers. * refactor: resolve persisted channel accounts asynchronously Channel account inspection, setup and status can read persisted plugin state synchronously on the Gateway thread. Channels can prepare saved-account state asynchronously without losing configured-account, saved-login or explicit report-scope behavior. * refactor: prepare command and approval eligibility asynchronously Command authorization and approval routing can force channel persistence reads onto the Gateway thread. Command and approval preparation can await persisted channel state while retaining current authorization at dispatch and delivery. * feat(plugin-sdk): add worker-owned conversation binding APIs Conversation binding APIs include synchronous writes and reads that prune state, and existing async methods can fall back to synchronous adapters. Plugin authors gain a V2 binding contract with required async operations and coherent source assertions; released structural adapters remain compatible. * test: bind native lease fixtures to V2 action authority * test: await channel setup registry fixtures * test: complete keyed state runtime fixture * test: align Matrix recovery and channel target fixtures * test: retain approval replay subscriber across async eligibility * test: implement async listing in ACP binding fixture * refactor(plugin-state): separate offline migration entrypoints * refactor(codex): share binding helpers and contract fixtures * refactor: separate session row preparation and publications * refactor: share channel lifecycle and test helpers * refactor: colocate approval expiry observation * refactor(slack): colocate action summary formatting * test: synchronize approval client startup race * refactor: prepare message action discovery asynchronously * test: retain async status discovery arguments * test(codex): model current conversation inspection boundary * test(facetime): bind persistence barriers before runtime startup * fix(slack): resolve bound parent before thread fallback * docs: explain validated discussion account config * test: exercise native binding lifecycle through worker settlement * test: document isolated runtime dependencies * test: document isolated runtime dependencies * test: document isolated runtime dependencies * test: document isolated runtime dependencies * fix: preserve native binding method receivers * fix: bind model preparation authority to its reader * style: resolve approval runtime lint findings * style: avoid mutating action discovery entries * style: keep Discord route reassignment local * chore: regenerate worker and test guard baselines * chore: regenerate worker and test guard baselines * chore: reconcile worker migration baselines * chore: reconcile async approval SDK baselines * chore: record versioned binding SDK surface * chore: prune migrated discovery mocks * test: run native row ownership with the host broker * fix: include async approval caller in its migration * fix(plugin-sdk): preserve synchronous approval publication Add an awaited publisher companion while preserving numeric synchronous delivery and legacy publisher objects. Refuse async-only eligibility before legacy delivery and keep rejected preparation observed. Bundled approval dispatch selects the new method before publication. * chore: regenerate approval assertion baseline * fix(clickclack): fence discussion cleanup and reconciliation * test(clickclack): avoid shadowing store options
What Problem This Solves
Message-action discovery can synchronously load saved channel state while preparing a turn or dispatching a message action.
User Impact
Saved-login Matrix accounts retain their actions, schemas, and capabilities when discovery runs through worker-owned storage. The host awaits discovery once and carries the prepared catalog into tool creation and dispatch.
Why This Change Was Made
Migrates bundled action-discovery consumers to the async contract and removes obsolete internal synchronous wrappers. The released synchronous Matrix callback retains its compatibility behavior and names its replacement. Action authorization still revalidates before the effect.
This is part 7 of the nine-part S7 state/binding migration stack. Targets
dbasync/sw7b-6(parent PR); validation compares this part with its actual stack parentfa00fb0fc9bd. The stack integrates pinned main413d5f9bb3f7.Evidence
Changed lines against the parent: production +494 / -281; tests and fixtures +221 / -79.
Focused integrated receipts cover asynchronous action discovery, message parameters, and tool integration: 112 passed, 0 skipped, mapped to 5/5 changed test files. These are recorded integrated file versions, not independent runs of every prefix; per-part counts are not additive. Stack totals are 3,296 passing receipts, 3,295 after removing one known relocation duplicate, and three skipped cases across 177 files; no required focused file remains missing.
Recorded file spans total 8.843s; these passing file receipts came from the original 2,879.229s mixed-result batch. Its failures and subsequent repairs remain in the ledger. File spans and invocation wall times are distinct; CI runner seconds were not measured.
Owner-reviewed native SDK digest:
05484b81d65957c29b8ba10b05d53e122a4e6d88ee8c4770c63793e6dadd8d7f. Zero released export removals; the digest reconciles to this parent/head through the generated-only baseline change. The adapter adds an optional async member; removed discovery helpers are internal.The S7 family audit at c3667d2 resolved 18,862 inputs, 1,766 calls, 521 imports and 78 member references: 153 explicitly classified retained edges, zero unknown edges or async-contract errors. The publisher repair changed five scanned modules containing none of those captured family edges; retained-edge sources stayed unchanged. Final source differs from the passing repair head only by its generated assertion baseline. This preserves the original scan provenance rather than claiming a new full scan.
Core and extension production typechecks passed for all nine source prefixes; the final generated-only assertion-baseline adjustment does not change their code. The selected check-changed commands were executed, with the inherited failures below preserved.
Inherited failures remain explicit: Knip flags
.github/actions/setup-release-harness/narrow-lockfile.mjsandsrc/infra/sqlite-source-fence-admission.ts; the production export scan flagsPUBLIC_SESSION_ENTRY_SCRIPT; core lint has 10 unchanged max-lines findings; the environment-name count is 456/455, including unchangedOPENCLAW_PITCH. Relevant source/config blobs equal the pinned base. No blanket check-changed-green claim is made.Three scoped review rounds completed. Accepted correctness findings were repaired; remaining scoped follow-ups are recorded in the relevant PR descriptions.
Final repair checks passed at
4b7d96b620ea: scoped lint (30.02 s), affected test types (342.12 s), import-cycle guard (23.46 s), and Madge (14.91 s).Exact-final remote pnpm build passed in 369.642s. The qualified Matrix cold-import snapshot measured 104.992 MiB peak RSS, +58.199 MiB versus the empty baseline, and 383.791ms process CPU. Child/process-group cleanup and temporary-home removal were verified. This is a cold-import snapshot; the dependency closure is not attested. Statement-gate evidence follows separately; the update cell remains pending for the lander.
Statement gate: paired phases, attribution and supplemental samples
The gate uses the prespecified three alternating parent/head pairs on the same host. All phase durations are valid (candidate/base median ratio ≤1.5). Each adjacent edge shares its intermediate-prefix samples with the next edge. The table below reports primary medians; fourth-pair and cumulative results are retained separately for transparency. The fourth sweep was run for part 9's required RAW follow-up, not to replace these primary comparisons.
The first P4 workload completed successfully but its aggregation initially lacked a proof helper. Restoring the existing helper produced the identical summary hash; no workload was repeated. The later controller stopped before P6's fifth workload after P4/P5 had already completed incidental fifth samples. Those incidental samples are not substituted into the primary series.
The first-turn increase is +7 SQL (+0.272%); warmed increases +1.3 SQL/turn (+0.129%). Both satisfy the ≤0.5% tolerance only with the unchanged-owner attribution below. Exact total-median samples are P6 run 3/P7 run 2 for first turn, and P6 run 2/P7 run 3 for warmed turns. MAIN first/warmed counts are unchanged.
Background row refreshes change 60→67 and shared facts 60→68. The changed tool-construction sender retains the same approval reads: 20 requests / 40 SQL warmed, 3 / 6 first turn. Every native SQL-producing stack across the first four paired samples is outside the changed files. The other changed sender ancestry covers existing second-session/cron/compaction exact-entry reads, not a new SQL operation.
Non-turn increases are within ten statements: connect +7 combines generic listing +24 with startup schedule/media/image/queue offsets −17; second session +9 is existing schema initialization (four CREATE IF NOT EXISTS statements, contract INSERT, canonical-schema query, schema/user PRAGMAs and sqlite_schema query), with other row/cache offsets canceling; cron +2 and compaction +1 are existing read/validation work. Neither first-turn nor warmed attribution is presented as reduced work.
The published-driver × candidate update cell is pending (lander). No release, package publication or Plugin SDK major bump is included.