Files
dxdesigner-part-replacement/docs/superpowers/plans/2026-10-31-dsh-production-chain.md
T

5.5 KiB

DSH 生产闭环增强实施计划

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: Add real CAD verification visibility, safe failure classification, resume diffs, and a deployable fixed-target issue broker contract.

Architecture: Reuse the existing TaskCenterService and private CAD identity as the only execution authority. Add bounded Qt-free analyzers, then expose their read-only results through existing preflight, incident, resume confirmation, health, and issue transport paths.

Tech Stack: Python 3.12, PySide6, stdlib HTTP server/client, existing SQLite/JSON evidence stores, pytest, Node and Qt/CDP acceptance.

Spec: docs/superpowers/specs/2026-10-31-dsh-production-chain.md

Global Constraints

  • Work only in .worktrees/codex-dsh on branch codex/dsh.
  • Never print, stage, or commit provider keys, Git tokens, broker secrets, or ignored bootstrap files.
  • Keep native confirmation, safe pause, original queue identity, and automatic snapshot-only admission unchanged.
  • Controlled fixtures must not start real CAD or write user projects.

Task 1: Real CAD verification adapter

Files:

  • Create: src/dx_productivity/dsh/cad_verification.py
  • Create: tests/dsh/test_cad_verification.py
  • Modify: src/dx_productivity/dsh/task_lifecycle.py

Interfaces:

  • CadVerificationAdapter(service).preflight(task_ids) -> dict returns mode, status, projects, blockers, and evidence_refs.

  • CadVerificationAdapter(service).after_run(task_ids) -> dict returns readback status and actual progress counters.

  • Write tests for ready fixture, missing probe, identity mismatch, uncertain result and exact counter preservation.

  • Run the focused tests and observe the missing-module failure.

  • Implement read-only checks using task_context, expected_probe_path, project file identity and existing evidence; never invent component counts.

  • Include adapter result in DSH preflight and execution impact context.

  • Run focused adapter and lifecycle tests.

Task 2: Failure classification and safe retry policy

Files:

  • Create: src/dx_productivity/dsh/failure_policy.py
  • Create: tests/dsh/test_failure_policy.py
  • Modify: src/dx_productivity/dsh/incidents.py
  • Modify: src/dx_productivity/dsh/rules.py

Interfaces:

  • classify_failure(issue_code, status, *, interrupted=False, authorized=False) -> dict returns category, retry_allowed, reason, backoff_seconds, and max_attempts.

  • Write tests for transient, deterministic, uncertain, paused and unknown errors.

  • Run focused tests and observe expected failure.

  • Implement conservative classification; only transient authorized runs with clean evidence can retry once.

  • Replace raw RETRYABLE_CODES checks in automatic incident flow with the policy result and append it to decision gates.

  • Run incident, decision-log and policy tests.

Task 3: Resume difference report

Files:

  • Create: src/dx_productivity/dsh/resume_diff.py
  • Create: tests/dsh/test_resume_diff.py
  • Modify: src/dx_productivity/dsh/run_journal.py
  • Modify: src/dx_productivity/trial_task_center/ui/dsh_task_lifecycle.py
  • Modify: integration/dsh/task-plugin/model_results.mjs

Interfaces:

  • resume_diff(service, inspected_run) -> dict returns safe, changed, completed, remaining, plan_changes, evidence_changes, and bounded blockers.

  • Write tests for unchanged scope, completed items, plan change, missing checkpoint and uncertain evidence.

  • Run focused tests and observe expected failure.

  • Implement deterministic diff from saved hashes, current plan hashes, queue entries and task evidence.

  • Add diff to resume inspection and native confirmation text; block automatic resume when safe is false.

  • Project bounded diff fields to model results and run lifecycle/UI tests.

Task 4: Broker reference service and client hardening

Files:

  • Create: tools/dsh_issue_broker.py
  • Create: src/dx_productivity/dsh/issue_broker.py
  • Create: tests/dsh/test_issue_broker.py
  • Modify: src/dx_productivity/dsh/issue_transport.py
  • Modify: docs/user/dsh-ai-supervision.md

Interfaces:

  • IssueBrokerConfig.from_environment(), IssueBroker.exchange(payload) -> dict, and IssueTransport.credentials(...) with instance_proof, idempotency_key, credential_kind=revocable_static / expires_utc=null.

  • Reference HTTP endpoints: GET /healthz, POST /v1/issue-token.

  • Write tests for fixed target, HMAC instance proof, idempotency, explicit static credential lifetime, bounded cache, invalid scope, and no secret in response logs.

  • Run focused tests and observe expected failure.

  • Implement the broker with stdlib ThreadingHTTPServer, fixed target configuration, environment-only secret/token, bounded requests and no redirects.

  • Require broker exchange metadata in the client and reject responses with missing expiry or wrong target.

  • Document deployment variables and explicitly label the local server as a reference implementation.

  • Run broker, transport, ticket, and health tests.

Task 5: Full verification and commit

Files:

  • Modify: docs/testing/2026-10-31-dsh-production-chain.md

  • Run focused and relevant regression tests, Node checks, credential scan and git diff --check.

  • Run two-process Qt/CDP acceptance with the adapter enabled in controlled mode.

  • Record exact artifacts and limits; no real CAD or remote issue creation claims.

  • Commit only intended files on codex/dsh and verify clean status.