Files
dxdesigner-part-replacement/docs/testing/evidence/2026-11-13-pr27-followup/harness-restart-notes.md
T
阿白叔 cffef93b37
Core regression / Python core, intervention UI and release configuration (push) Successful in 4m35s
Core regression / JavaScript syntax (push) Successful in 6s
Core regression / Python core, intervention UI and release configuration (pull_request) Successful in 3m54s
Core regression / JavaScript syntax (pull_request) Successful in 4s
fix: persist incident isolation and atomically publish netlist evidence
2026-11-13 17:28:05 +08:00

3.4 KiB

Real Harness incident restart isolation

Changed only integration/dsh/task-plugin/host.mjs and tools/verify_dsh_incident_restart.mjs.

Root cause: incidentSnapshots and incidentSessions were runtime-only Maps. Historical sessions retained the full dx-task preset, so restart erased guard classification and dx_task_snapshot read a different current task.

SDK investigation: SessionHeader only accepts documented fields; custom arbitrary metadata is unavailable. SessionController.create accepts caller-supplied sessionId and persists it unchanged for a new identity. The session id is independent of user-editable titles and preset selections. Automatic sessions now receive a reserved session-dx-incident-UUID id before any prompt. Classification derives from that id after restart, so missing snapshots cannot remove the guard. Ordinary dx-task/standard presets, tool catalogs, default sandbox and permissions are unchanged. The monotonic guard denies every non-snapshot tool, including extensions registered later.

Snapshots are atomically stored via the existing node temporary-file/rename pattern used by runtime_usage.mjs. Sidecars bind version/session_id/incident_id/snapshot revision. Missing/corrupt/mismatched snapshots throw rather than falling back to current task. A failed publication admits no diagnosis prompt. Direct host bookkeeping uses node fs under DX_DSH_HOME rather than the task-tool workspace sandbox.

Legacy migration uses only the existing coordinator-owned sibling incidents/<24hex>/incident.json analyses[].session_id and that incident's fixed snapshot.json. Individual files must be regular files, not symlinks; records are bounded to 256 KiB/two analyses. Ledger incident id and snapshot task id are checked where recorded. Conflicting known session bindings remain automatic but cannot read an ambiguous snapshot. Missing/bad/inaccessible records are skipped with one bounded count diagnostic, so ordinary Harness startup remains available. No user title or arbitrary prompt text is used to infer authority.

Legacy limit: old incomplete/failed/timeout/crash sessions lacking a persisted analyses.session_id cannot be authenticated from this ledger and are not claimed as migrated. We do not infer classification from a title or user text. New reserved-id sessions stay isolated even when a crash occurs before snapshot publication.

RED: node tools/verify_dsh_incident_restart.mjs against old host, real create process then real restarted Harness: historical snapshot task_id was different-current rather than incident-original (red-restart.txt). GREEN: same command, exit0; real Harness in separate Node24 processes with a local fake LLM adapter only in the create process. Test covers new and legacy historical snapshots, missing/corrupt sidecar, missing legacy snapshot, denied shell/write/edit/task mutation/new extension, ordinary official write+extension and user title, conflicting ledger session, missing/corrupt/symlink legacy records without blocking ordinary startup. Symlink fixture was exercised on this host. report.json records all checks. No remote model call, CAD, native CLI, or actual mutation beyond owned fixture files.

node --check both modified files and git diff --check passed. Parent separately adapted and verified the pre-existing VM cancellation script; this task did not edit it.

All source/test changes are now frozen. No commit or push performed.