diff --git a/cli/src/services/skill-target-lock.ts b/cli/src/services/skill-target-lock.ts index a888ce1cc..ed1510375 100644 --- a/cli/src/services/skill-target-lock.ts +++ b/cli/src/services/skill-target-lock.ts @@ -71,7 +71,10 @@ function acquireTargetLock(lockPath: string): Promise<() => Promise> { }) } -async function acquireAcquisitionGate(gatePath: string): Promise<() => Promise> { +/** Serialize stale-lock recovery attempts without replacing a live contender. */ +export async function acquireAcquisitionGate(gatePath: string, timeoutMs = Infinity): Promise<() => Promise> { + if (!(timeoutMs >= 0)) throw new Error('Invalid acquisition gate timeout') + const deadline = Date.now() + timeoutMs await ensureAcquisitionGateDirectory(gatePath) // A per-target Lamport bakery queue avoids deleting a shared stale gate. Every removable path // contains a nonce and is owned by one PID, so crash recovery cannot unlink a replacement owner. @@ -87,7 +90,7 @@ async function acquireAcquisitionGate(gatePath: string): Promise<() => Promise 0) { @@ -160,14 +163,17 @@ async function readGateState(gatePath: string, contenderId: string): Promise { let delayMs = 5 for (;;) { const state = await readGateState(gatePath, contender.id) const hasEarlierTicket = state.tickets.some(candidate => compareContenders(candidate, contender) < 0) if (!state.hasLiveChoosing && !hasEarlierTicket) return - await new Promise(resolve => setTimeout(resolve, delayMs)) + const remaining = deadline - Date.now() + if (remaining <= 0) throw Object.assign(new Error('Lock acquisition gate is already being held'), { code: 'ELOCKED' }) + await new Promise(resolve => setTimeout(resolve, Math.min(delayMs, remaining))) delayMs = Math.min(delayMs * 2, ACQUISITION_GATE_MAX_POLL_MS) } } diff --git a/cli/src/stores/inventory-store.ts b/cli/src/stores/inventory-store.ts index 2e5066cc1..39d029984 100644 --- a/cli/src/stores/inventory-store.ts +++ b/cli/src/stores/inventory-store.ts @@ -2,6 +2,7 @@ import { isDeepStrictEqual } from 'node:util' import { readFile, rename, rm, writeFile } from 'node:fs/promises' import { dirname } from 'node:path' import { lock } from 'proper-lockfile' +import { acquireAcquisitionGate } from '../services/skill-target-lock' import { joinPath, userStateDir, ensureDir } from '../platform/paths' export interface InventoryTarget { @@ -163,20 +164,41 @@ export class InventoryStore { } } - private acquireLock(): Promise<() => Promise> { - return lock(this.path, { - lockfilePath: `${this.path}.lock`, - realpath: false, - stale: 30_000, - update: 10_000, - retries: { - retries: 10, - factor: 2, - minTimeout: 100, - maxTimeout: 1_000, - randomize: true - } - }) + private async acquireLock(): Promise<() => Promise> { + // proper-lockfile stale stat/remove is not atomic: serialize acquisition so a delayed + // recoverer cannot remove another process's newly acquired inventory lock. + const deadline = Date.now() + 10_000 + const releaseGate = await acquireAcquisitionGate(`${this.path}.lock.acquire`, 10_000) + let release: () => Promise + try { + const remaining = deadline - Date.now() + if (remaining <= 0) throw Object.assign(new Error('Inventory lock acquisition timed out'), { code: 'ELOCKED' }) + release = await lock(this.path, { + lockfilePath: `${this.path}.lock`, + realpath: false, + stale: 30_000, + update: 10_000, + retries: { + retries: 10, + maxRetryTime: remaining, + factor: 2, + minTimeout: 100, + maxTimeout: 1_000, + randomize: true + } + }) + } catch (operationError) { + try { await releaseGate() } + catch (cleanupError) { throw new AggregateError([operationError, cleanupError], 'inventory acquisition and gate cleanup both failed') } + throw operationError + } + try { await releaseGate() } + catch (gateError) { + try { await release() } + catch (cleanupError) { throw new AggregateError([gateError, cleanupError], 'inventory and gate cleanup both failed') } + throw gateError + } + return release } async upsertTarget( diff --git a/cli/test/helpers/inventory-stale-lock-worker.ts b/cli/test/helpers/inventory-stale-lock-worker.ts new file mode 100644 index 000000000..2b11d08f0 --- /dev/null +++ b/cli/test/helpers/inventory-stale-lock-worker.ts @@ -0,0 +1,41 @@ +import { createRequire } from 'node:module' +import type { Stats } from 'node:fs' +import { access, writeFile } from 'node:fs/promises' +import { join } from 'node:path' +import { InventoryStore } from '../../src/stores/inventory-store' + +const [home, id] = process.argv.slice(2) +if (!home || !id) throw new Error('Expected isolated home and contender id') +const require = createRequire(import.meta.url) +// Delay only the stale stat callback; every filesystem operation remains real. +const fs = createRequire(require.resolve('proper-lockfile'))('graceful-fs') as { + stat(path: string, callback: (error: NodeJS.ErrnoException | null, stat: Stats) => void): void +} +const stat = fs.stat.bind(fs) +const store = new InventoryStore(home) +async function waitFor(name: string): Promise { + const deadline = Date.now() + 10000 + for (;;) { + try { await access(join(home!, name)); return } + catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error } + if (Date.now() >= deadline) throw new Error(`Timed out waiting for ${name}`) + await Bun.sleep(5) + } +} +let paused = false +fs.stat = (path, callback) => stat(path, (error, info) => { + if (path !== `${store.path}.lock` || error) { callback(error, info); return } + if (!paused && info.mtimeMs < Date.now() - 30000) { + paused = true + void writeFile(join(home, `${id}-stale`), '').then(() => waitFor(`${id}-resume`)).then( + () => callback(null, info), failure => callback(failure, info)) + } else if (!paused) { + void writeFile(join(home, `${id}-fresh`), '').then(() => callback(null, info), failure => callback(failure, info)) + } else callback(null, info) +}) +await store.mutateAtomic(inventory => { + inventory.items.push({ registry: 'https://registry.example', namespace: 'global', slug: id, version: '1.0.0', targets: [] }) +}, async () => { + await writeFile(join(home, `${id}-entered`), '') + await waitFor(`${id}-commit`) +}) diff --git a/cli/test/unit/stores/inventory-stale-lock.test.ts b/cli/test/unit/stores/inventory-stale-lock.test.ts new file mode 100644 index 000000000..dd19a96a2 --- /dev/null +++ b/cli/test/unit/stores/inventory-stale-lock.test.ts @@ -0,0 +1,98 @@ +import { expect, test } from 'bun:test' +import { access, mkdir, mkdtemp, readFile, readdir, rm, utimes, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { fileURLToPath } from 'node:url' +import { InventoryStore } from '../../../src/stores/inventory-store' +import { acquireAcquisitionGate } from '../../../src/services/skill-target-lock' + +async function exists(path: string): Promise { + try { await access(path); return true } + catch (error) { if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false; throw error } +} +async function until(check: () => Promise): Promise { + const deadline = Date.now() + 10000 + while (!await check()) { + if (Date.now() >= deadline) throw new Error('Inventory contention checkpoint timed out') + await Bun.sleep(5) + } +} + +test('a delayed stale-lock observer cannot delete a replacement inventory owner', async () => { + const home = await mkdtemp(join(tmpdir(), 'skillhub-inventory-stale-race-')) + const lockPath = join(home, '.skillhub/inventory.json.lock') + await mkdir(lockPath, { recursive: true }) + const stale = new Date(Date.now() - 60000) + await utimes(lockPath, stale, stale) + const worker = fileURLToPath(new URL('../../helpers/inventory-stale-lock-worker.ts', import.meta.url)) + const processes: ReturnType[] = [] + const start = (id: string) => processes.push(Bun.spawn({ cmd: [Bun.which('bun') ?? process.execPath, worker, home, id], stdout: 'pipe', stderr: 'pipe' })) + let secondObservedFresh = false + let secondEnteredEarly = false + let checkpointError: unknown + try { + start('first') + await until(() => exists(join(home, 'first-stale'))) + start('second') + await until(async () => { + if (await exists(join(home, 'second-stale'))) return true + try { return (await readdir(`${lockPath}.acquire`)).filter(name => name.startsWith('ticket.')).length === 2 } + catch (error) { if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false; throw error } + }) + await writeFile(join(home, 'first-resume'), '') + await until(() => exists(join(home, 'first-entered'))) + await writeFile(join(home, 'second-resume'), '') + await until(async () => await exists(join(home, 'second-entered')) || await exists(join(home, 'second-fresh'))) + secondObservedFresh = await exists(join(home, 'second-fresh')) + secondEnteredEarly = await exists(join(home, 'second-entered')) + } catch (error) { checkpointError = error } finally { + for (const id of ['first', 'second']) { + await writeFile(join(home, `${id}-resume`), '') + await writeFile(join(home, `${id}-commit`), '') + } + const finished = await Promise.race([Promise.all(processes.map(child => child.exited)).then(() => true), Bun.sleep(12000).then(() => false)]) + if (!finished) { for (const child of processes) child.kill(); await Promise.all(processes.map(child => child.exited)) } + } + try { + if (checkpointError) throw checkpointError + expect(await Promise.all(processes.map(child => child.exited))).toEqual([0, 0]) + expect(secondObservedFresh).toBe(true) + expect(secondEnteredEarly).toBe(false) + const inventory = JSON.parse(await readFile(join(home, '.skillhub/inventory.json'), 'utf8')) as { items: { slug: string }[] } + expect(inventory.items.map(item => item.slug).sort()).toEqual(['first', 'second']) + expect(await exists(lockPath)).toBe(false) + expect(await readdir(`${lockPath}.acquire`)).toEqual([]) + } finally { await rm(home, { recursive: true, force: true }) } +}, 30000) + +for (const kind of ['choosing', 'ticket'] as const) { + test(`bounded acquisition preserves a live ${kind} owner and removes only its own contender`, async () => { + const root = await mkdtemp(join(tmpdir(), 'skillhub-gate-timeout-')) + const owner = kind === 'choosing' ? `choosing.${process.pid}-suspended` : `ticket.1.${process.pid}-suspended` + await writeFile(join(root, owner), '') + try { + await expect(acquireAcquisitionGate(root, 50)).rejects.toMatchObject({ code: 'ELOCKED' }) + expect(await readdir(root)).toEqual([owner]) + } finally { await rm(root, { recursive: true, force: true }) } + }) +} + +test('inventory acquisition stops waiting for a live suspended gate owner without mutating inventory', async () => { + const home = await mkdtemp(join(tmpdir(), 'skillhub-inventory-timeout-')) + const store = new InventoryStore(home) + const gate = `${store.path}.lock.acquire` + await mkdir(gate, { recursive: true }) + const owner = `ticket.1.${process.pid}-suspended` + await writeFile(join(gate, owner), '') + let inspected = false + try { + await expect(store.withLockedSnapshot(async () => { inspected = true })).rejects.toMatchObject({ code: 'ELOCKED' }) + expect(inspected).toBe(false) + expect(await exists(store.path)).toBe(false) + expect(await readdir(gate)).toEqual([owner]) + await rm(join(gate, owner)) + await store.withLockedSnapshot(async () => { inspected = true }) + expect(inspected).toBe(true) + expect(await readdir(gate)).toEqual([]) + } finally { await rm(home, { recursive: true, force: true }) } +}, 15000) diff --git a/docs/research/dsh-native-plugin-2026-10-12/ci-ce310918b-result.json b/docs/research/dsh-native-plugin-2026-10-12/ci-ce310918b-result.json new file mode 100644 index 000000000..bcc5a9788 --- /dev/null +++ b/docs/research/dsh-native-plugin-2026-10-12/ci-ce310918b-result.json @@ -0,0 +1,138 @@ +{ + "commit": "ce310918bd658120f96a43f23bf731bbb0724e24", + "workflow": "https://github.com/iflytek/skillhub/actions/runs/38717624467", + "conclusion": "failure", + "reports": [ + { + "artifact": "skillhub-dsh-host-smoke-macos-latest-node-24", + "summary": { + "passed": true, + "platform": "darwin", + "node": "24.20.0", + "dsh": "0.2.0-rc.2", + "pnpm": "10.33.0", + "artifactSha256": "9e3501dbed315748d2f425ab82fe16c0e287d0e3c03a465858d6091d0f1e6c5c", + "modelCalled": false, + "stage": "complete", + "probes": [ + { + "name": "runtime-baseline", + "passed": true + }, + { + "name": "plugin-lifecycle", + "passed": true + } + ] + } + }, + { + "artifact": "skillhub-dsh-host-smoke-ubuntu-latest-node-24", + "summary": { + "passed": true, + "platform": "linux", + "node": "24.21.0", + "dsh": "0.2.0-rc.2", + "pnpm": "10.33.0", + "artifactSha256": "9e3501dbed315748d2f425ab82fe16c0e287d0e3c03a465858d6091d0f1e6c5c", + "modelCalled": false, + "stage": "complete", + "probes": [ + { + "name": "runtime-baseline", + "passed": true + }, + { + "name": "plugin-lifecycle", + "passed": true + } + ] + } + }, + { + "artifact": "skillhub-dsh-host-smoke-ubuntu-latest-node-24.2.0", + "summary": { + "passed": true, + "platform": "linux", + "node": "24.2.0", + "dsh": "0.2.0-rc.2", + "pnpm": "10.33.0", + "artifactSha256": "9e3501dbed315748d2f425ab82fe16c0e287d0e3c03a465858d6091d0f1e6c5c", + "modelCalled": false, + "stage": "complete", + "probes": [ + { + "name": "runtime-baseline", + "passed": true + }, + { + "name": "plugin-lifecycle", + "passed": true + } + ] + } + }, + { + "artifact": "skillhub-dsh-host-smoke-windows-latest-node-24", + "summary": { + "passed": true, + "platform": "win32", + "node": "24.21.0", + "dsh": "0.2.0-rc.2", + "pnpm": "10.33.0", + "artifactSha256": "b37fd89a7dc971e19cef414f0c0733d39dbf2732bc4f8a8da49312c9fb1cd2db", + "modelCalled": false, + "stage": "complete", + "probes": [ + { + "name": "runtime-baseline", + "passed": true + }, + { + "name": "plugin-lifecycle", + "passed": true + } + ] + } + }, + { + "artifact": "skillhub-dsh-host-smoke-windows-latest-node-24.2.0", + "summary": { + "passed": true, + "platform": "win32", + "node": "24.2.0", + "dsh": "0.2.0-rc.2", + "pnpm": "10.33.0", + "artifactSha256": "b37fd89a7dc971e19cef414f0c0733d39dbf2732bc4f8a8da49312c9fb1cd2db", + "modelCalled": false, + "stage": "complete", + "probes": [ + { + "name": "runtime-baseline", + "passed": true + }, + { + "name": "plugin-lifecycle", + "passed": true + } + ] + } + } + ], + "failure": { + "job": "macos-latest / Node 24.2.0", + "stage": "Check shared CLI", + "test": "two parallel installs recover the same stale lock and preserve both inventory items", + "expected": [ + "first", + "second" + ], + "actual": [ + "first" + ], + "passedTests": 698, + "failedTests": 1, + "hostSmokeExecuted": false + }, + "disposition": "Investigate stale-lock mutual exclusion; do not rerun to replace the failed evidence." +} diff --git a/docs/research/dsh-native-plugin-2026-10-12/inventory-stale-lock-result.json b/docs/research/dsh-native-plugin-2026-10-12/inventory-stale-lock-result.json new file mode 100644 index 000000000..fb62f9bf3 --- /dev/null +++ b/docs/research/dsh-native-plugin-2026-10-12/inventory-stale-lock-result.json @@ -0,0 +1,70 @@ +{ + "originalCi": { + "workflow": "https://github.com/iflytek/skillhub/actions/runs/38717624467", + "commit": "ce310918bd658120f96a43f23bf731bbb0724e24", + "platform": "macos-latest", + "node": "24.2.0", + "test": "two parallel installs recover the same stale lock and preserve both inventory items", + "failure": "Both processes exited successfully but inventory omitted the second item.", + "passed": 698, + "failed": 1 + }, + "diagnosis": { + "cause": "Inventory acquisition called proper-lockfile without serializing stale recovery. Two stale stat snapshots allow the later rmdir to delete the first contender replacement lock.", + "deterministicMethod": "Two real subprocesses pause callbacks after reading the same stale lock stat. The first enters inventory mutation and waits before commit; the second resumes its stale callback while the first remains inside. Filesystem reads, deletion, lock creation and inventory commits are real.", + "beforeFix": "The second process entered the critical section before the first released its lock.", + "afterFix": "The second contender waits outside stale recovery, observes the fresh replacement lock, enters only after release, and both inventory items persist." + }, + "change": { + "mechanism": "Reuse the existing PID and nonce acquisition gate for inventory lock acquisition only.", + "inventoryAcquisitionBudgetMs": 10000, + "retryBoundary": "The remaining budget is passed to proper-lockfile maxRetryTime; an already scheduled retry can add up to the existing 1000 ms maximum polling interval, excluding filesystem scheduling delays.", + "gateTimeoutCode": "ELOCKED", + "timeoutCleanup": "Remove only the current contender files, retain the live owner, and permit normal acquisition after the owner disappears.", + "targetGateDefault": "Unchanged; optional timeout is supplied only by inventory.", + "unchanged": [ + "inventory schema", + "30000 ms stale threshold", + "10000 ms heartbeat interval", + "target-before-inventory lock order", + "inventory critical section and commit checks" + ] + }, + "verification": { + "testedState": "Working-tree fix based on the original CI commit; not a remote macOS result.", + "platform": "linux", + "bun": "1.3.14", + "fullCli": { + "command": "make test-cli", + "passed": 703, + "failed": 0, + "assertions": 3028, + "files": 68, + "durationSeconds": 234.25 + }, + "boundedGateAndDeterministicRace": { + "passed": 4, + "failed": 0, + "assertions": 16 + }, + "existingGateOwnerRecovery": { + "passed": 3, + "failed": 0, + "assertions": 7 + }, + "typecheck": { + "command": "cd cli && bun run typecheck", + "passed": true + }, + "lint": { + "command": "cd cli && bun run lint", + "passed": true + } + }, + "limits": [ + "The corrected candidate still requires remote macOS CI verification.", + "The plugin must be rebuilt to embed the corrected shared core.", + "An older CLI that does not participate in the acquisition gate can still perform unsafe concurrent stale recovery; mixed old and corrected processes are not covered.", + "This evidence does not resolve the independent DSH root session-adapter restart defect." + ] +} diff --git a/docs/research/dsh-native-plugin-2026-10-12/official-host-restart-result.json b/docs/research/dsh-native-plugin-2026-10-12/official-host-restart-result.json new file mode 100644 index 000000000..9124a9574 --- /dev/null +++ b/docs/research/dsh-native-plugin-2026-10-12/official-host-restart-result.json @@ -0,0 +1,208 @@ +{ + "dsh": "0.2.0-rc.2", + "node": "24.2.0", + "pluginInstalled": false, + "observerLoaded": false, + "modelCalled": false, + "emptySessionRequired": false, + "stages": [ + { + "stage": "stop-1", + "ms": 8490 + }, + { + "stage": "restart-1", + "ms": 12008 + } + ], + "errors": [ + { + "stage": "restart-1", + "ms": 15148, + "message": "scope 'session-maybe' rendered without an installed adapter" + } + ], + "reproduced": true, + "rounds": 1, + "profileDependenciesEmpty": true, + "officialModulesOnly": true, + "officialModuleCount": 65, + "bootGraph": { + "type": "boot", + "ms": 8307, + "revision": "c8506351ac19", + "entryCount": 65, + "watched": { + "@deepseek-ai/dsh-client-ui-session": { + "present": true, + "revision": "5bcef4ae7c68" + }, + "@deepseek-ai/dsh-api-session-controller": { + "present": true, + "revision": "dd503f1ab748" + }, + "@deepseek-ai/dsh-api-remotes": { + "present": true, + "revision": "b24bad44ca2f" + }, + "@deepseek-ai/dsh-api-gateway": { + "present": true, + "revision": "65445d6930ad" + } + } + }, + "graphEvents": [ + { + "type": "open", + "ms": 7676 + }, + { + "type": "graph", + "ms": 7677, + "revision": "c8506351ac19", + "entryCount": 65, + "watched": { + "@deepseek-ai/dsh-client-ui-session": { + "present": true, + "revision": "5bcef4ae7c68" + }, + "@deepseek-ai/dsh-api-session-controller": { + "present": true, + "revision": "dd503f1ab748" + }, + "@deepseek-ai/dsh-api-remotes": { + "present": true, + "revision": "b24bad44ca2f" + }, + "@deepseek-ai/dsh-api-gateway": { + "present": true, + "revision": "65445d6930ad" + } + } + }, + { + "type": "error", + "ms": 8576 + }, + { + "type": "error", + "ms": 11583 + }, + { + "type": "open", + "ms": 14856 + }, + { + "type": "graph", + "ms": 14857, + "revision": "799f8a4fd7e9", + "entryCount": 59, + "watched": { + "@deepseek-ai/dsh-client-ui-session": { + "present": true, + "revision": "5bcef4ae7c68" + }, + "@deepseek-ai/dsh-api-session-controller": { + "present": false, + "revision": null + }, + "@deepseek-ai/dsh-api-remotes": { + "present": true, + "revision": "b24bad44ca2f" + }, + "@deepseek-ai/dsh-api-gateway": { + "present": false, + "revision": null + } + } + }, + { + "type": "graph", + "ms": 15990, + "revision": "389ab820c810", + "entryCount": 60, + "watched": { + "@deepseek-ai/dsh-client-ui-session": { + "present": true, + "revision": "5bcef4ae7c68" + }, + "@deepseek-ai/dsh-api-session-controller": { + "present": false, + "revision": null + }, + "@deepseek-ai/dsh-api-remotes": { + "present": true, + "revision": "b24bad44ca2f" + }, + "@deepseek-ai/dsh-api-gateway": { + "present": false, + "revision": null + } + } + }, + { + "type": "graph", + "ms": 16830, + "revision": "3090eda88e9a", + "entryCount": 64, + "watched": { + "@deepseek-ai/dsh-client-ui-session": { + "present": true, + "revision": "5bcef4ae7c68" + }, + "@deepseek-ai/dsh-api-session-controller": { + "present": true, + "revision": "dd503f1ab748" + }, + "@deepseek-ai/dsh-api-remotes": { + "present": true, + "revision": "b24bad44ca2f" + }, + "@deepseek-ai/dsh-api-gateway": { + "present": false, + "revision": null + } + } + }, + { + "type": "graph", + "ms": 16833, + "revision": "dcc5834aa002", + "entryCount": 65, + "watched": { + "@deepseek-ai/dsh-client-ui-session": { + "present": true, + "revision": "5bcef4ae7c68" + }, + "@deepseek-ai/dsh-api-session-controller": { + "present": true, + "revision": "dd503f1ab748" + }, + "@deepseek-ai/dsh-api-remotes": { + "present": true, + "revision": "b24bad44ca2f" + }, + "@deepseek-ai/dsh-api-gateway": { + "present": true, + "revision": "65445d6930ad" + } + } + } + ], + "domObservations": [ + { + "stage": "stop-1", + "ms": 11836, + "empty": false, + "reconnectingVisible": true + }, + { + "stage": "restart-1", + "ms": 27970, + "empty": true, + "reconnectingVisible": false + } + ], + "controlScriptSha256": "5fe5078c31a74ab8a26318ba7427fd3723ac9e3d6967b42ff6d9c16910371627", + "conclusion": "The same session-maybe adapter error and blank page occurred in an official RC.2 default Web Profile without SkillHub while restarting the Host on the same port. This establishes an independent upstream reproduction, not an exemption from plugin acceptance or evidence about other DSH versions." +} diff --git a/docs/research/dsh-native-plugin-2026-10-12/operation-details-host-result.json b/docs/research/dsh-native-plugin-2026-10-12/operation-details-host-result.json index 15a9878f8..c64565cfe 100644 --- a/docs/research/dsh-native-plugin-2026-10-12/operation-details-host-result.json +++ b/docs/research/dsh-native-plugin-2026-10-12/operation-details-host-result.json @@ -125,7 +125,7 @@ "scope 'session-maybe' rendered without an installed adapter" ] }, - "remaining": "Missing session adapter during full Host disconnection remains unresolved. The uiSession dependency candidate still reproduces it; the no-plugin full Host control has not reached a disconnect cycle.", + "remaining": "Final candidate business/history success and recovery checks, including UI afterVersion text and strict zero-pageerror assertions, passed in two serial runs. Official RC.2 restart adapter failure remains independently reproduced without SkillHub; seamless reconnection and aggregate cross-platform acceptance remain open. Earlier failures and partial-build coverage caveats are retained.", "uiSessionDependencyCandidate": { "artifact": { "sourceIdentity": { @@ -138,12 +138,13 @@ "plugins/dsh/src/host/runtime-compatibility.ts": "2165d9d82a31f42154b8acc3413f3231473bb1acad4772bb3f50f9d9a78dfa5e" } }, - "rebuiltFromCurrentSource": true, + "rebuiltFromCurrentSource": false, "sha256": "8a27c233ae84c2c3bc8444331853cdaad8d64336626d212d1ee8eee4bff07f91", "installedMatches": 6, "dsh": "0.2.0-rc.2", "node": "24.2.0", - "modelCalled": false + "modelCalled": false, + "sourceCoverageCaveat": "The captured source identity includes the ui-session Host compatibility baseline, but lib/index.js in this artifact does not include that final baseline change. Client lifecycle dependency changes are present. This artifact must not be presented as a clean ce310918b build." }, "runs": { "recoveryImmediateFocus": { @@ -293,102 +294,288 @@ "interpretation": "Result projection and recovery have passing evidence. A bounded-focus recovery pass does not erase the prior focus failure; the success run still records a missing session adapter during Host disconnection." }, "officialHostDisconnectControl": { - "status": "incomplete", + "status": "reproduced-without-plugin", + "evidence": "official-host-restart-result.json", "dsh": "0.2.0-rc.2", "node": "24.2.0", + "completedRounds": 1, "modelCalled": false, - "pluginInstalled": false, - "observerLoaded": false, - "freshProfileDependenciesEmpty": true, - "freshProfileDefaultOverlayUnmodified": true, - "officialClientModuleIdsObservedDuringEarlierPreparation": [ - "@deepseek-ai/dsh-api-gateway", - "@deepseek-ai/dsh-api-job-controller", - "@deepseek-ai/dsh-api-remotes", - "@deepseek-ai/dsh-api-session-controller", - "@deepseek-ai/dsh-api-terminal-controller", - "@deepseek-ai/dsh-api-workspace-controller", - "@deepseek-ai/dsh-api-workspace-files", - "@deepseek-ai/dsh-client-connection", - "@deepseek-ai/dsh-client-file-upload", - "@deepseek-ai/dsh-client-hmr", - "@deepseek-ai/dsh-client-locale", - "@deepseek-ai/dsh-client-modules", - "@deepseek-ai/dsh-client-resources", - "@deepseek-ai/dsh-client-shortcuts", - "@deepseek-ai/dsh-client-ui-agent-preset", - "@deepseek-ai/dsh-client-ui-approval", - "@deepseek-ai/dsh-client-ui-attachment", - "@deepseek-ai/dsh-client-ui-brand-official", - "@deepseek-ai/dsh-client-ui-chat", - "@deepseek-ai/dsh-client-ui-commands", - "@deepseek-ai/dsh-client-ui-conversation", - "@deepseek-ai/dsh-client-ui-cordis", - "@deepseek-ai/dsh-client-ui-deliverables", - "@deepseek-ai/dsh-client-ui-directory-picker-browse", - "@deepseek-ai/dsh-client-ui-goal", - "@deepseek-ai/dsh-client-ui-input-trigger", - "@deepseek-ai/dsh-client-ui-jobs", - "@deepseek-ai/dsh-client-ui-layout", - "@deepseek-ai/dsh-client-ui-message-feedback", - "@deepseek-ai/dsh-client-ui-model-selection", - "@deepseek-ai/dsh-client-ui-open-in-app", - "@deepseek-ai/dsh-client-ui-permission-presets", - "@deepseek-ai/dsh-client-ui-plan", - "@deepseek-ai/dsh-client-ui-plugin-manager", - "@deepseek-ai/dsh-client-ui-reference", - "@deepseek-ai/dsh-client-ui-renderer", - "@deepseek-ai/dsh-client-ui-session", - "@deepseek-ai/dsh-client-ui-settings", - "@deepseek-ai/dsh-client-ui-settings-account", - "@deepseek-ai/dsh-client-ui-settings-agent-loop", - "@deepseek-ai/dsh-client-ui-settings-general", - "@deepseek-ai/dsh-client-ui-settings-models", - "@deepseek-ai/dsh-client-ui-settings-plugin-inventory", - "@deepseek-ai/dsh-client-ui-settings-plugins", - "@deepseek-ai/dsh-client-ui-settings-session-log", - "@deepseek-ai/dsh-client-ui-settings-shell", - "@deepseek-ai/dsh-client-ui-settings-subagent", - "@deepseek-ai/dsh-client-ui-settings-web-search", - "@deepseek-ai/dsh-client-ui-shortcuts", - "@deepseek-ai/dsh-client-ui-sidebar", - "@deepseek-ai/dsh-client-ui-sidebar-documentpreview", - "@deepseek-ai/dsh-client-ui-sidebar-files", - "@deepseek-ai/dsh-client-ui-sidebar-right", - "@deepseek-ai/dsh-client-ui-sidebar-terminal", - "@deepseek-ai/dsh-client-ui-skill", - "@deepseek-ai/dsh-client-ui-subagent", - "@deepseek-ai/dsh-client-ui-theme", - "@deepseek-ai/dsh-client-ui-tool", - "@deepseek-ai/dsh-client-ui-trajectory", - "@deepseek-ai/dsh-client-ui-user-questions", - "@deepseek-ai/dsh-client-ui-workflow-run", - "@deepseek-ai/dsh-client-ui-workspace", - "@deepseek-ai/dsh-cordis-client-runner", - "@deepseek-ai/dsh-session-log-export", - "@deepseek-ai/dsh-typert-registry" - ], - "completedDisconnectCycles": 0, - "emptySessionCreationVerified": false, - "preparationFailures": [ - "DEFAULT_WORKSPACE_CREATION_UNAVAILABLE", - "CLIENT_SESSION_CONTEXT_NOT_READY", - "HOST_READY_TIMEOUT" - ], - "hostReadyTimeoutMs": 60000, - "startupTimeoutsObserved": 2, - "startupLogBytesAtTimeout": [ - 0, - 0 - ], - "retrySkipped": true, - "skipReason": "INSUFFICIENT_LOCAL_MEMORY", - "resourceObservation": { - "availableMemoryMiB": 838, - "swapTotalMiB": 8192, - "swapUsedMiB": 8192 + "independentOfficialHostReproduction": true, + "pluginAcceptanceExempted": false + }, + "officialHostDisconnectControlHistory": [ + { + "status": "incomplete", + "dsh": "0.2.0-rc.2", + "node": "24.2.0", + "modelCalled": false, + "pluginInstalled": false, + "observerLoaded": false, + "freshProfileDependenciesEmpty": true, + "freshProfileDefaultOverlayUnmodified": true, + "officialClientModuleIdsObservedDuringEarlierPreparation": [ + "@deepseek-ai/dsh-api-gateway", + "@deepseek-ai/dsh-api-job-controller", + "@deepseek-ai/dsh-api-remotes", + "@deepseek-ai/dsh-api-session-controller", + "@deepseek-ai/dsh-api-terminal-controller", + "@deepseek-ai/dsh-api-workspace-controller", + "@deepseek-ai/dsh-api-workspace-files", + "@deepseek-ai/dsh-client-connection", + "@deepseek-ai/dsh-client-file-upload", + "@deepseek-ai/dsh-client-hmr", + "@deepseek-ai/dsh-client-locale", + "@deepseek-ai/dsh-client-modules", + "@deepseek-ai/dsh-client-resources", + "@deepseek-ai/dsh-client-shortcuts", + "@deepseek-ai/dsh-client-ui-agent-preset", + "@deepseek-ai/dsh-client-ui-approval", + "@deepseek-ai/dsh-client-ui-attachment", + "@deepseek-ai/dsh-client-ui-brand-official", + "@deepseek-ai/dsh-client-ui-chat", + "@deepseek-ai/dsh-client-ui-commands", + "@deepseek-ai/dsh-client-ui-conversation", + "@deepseek-ai/dsh-client-ui-cordis", + "@deepseek-ai/dsh-client-ui-deliverables", + "@deepseek-ai/dsh-client-ui-directory-picker-browse", + "@deepseek-ai/dsh-client-ui-goal", + "@deepseek-ai/dsh-client-ui-input-trigger", + "@deepseek-ai/dsh-client-ui-jobs", + "@deepseek-ai/dsh-client-ui-layout", + "@deepseek-ai/dsh-client-ui-message-feedback", + "@deepseek-ai/dsh-client-ui-model-selection", + "@deepseek-ai/dsh-client-ui-open-in-app", + "@deepseek-ai/dsh-client-ui-permission-presets", + "@deepseek-ai/dsh-client-ui-plan", + "@deepseek-ai/dsh-client-ui-plugin-manager", + "@deepseek-ai/dsh-client-ui-reference", + "@deepseek-ai/dsh-client-ui-renderer", + "@deepseek-ai/dsh-client-ui-session", + "@deepseek-ai/dsh-client-ui-settings", + "@deepseek-ai/dsh-client-ui-settings-account", + "@deepseek-ai/dsh-client-ui-settings-agent-loop", + "@deepseek-ai/dsh-client-ui-settings-general", + "@deepseek-ai/dsh-client-ui-settings-models", + "@deepseek-ai/dsh-client-ui-settings-plugin-inventory", + "@deepseek-ai/dsh-client-ui-settings-plugins", + "@deepseek-ai/dsh-client-ui-settings-session-log", + "@deepseek-ai/dsh-client-ui-settings-shell", + "@deepseek-ai/dsh-client-ui-settings-subagent", + "@deepseek-ai/dsh-client-ui-settings-web-search", + "@deepseek-ai/dsh-client-ui-shortcuts", + "@deepseek-ai/dsh-client-ui-sidebar", + "@deepseek-ai/dsh-client-ui-sidebar-documentpreview", + "@deepseek-ai/dsh-client-ui-sidebar-files", + "@deepseek-ai/dsh-client-ui-sidebar-right", + "@deepseek-ai/dsh-client-ui-sidebar-terminal", + "@deepseek-ai/dsh-client-ui-skill", + "@deepseek-ai/dsh-client-ui-subagent", + "@deepseek-ai/dsh-client-ui-theme", + "@deepseek-ai/dsh-client-ui-tool", + "@deepseek-ai/dsh-client-ui-trajectory", + "@deepseek-ai/dsh-client-ui-user-questions", + "@deepseek-ai/dsh-client-ui-workflow-run", + "@deepseek-ai/dsh-client-ui-workspace", + "@deepseek-ai/dsh-cordis-client-runner", + "@deepseek-ai/dsh-session-log-export", + "@deepseek-ai/dsh-typert-registry" + ], + "completedDisconnectCycles": 0, + "emptySessionCreationVerified": false, + "preparationFailures": [ + "DEFAULT_WORKSPACE_CREATION_UNAVAILABLE", + "CLIENT_SESSION_CONTEXT_NOT_READY", + "HOST_READY_TIMEOUT" + ], + "hostReadyTimeoutMs": 60000, + "startupTimeoutsObserved": 2, + "startupLogBytesAtTimeout": [ + 0, + 0 + ], + "retrySkipped": true, + "skipReason": "INSUFFICIENT_LOCAL_MEMORY", + "resourceObservation": { + "availableMemoryMiB": 838, + "swapTotalMiB": 8192, + "swapUsedMiB": 8192 + }, + "controlScriptSha256": "0030d8d2b707cc894528094131b08fa54b8976efff87bece1ffd5ec960a05640", + "interpretation": "No full official Host disconnect attribution is established. Resource pressure coincided with startup timeouts but causation was not proven. This turn did not retry because memory had not recovered." + } + ], + "boundedInventoryGateCandidate": { + "artifact": { + "sourceIdentity": { + "commit": "ce310918bd658120f96a43f23bf731bbb0724e24", + "productionDiffSha256": "cf4312035fe067721803cfbd3ed0529384a05c2415cfa96981bce7852c0d11ca", + "sourceSha256": { + "plugins/dsh/src/client/index.tsx": "597c15b0aab1ca0583af8805caa803205cb1391471677b862ac0e569a5c8e09b", + "plugins/dsh/src/host/runtime-compatibility.ts": "2165d9d82a31f42154b8acc3413f3231473bb1acad4772bb3f50f9d9a78dfa5e", + "cli/src/services/skill-target-lock.ts": "6485584f4544aaba43c83f365531c2efe6c0a047264e429003572922241ee16e", + "cli/src/stores/inventory-store.ts": "c7bbc05b7d0dec25ce64f3362ddc8a358a5cb21123ea06463a068c75d8016b36" + } + }, + "rebuiltFromCurrentSource": true, + "sha256": "6b998d95d4c4022e442a4f063c0fff6db856081c6ff324e8c424a61d53ad9174", + "builtArtifactFilesSha256": { + "lib/index.js": "64c71067a07baba15f7a18e7cfdad775d590118d0ead765d1f4b6fffe9b8e308", + "lib/local-core.js": "7af628ebce85add691c71ee09075fe2f19c8aed55fe149ebdc08bde5e5be3197", + "lib/client.js": "bd2870df2c1af3537e73d58247302b6915b6ac38f44955134a0cb76a18af1272", + "lib/typert.host.js": "017962cb52aa5649d42c499ed939ca5630314313bae77cc66badddf193edd461", + "lib/typert.remote-client.js": "50572e03589dc268052d5d8e4f3c81f92686b478e8e220ff79b64a01f1ce5c0f", + "cordis.patch.yml": "68dce040858b95527d4016513134b88a2697a463e0f8c501f21ddd0353937c1a" + }, + "uiSessionBaselinePresent": true, + "boundedInventoryGatePresent": true, + "dsh": "0.2.0-rc.2", + "node": "24.2.0", + "modelCalled": false }, - "controlScriptSha256": "0030d8d2b707cc894528094131b08fa54b8976efff87bece1ffd5ec960a05640", - "interpretation": "No full official Host disconnect attribution is established. Resource pressure coincided with startup timeouts but causation was not proven. This turn did not retry because memory had not recovered." + "probeSha256": { + "plugins/dsh/test/integration/upgrade-recovery-probe.mjs": "bc375546ef8f666bf40ab038c16f5ef307aa0d4f07dd7e97b0c1881aa23bf98b", + "plugins/dsh/test/integration/dual-upgrade-restart.py": "1ca8abb286abc85c05f609c44e8993606314e46e5fb66388d7049b3989135e6f" + }, + "freshProfiles": true, + "sameArtifactForBothRuns": true, + "installedFilesMatchedPerProfile": 6, + "successAfterHostRestart": { + "passed": true, + "node": "24.2.0", + "forcedProcessExit": false, + "oldHostExited": true, + "newHostStarted": true, + "distinctProcesses": true, + "samePort": true, + "targetCount": 2, + "mixedStateBeforeRestart": false, + "allTargetHashesRestored": false, + "inventoryUnchanged": false, + "operationRecovery": "not-needed", + "completedUpgrade": true, + "browser": { + "passed": true, + "operationId": "0fd7430f-30e6-4ddd-b379-78b705e0ee22", + "expectedTargets": 2, + "submissions": 1, + "recoveries": 0, + "hostRestartRequested": true, + "originalOperationDetailsVerified": true, + "errors": [], + "verifiedDetails": [ + { + "operationId": "0fd7430f-30e6-4ddd-b379-78b705e0ee22", + "outcome": "upgraded", + "beforeVersion": "1.2.0", + "afterVersion": "1.3.0", + "warnings": [], + "targets": [ + { + "label": "目标 1(确认计划顺序)", + "outcome": "upgraded" + }, + { + "label": "目标 2(确认计划顺序)", + "outcome": "upgraded" + } + ] + } + ], + "afterVersionTextAssertionPassed": true + } + }, + "recoveryAfterHostRestart": { + "passed": true, + "node": "24.2.0", + "forcedProcessExit": false, + "oldHostExited": true, + "newHostStarted": true, + "distinctProcesses": true, + "samePort": true, + "targetCount": 2, + "mixedStateBeforeRestart": true, + "allTargetHashesRestored": true, + "inventoryUnchanged": true, + "operationRecovery": "restored", + "completedUpgrade": false, + "browser": { + "passed": true, + "operationId": "2a67b035-a846-43c8-9610-0e5d783fa85d", + "expectedTargets": 2, + "submissions": 1, + "recoveries": 1, + "hostRestartRequested": true, + "originalOperationDetailsVerified": true, + "historyAfterReload": true, + "forcedProcessExit": false, + "leaseRefusalAndExplicitRetryVerified": false, + "recoveryResponseLossVerified": true, + "oldVersionVisible": true, + "closeFocusVerified": true, + "focusWaitMs": 21, + "errors": [], + "verifiedDetails": [ + { + "operationId": "2a67b035-a846-43c8-9610-0e5d783fa85d", + "outcome": "unknown", + "beforeVersion": "1.2.0", + "afterVersion": null, + "warnings": [], + "targets": [ + { + "label": "目标 1(确认计划顺序)", + "outcome": "unknown" + }, + { + "label": "目标 2(确认计划顺序)", + "outcome": "unknown" + } + ] + }, + { + "operationId": "2a67b035-a846-43c8-9610-0e5d783fa85d", + "outcome": "restored", + "beforeVersion": "1.2.0", + "afterVersion": null, + "warnings": [], + "targets": [ + { + "label": "目标 1(确认计划顺序)", + "outcome": "restored" + }, + { + "label": "目标 2(确认计划顺序)", + "outcome": "restored" + } + ] + } + ], + "afterVersionTextAssertionPassed": true + } + }, + "navigationConditions": [ + "Original browser tab and sessionStorage retained", + "Same origin and same isolated Profile after normal Host stop and restart", + "Navigate using restarted Host current entry after Host ready", + "Original session and Registry used to query original operationId" + ], + "acceptanceBoundary": "These two runs passed their strict zero-pageerror assertions and verify business/history display after explicit navigation. They do not erase earlier intermittent restart failures or establish seamless automatic reconnection; official RC.2 no-plugin reproduction remains a compatibility limitation.", + "modelCalled": false, + "postHostChecks": { + "commands": [ + "bun run typecheck", + "bun run lint", + "bun test" + ], + "typecheckPassed": true, + "lintPassed": true, + "testsPassed": 201, + "testsFailed": 0, + "testFiles": 52, + "assertions": 3214, + "bunVersion": "1.3.14", + "artifactHashesUnchanged": true, + "productionDiffHashUnchanged": true + } } } diff --git a/openspec/changes/add-dsh-native-plugin/acceptance.md b/openspec/changes/add-dsh-native-plugin/acceptance.md index 08e1b09ad..745ac00a1 100644 --- a/openspec/changes/add-dsh-native-plugin/acceptance.md +++ b/openspec/changes/add-dsh-native-plugin/acceptance.md @@ -138,10 +138,10 @@ A05/A11/A12 已取得模型安装、资源使用、歧义选择及官方停止 | --- | --- | --- | | 5.4 本地平台与远程 Host | Linux/Windows 有实包及生命周期分项报告;最近搜索条目改动已在两平台回归。独立远程 Host 未验证 | 提供授权测试 Host、连接配置位置及可写测试目录,核验远程用户/项目落点与浏览器机器不写技能文件;汇总最终平台报告 | | A13 当前服务端与 SaaS | 后端测试、OpenAPI 及真实开源测试实例有证据;不等同于当前工作树部署,也不等同于 SaaS | 在指定测试部署中验证当前后端契约;SaaS 按同步清单另行执行,未完成不声明兼容 | -| 10.4 远端 CI | Draft PR [#956](https://github.com/iflytek/skillhub/pull/956) 的 [c21a1753e 矩阵](../../../docs/research/dsh-native-plugin-2026-10-12/ci-c21a1753e-result.json)六项通过,包含操作结果详情代码的真实 Host 基线与生命周期;此前 Windows Node 24.2 下载超时报告保留。本轮 uiSession 依赖修复仍需新提交矩阵验证 | 在最终修复提交上完成工作流并保留产物证据;macOS 产品验收仍按用户决定后置 | +| 10.4 远端 CI | Draft PR [#956](https://github.com/iflytek/skillhub/pull/956) 的 [c21a1753e 矩阵](../../../docs/research/dsh-native-plugin-2026-10-12/ci-c21a1753e-result.json)六项通过,包含操作结果详情代码的真实 Host 基线与生命周期;此前 Windows Node 24.2 下载超时报告保留。[ce310918b 矩阵](../../../docs/research/dsh-native-plugin-2026-10-12/ci-ce310918b-result.json)五项通过,macOS / Node 24.2 在共享 CLI 并发恢复过期锁测试中丢失一条清单记录;已确定性复现,待修复后验证,不以重复运行覆盖失败 | 在最终修复提交上完成工作流并保留产物证据;macOS 产品验收仍按用户决定后置 | | 10.1/10.5 正式兼容基线 | RC.2 研发组合、门禁、混装拒绝和开发产物回退有证据;正式支持未声明 | 根据最终平台、宿主及回退报告确认唯一支持组合,不通过改写版本字段绕过检查 | | 9.5 候选与正式发布包 | 当前开发候选清单、身份检查和实包回归通过;没有已发布包 | 确认正式版本与发布权限,关联最终候选;获准发布后下载实际包并完成干净安装、功能与完整性验证 | -| 7.5 操作结果及重连 | [真实 Host 记录](../../../docs/research/dsh-native-plugin-2026-10-12/operation-details-host-result.json)保留双目标成功与恢复证据;uiSession 修复后恢复链路通过,成功升级重启期间仍有适配器缺失错误。[官方组件复现](../../../docs/research/dsh-native-plugin-2026-10-12/session-adapter-disposal-result.json)不能替代完整 Host 归因;无插件 Host 对照未完成,本轮因资源不足未重试 | 定位断线窗口问题,完成最终候选的成功及恢复重启回归;补齐 UI 新版本文本显式断言,不以 Remote 字段断言代替界面验收 | +| 7.5 操作结果及重连 | [真实 Host 记录](../../../docs/research/dsh-native-plugin-2026-10-12/operation-details-host-result.json)保留双目标成功与恢复证据;uiSession 修复后恢复链路通过,成功升级重启期间仍有适配器缺失错误。[官方无插件完整 Host 对照](../../../docs/research/dsh-native-plugin-2026-10-12/official-host-restart-result.json)已复现相同异常及空白页;重新启动时 SSE 模块图短暂缺少会话依赖,随后模块恢复但页面仍空白 | 最终候选 6b998d95 已完成两条链路及 UI 新版本/未知版本断言,7.5 功能展示验收关闭。验证限原标签页、同 origin、重启后有效入口的显式重新进入;官方自动重连异常仍归 10.1/10.5,不能以本项通过替代正式兼容决定 | | 7.4 总体验收 | A01–A16 已有分组追踪;上述缺口仍存在 | 所有必需门禁都有对应环境证据后再关闭,不能以文档齐全或单平台通过代替 | 本表是现有任务的执行状态,不增加新产品范围,也不豁免原验收条件。开发版本仍为 `private: true`。已获准提交、推送并创建 Draft PR;部署、创建 tag 和发布尚未执行。已通过矩阵仅覆盖对应提交;新增实现仍需最终提交回归,未通过的门禁不标记完成。 diff --git a/openspec/changes/add-dsh-native-plugin/compatibility-design.md b/openspec/changes/add-dsh-native-plugin/compatibility-design.md index 34f5bbfca..4cb7d3707 100644 --- a/openspec/changes/add-dsh-native-plugin/compatibility-design.md +++ b/openspec/changes/add-dsh-native-plugin/compatibility-design.md @@ -145,7 +145,7 @@ CI 使用单一 DSH 基线与受支持平台的矩阵作为发布门禁。新发 ## 8. Host 依赖门禁实现 -插件从自身 Host 模块位置,通过宿主 pluginPackages 服务读取 DSH 主程序、app-boot 和九项 Host 依赖的运行时解析 name/version;通过 clientModules 服务定位七项声明注入的 Client 模块文件并核对所属包清单。每次核验重新读取当前服务及 Client 图,并从 Host 返回的 manifestPath 读取当前磁盘清单;缓存元数据和磁盘清单均须匹配候选精确基线。缺包、无法读取、名称不符或版本不符均拒绝新写请求的准备阶段;已受理请求先按持久记录查重,返回原回执,不因依赖不匹配丢失查询能力或重放写操作。恢复涉及文件写入,也须通过依赖门禁后重新验证当前目标和策略。 +插件从自身 Host 模块位置,通过宿主 pluginPackages 服务读取 DSH 主程序、app-boot 和九项 Host 依赖的运行时解析 name/version;通过 clientModules 服务定位声明注入的 Client 模块(含会话 UI 模块)文件并核对所属包清单。每次核验重新读取当前服务及 Client 图,并从 Host 返回的 manifestPath 读取当前磁盘清单;缓存元数据和磁盘清单均须匹配候选精确基线。缺包、无法读取、名称不符或版本不符均拒绝新写请求的准备阶段;已受理请求先按持久记录查重,返回原回执,不因依赖不匹配丢失查询能力或重放写操作。恢复涉及文件写入,也须通过依赖门禁后重新验证当前目标和策略。 `getCompatibility` 返回依赖基线结果及候选版本,用于页面提示和重新核验;不返回模块路径或加载异常。`localWritesAllowed` 仅表示依赖门禁通过,实际写入仍受会话、文件系统、策略、事务和业务校验限制。 @@ -172,3 +172,10 @@ Node 24.0.0 实测无法启动候选 DSH CLI:其入口依赖 import.meta.main Client 通过官方槽位声明生命周期与 layout/configForms 服务依赖跟踪广场主面板、侧栏、对话卡片和配置入口。某入口不可用时,在仍可呈现的广场或对话卡片顶部显示“SkillHub 部分功能暂不可用”,列出缺失入口;仅在另一入口可用时提供替代路径。配置入口缺失时说明当前来源设置保持不变。未配置来源时,空状态同时说明必须先恢复配置功能,不再引导打开不可用的配置页;入口恢复后在同一页面恢复配置步骤。入口恢复后自动移除对应提示,全部恢复后不显示提示。 该状态只描述 Client 入口可用性,不替代 Host 版本检查或文件写入授权,也不表示 Registry 可访问。主模块无法加载、全部呈现入口同时缺失或渲染本身失败时,插件不能保证显示自己的提示,仍由 DSH 的加载错误及安装说明提供诊断。 + + +### RC.2 Host 重启时的页面恢复限制 + +已在不安装 SkillHub 的官方 RC.2 Web Profile 中复现:保持浏览器打开并在同一端口重启 Host,Client 模块图可能短暂缺少会话依赖,触发 `session-maybe` 适配器缺失并导致空白页;模块图随后恢复也不保证页面自动恢复。证据见 [官方 Host 对照](../../../docs/research/dsh-native-plugin-2026-10-12/official-host-restart-result.json)。结论仅覆盖该 RC.2 组合,不外推其他版本。 + +插件显式依赖 `uiSession`,但不能保证宿主外层渲染器在模块卸载期间仍可用。首版不得宣称 Host 重启后的无缝重连通过。保留原标签页及存储、使用 Host 就绪后的有效入口在同一 origin 重新进入并查询原操作,是独立的恢复验收路径;不以重新提交安装或升级替代原操作查询。最终候选须验证这一流程,并分别记录自动重连失败与手动重新进入后的结果。 diff --git a/openspec/changes/add-dsh-native-plugin/lifecycle-design.md b/openspec/changes/add-dsh-native-plugin/lifecycle-design.md index 79626c695..cdc8c5a25 100644 --- a/openspec/changes/add-dsh-native-plugin/lifecycle-design.md +++ b/openspec/changes/add-dsh-native-plugin/lifecycle-design.md @@ -109,6 +109,8 @@ flowchart TD 升级/卸载使用“prepare → 展示影响 → execute”,安装仍保持详情按钮直接开始。三个操作共用一个 MutationOperation 生命周期。 +共享安装清单在获取文件锁前,复用目标锁的 acquisition gate 串行化过期锁回收;取得清单锁后释放 gate,清单读改写继续由文件锁保护。两个进程不能同时根据同一份过期状态删除锁,从而覆盖新持有者。清单锁获取使用 10 秒重试预算,既有轮询可能增加一次最多约 1 秒的等待,并叠加文件系统及事件循环耗时;该预算不是严格的时间截止,最后一次尝试若成功仍可返回。超时返回锁忙,仅清理自身排队记录,不删除仍存活的其他竞争者。此保证要求参与进程均采用该 gate;与未包含修复的旧 CLI 并发恢复过期锁时,不声明相同保证。清单格式、原锁路径及事务提交边界保持不变。 + | 字段 | 定义 | | --- | --- | | planId | Host 生成的不可猜测引用;Client 不提交原始路径 | diff --git a/openspec/changes/add-dsh-native-plugin/tasks.md b/openspec/changes/add-dsh-native-plugin/tasks.md index 2271244f8..9586dd344 100644 --- a/openspec/changes/add-dsh-native-plugin/tasks.md +++ b/openspec/changes/add-dsh-native-plugin/tasks.md @@ -23,7 +23,7 @@ ## 3. 安装核心与操作协议 - [x] 3.1 实现可信目标、完整包下载、归档/指纹/DSH 格式校验,首次安装不覆盖。(目标/策略/格式、归档和原生安装定向检查 76 tests / 322 assertions 通过;结合真实 Host 用户/项目安装及完整资源核验,见 verification.md“安装核心边界验收”。恢复全矩阵仍归 3.4/5.2。) -- [x] 3.2 下载前锁内幂等检查、提交前重校验、锁顺序与 inventory CAS;同 key 恢复 operation。(操作存储/锁/清单定向回归及已有原生并发实机文件证据通过,见 verification.md“并发与重复请求协议验收”;不替代 3.4/5.2 全故障矩阵。) +- [ ] 3.2 下载前锁内幂等检查、提交前重校验、锁顺序与 inventory CAS;同 key 恢复 operation。(操作存储/锁/清单定向回归及已有原生并发实机文件证据通过,见 verification.md“并发与重复请求协议验收”;不替代 3.4/5.2 全故障矩阵。ce310918b 跨平台 CI 新发现两个进程恢复同一过期清单锁时丢记录;已确定性复现并修复临界区重叠,新增有界等待;最终共享 CLI 703 项回归通过(inventory-stale-lock-result.json),待修复提交的跨平台 CI 通过后关闭。) - [x] 3.3 实现升级/卸载 prepare-execute、5 分钟 plan TTL、来源/项目/记录变化失效和参数重放检查。(计划与完整目标升级定向回归及实际 Host 双目标升级/恢复证据通过,见 verification.md“确认计划与完整目标升级验收”;不替代 5.2 全故障矩阵。) - [x] 3.4a 共享核心加入可等待事务观察器、确定 backup/staging 路径和提交后告警;统一 CLI/插件 canonical lock helper,避免双重取锁。 - [x] 3.4 实现本地原子操作日志、正常关闭和崩溃恢复核验,未解决恢复状态阻止新写。(当前 Linux 真实强杀/恢复矩阵、日志及关闭排空 65 tests / 805 assertions 通过;结合 Windows 实际 Host 强杀恢复,见 verification.md“日志与恢复机制验收”。5.2 场景清单及平台门禁仍分别验收。) @@ -66,7 +66,7 @@ - [x] 7.2 实现 openConversationDetail/acknowledgeConversationDetail 与原搜索引用到已查看固定版本的关联;多版本歧义阻断,不静默解析 latest。(实现及定向测试已补齐早期验证记录中的缺口,见“交付缺口核对”。) - [x] 7.3 安装工具仅返回 accepted;结果卡片从共享 OperationStore/getOperation 展示终态,历史来源、主机、时间来自原快照。(接受成功仅为 accepted;拒绝为 not-confirmed,见“交付缺口核对”。) - [ ] 7.4 按 acceptance.md 逐组留证;阶段顺序以 implementation-design.md 第 9 节为准,日志恢复不后置到写入口上线以后。 -- [ ] 7.5 补齐 lifecycle-design.md §9 与 interface-design.md §5.2 的操作结果展示:核验并提供受影响目标、旧新版本及安全告警信息,覆盖双目标升级与重启后的历史查询。已补 resultDetails 原日志投影、跨目标旧版本保护和四个入口的展示;核心定向回归、真实组件浏览器、双目标真实 Host 升级成功及中断恢复后的历史查询已取得证据(operation-details-host-result.json)。已补齐 uiSession 依赖并通过 201 项插件测试;修复后完整恢复链路通过,但成功升级的 Host 重启断线窗口仍出现 session-maybe 适配器缺失。官方组件卸载可独立复现同类错误,完整无插件 Host 对照尚未完成,不能据此归因。待断线问题定位与回归后关闭。不得透传事务内部路径或原始异常,也不得将当前清单状态冒充原操作结果。 +- [x] 7.5 补齐 lifecycle-design.md §9 与 interface-design.md §5.2 的操作结果展示:原日志投影受影响目标、旧新版本及安全告警,四个入口复用安全详情。最终候选 6b998d95 的双目标升级成功与中断恢复两条真实 Host 链路通过,包含重启后原 operationId 查询、UI 新版/未知版本文案、完整文件和清单核验;插件 201 项测试通过,见 operation-details-host-result.json。验证使用原标签页、同 origin 的有效入口显式重新进入,不代表自动重连;官方 RC.2 无插件同端口重启的空白页问题保留至 10.1/10.5 兼容出口。不得透传事务内部路径或原始异常,不以当前清单状态冒充原操作结果。 ## 8. 原生机制落地检查 diff --git a/plugins/dsh/README.en.md b/plugins/dsh/README.en.md index 03f8c4a1c..b3e73beaa 100644 --- a/plugins/dsh/README.en.md +++ b/plugins/dsh/README.en.md @@ -133,7 +133,9 @@ After a Host restart, unfinished startup operations are shown as uncertain so th For a pending recovery or cleanup warning, use **核验并恢复**. The Host validates the original operation and current target ownership before changing files: restore pre-commit files, or clean up residues after a committed operation. It does not repeat the installation/removal. Unresolved results cannot simply be dismissed. Retain the operation ID when reporting a failure; do not delete journals or unknown directories to bypass recovery checks. -The runtime guard checks DSH, app-boot and Host peers through the Host package resolver, plus owning manifests of the seven declared Client modules in the active graph. Missing services, inactive modules or version mismatches block new writes and recovery writes. Reading existing operation results remains available. Matching dependencies is only one compatibility check and does not establish support for every DSH/Client/Node/platform combination. +The runtime guard checks DSH, app-boot and Host peers through the Host package resolver, plus owning manifests of the declared Client modules, including the session UI module, in the active graph. Missing services, inactive modules or version mismatches block new writes and recovery writes. Reading existing operation results remains available. Matching dependencies is only one compatibility check and does not establish support for every DSH/Client/Node/platform combination. + +Known Host limitation: official RC.2 can show a blank page when the Host restarts on the same port while the browser stays open. This has also been reproduced without SkillHub and still affects plugin use. Automatic reconnection is not guaranteed. Keep the original tab and operation records; do not resubmit an installation or upgrade. See the [compatibility design](../../openspec/changes/add-dsh-native-plugin/compatibility-design.md) for the separate re-entry recovery acceptance boundary. ## Plugin maintenance diff --git a/plugins/dsh/README.md b/plugins/dsh/README.md index b39bfef69..d52dee433 100644 --- a/plugins/dsh/README.md +++ b/plugins/dsh/README.md @@ -79,7 +79,9 @@ dsh --profile skillhub-test --host 127.0.0.1 --port 0 --no-open ### Host 依赖核验 -安装、升级、卸载的新请求和显式恢复写入前,会通过宿主运行时解析服务检查 DSH 主程序、app-boot 和 Host peers,并检查七项声明注入的 Client 模块是否已挂载且所属清单版本匹配。不匹配或无法确认时拒绝写入;原操作查询和原请求回执仍可读取。广场提供核验失败提示和重新核验入口。依赖匹配只是一项必要检查,不代表浏览器实际执行、依赖重载、Node 和所有平台已完成兼容验收。 +安装、升级、卸载的新请求和显式恢复写入前,会通过宿主运行时解析服务检查 DSH 主程序、app-boot 和 Host peers,并检查声明注入的 Client 模块(含会话 UI 模块)是否已挂载且所属清单版本匹配。不匹配或无法确认时拒绝写入;原操作查询和原请求回执仍可读取。广场提供核验失败提示和重新核验入口。依赖匹配只是一项必要检查,不代表浏览器实际执行、依赖重载、Node 和所有平台已完成兼容验收。 + +已知宿主限制:官方 RC.2 在浏览器保持打开、Host 同端口重启时可能因会话模块短暂卸载而出现空白页,无 SkillHub 时也已复现。此问题仍影响插件使用,不能承诺自动重连。保留原标签页和操作记录,不要重复提交安装或升级;重新进入后的恢复流程及验收边界见 [兼容设计](../../openspec/changes/add-dsh-native-plugin/compatibility-design.md)。 ### DSH 升级后的处理