Files
EdenandPatrick Erichsen cac0ec286f fix(line): migrate pre-drain spool rows to the canonical queue contract on upgrade (#110058)
* fix(line): migrate pre-drain spool rows to the canonical queue contract on upgrade

* refactor(line): share the spool dead-letter reason and type webhook fixtures

The invalid-event reason joins the shared spool contract so the migration's
recovery signature cannot drift from what the spool writes, and the webhook
test fixtures gain their required quoteToken instead of casting past it.

* refactor(line): group the doctor queue export with its module peers

* fix(line): report settled pre-drain rows apart from migrated deliveries

A pre-drain row whose canonical id is already completed or dead-lettered
owes no delivery: enqueue returns the existing terminal row, the legacy row
is retired, and nothing is dispatched. Counting those as migrated made the
doctor line promise deliveries that never happen, which is reachable when a
redelivered messageId arrives after an earlier copy exhausted its retries,
and on any rerun after delivery.

Split the migration cases into webhook-spool-migration.test.ts next to the
module they cover, with the shared fixtures in webhook-spool.test-support.ts;
the added cases put webhook-spool.test.ts over the 1000-line max-lines cap.

Also cover the default account in the doctor contract test: it is swept even
when the config never names it, and nothing exercised that path before.

* fix(line): sweep spool accounts through host-bound doctor ingress queue lanes

* fix(doctor): keep the plugin state capacity accessor on the migration context

* refactor(doctor): mirror the runtime ingress accessor names on migration lanes

* docs(line): state the visible-failure contract on the doctor lane lookup

* chore(plugin-sdk): regenerate API baseline for the doctor ingress-queue context seam

* fix(doctor): scope migration ingress queue access to the exclusive repair section

Detection ran before the host owned exclusive state yet received the same mutable
queue the migration uses, and the handle it returned stayed live after the
migration returned. Both are paths on which a plugin could write durable rows
outside the section that owns them.

Split the access by phase, following the existing repair-authority convention:
detection gets an inspection-only projection, the mutable lane is attached only
while the host holds the lock, and every call through it re-asserts that
authority so a retained handle fails instead of writing.

* test(doctor): assert durable rows are unchanged by a post-section write attempt

* fix(doctor): return a listing-only inspection object instead of a narrowed queue

* test(line): drop imports left unused by the merge resolution

* fix(doctor): read detection ingress rows through the non-creating read-only opener

The listing-only projection stopped detection from writing rows, but opening the
queue still went through the shared state database's writable path, which creates,
migrates and configures the file. That is durable-state work before the exclusive
maintenance lock exists.

Give the queue a read-only access mode that resolves its handle through
openExistingOpenClawStateDatabaseReadOnly and yields nothing when the store is
absent, and have Doctor detection open through it.

* fix(doctor): discover ingress accounts read-only during detection

Account discovery runs before the inspection facade is opened, so it was the first
thing a detection pass could use to create and migrate the shared state database -
the same pre-lock write path the listing methods had just been moved off.

Add a read-only discovery function on the same non-creating opener, make the Doctor
contract's accessor async, and cover an absent state directory in the regression.

* fix(doctor): re-assert authority after awaited recovery predicates

recoverStaleClaims accepts predicates that may await. Asserting once at call time
let a migration start recovery, return, release the repair section, and only then
have a predicate resolve into the tombstone or claim-release write.

Wrap both predicates so the authority is re-asserted after each one settles, and
report migrated rows as queued rather than delivered - for an account removed from
config there is no provider to drain them until it is restored.

* fix(doctor): keep the trusted-plugin gate on migration ingress access

The runtime proxy limits openChannelIngressQueue to bundled plugins and trusted
official installs. The Doctor migration context built queues straight from manifest
channel ids, so an activated workspace plugin declaring a doctor contract could
reach durable queues through Doctor that the runtime would refuse it.

Carry the same origin/trustedOfficialInstall decision onto the migration entry and
withhold the ingress lane entirely from an untrusted owner in both phases.

---------

Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com>
2026-08-28 18:20:07 -07:00

19 lines
384 B
JSON

{
"id": "line",
"doctorContract": {
"stateMigrations": true
},
"name": "LINE",
"description": "OpenClaw LINE channel plugin for LINE Bot API chats.",
"icon": "https://cdn.simpleicons.org/line",
"activation": {
"onStartup": false
},
"channels": ["line"],
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {}
}
}