feat(dsh): add durable supervision, scheduling and operations dock
This commit is contained in:
1 parent
f861a3d386
commit
736b582bc1
46 files changed
+4122
-93
No files matched your search
@@ -0,0 +1,46 @@
|
||||
# DSH Operations Implementation Plan
|
||||
|
||||
> **For agentic workers:** Use executing-plans for integration and dispatching-parallel-agents for the independent domain modules. Track the items below and verify each deliverable before integration.
|
||||
|
||||
**Goal:** Implement all seven approved operations improvements in the existing DSH assistant.
|
||||
|
||||
**Architecture:** Qt owns execution and confirmation. Independent Qt-free stores own durable state and read-only analyses. Harness schemas and native slots expose bounded capabilities without changing the business persona.
|
||||
|
||||
**Tech Stack:** Python 3, SQLite/atomic JSON, PySide6, Node 24 and official Harness 0.2.1-rc.5.
|
||||
|
||||
**Spec:** `docs/superpowers/specs/2026-10-30-dsh-operations.md`.
|
||||
|
||||
## Constraints
|
||||
|
||||
- Work only in `.worktrees/codex-dsh`; retain shared checkout and other branches.
|
||||
- Never log credentials, stage bootstrap/provider files, invent CAD counts or weaken interruption/confirmation gates.
|
||||
- Native right dock, model tools and parent-process protocol must expose each completed feature; domain-only code is insufficient.
|
||||
|
||||
## Deliverables and interfaces
|
||||
|
||||
- [x] `dsh/run_journal.py`: `RunJournal(data_root).begin(run_id, task_ids, plan_hashes, *, schedule_id=None) -> dict`, `.finish(run_id, result)`, `.list_runs(limit=20)`, `.get(run_id)`, `.inspect(service, run_id) -> dict`. Records contain `run_id`, `queue_id=run_id`, ordered `task_ids`, `plan_hashes`, `status`, UTC timestamps and `result`. Inspect returns actual counters/blockers and resume scope without starting work.
|
||||
- [x] `dsh/scheduling.py`: `ScheduleStore(data_root).save(spec, plan_hashes) -> dict`, `.list_schedules()`, `.get(schedule_id)`, `.cancel(schedule_id)`, `.claim(schedule_id)`, `.finish(schedule_id, status, **values)`, `.evaluate(service, *, now=None, busy=False) -> list[dict]`. Spec uses `task_ids`, `priority` (`low/normal/high/urgent`), `not_before`, optional `due_at`, `dependencies`, `auto_start`, and optional `title`. No external calls or actual execution from this module.
|
||||
- [x] `dsh/experience.py`: `ExperienceStore(data_root).refresh() -> list[dict]`, `.search(issue_code='', *, limit=5) -> list[dict]`, `.summary() -> dict`. Derive entries from existing incidents and preserve explicit verification and evidence identity.
|
||||
- [x] `dsh/ticket_tracking.py`: `TicketTracker(data_root).refresh(incident_id) -> dict`, `.list_tickets() -> list[dict]`. Use `GitIssuePublisher.connection()` and protected fixed-target read requests; no arbitrary URL or writing capability.
|
||||
- [x] `dsh/impact.py`: `execution_impact(service, task_ids, *, limit=100) -> dict`. Exact selected component rows for saved target plans; mapping-only rows with `component_count=None`, `coverage='mapping_only'`. Include totals, omitted-row count and fingerprint/hash references.
|
||||
- [x] Integrate run journal/resume and checkpoint reservation into `task_queue.py` and `ui/dsh_task_lifecycle.py`; keep all execution receipt counts and existing safety gates.
|
||||
- [x] `ui/dsh_operations.py` owns scheduling, recovery/history, impact, experience and ticket requests and native dialogs. Initialize it on desktop startup without loading Chromium; publish data when Harness opens. Timer uses existing worker lane, preserves model turns and does not invoke model APIs on each tick.
|
||||
- [x] Runtime usage module records native session events and honors configurable response timeout/cancel without cancelling confirmed CAD writes. Bound and cache unchanged task reads while preserving audit evidence.
|
||||
- [x] Extend context, tool schemas, guard roster, right dock, tool settings and direct UI actions. Keep automatic agents snapshot-only. Expose usage limits as tool settings with explicit units and unknown price handling.
|
||||
- [x] Verify tests first for each domain, integrate, run regressions and real CLI/Qt/CDP acceptance, document actual results and commit to `codex/dsh`.
|
||||
|
||||
## Verification recipes
|
||||
|
||||
Each new domain test starts by exercising a missing module/API (expected failure), then verifies durable behavior against temporary real stores and fixture services. Integration tests use existing `tests/ui/conftest.py` controlled executor and actual Qt confirmation clicks. Run:
|
||||
|
||||
```powershell
|
||||
pytest -q tests/dsh tests/ui tests/v1_1/test_task_queue.py tests/packaging/test_dx_part_replace_build.py
|
||||
pytest -q tests/v1_1/test_execution_feedback.py
|
||||
node tools/verify_dsh_runtime.mjs
|
||||
```
|
||||
|
||||
Complete real-model acceptance with isolated fixtures and existing Qt/CDP driver, including reload/restart, known versus unknown impact, due scheduling, safe pause and ticket refresh. Report controlled-executor limits explicitly.
|
||||
|
||||
## Verified result
|
||||
|
||||
All seven operations are integrated in the native dock and schema surface. Final regression: 277 passed across three processes (193 + 2 + 82); same-name test modules run separately. CLI runtime, dock startup, bounded model results, native usage/compaction and real two-process Qt/CDP acceptance passed. The acceptance resumed the original queue and dispatched one explicitly authorized schedule exactly once using controlled no-match fixtures. See docs/testing/2026-10-30-dsh-operations.md for evidence and limits. No release EXE was built.
|
||||
@@ -0,0 +1,35 @@
|
||||
# DSH operations and planning
|
||||
|
||||
The user approved all seven previously proposed features: realtime supervision, restart recovery, execution impact lists, incident experience, ticket tracking, model usage/response improvements, and task scheduling. Continue on the existing isolated `codex/dsh` worktree. Existing native Harness and service confirmation gates remain authoritative.
|
||||
|
||||
## Runtime supervision and recovery
|
||||
|
||||
Publish live owner, current project, stage, elapsed time, saved/failed/no-match counts and safe-stop request independently of the selected task. Root task status must not claim draft or paused while an active worker is executing. Retain the last execution receipt separately from subsequent catalog reads.
|
||||
|
||||
Persist each confirmed execution in a `RunJournal(data_root)` before entering the executor. Reserve its queue checkpoint ID before launch. After restart, inspect saved journal rows and existing task evidence, display recoverable/interrupted work, and never replay automatically. Resume reconfirms the original order and frozen plan, reuses the checkpoint and skips completed entries. Uncertain results still require the existing reconciliation workflow.
|
||||
|
||||
## Impact lists
|
||||
|
||||
Build a pure read-only impact report from saved contexts. For explicit target plans, show project, sheet, RefDes, stable UID, old/new part, old/proposed Value, Cell policy and NC policy. For mapping mode without collected targets, show mapping scope and clearly state that the number and identities of matching components are unknown. Never invent component counts. Include the report in preflight and native execution confirmation. Full report is available through the authenticated local UI, with bounded summaries for the model.
|
||||
|
||||
## Incident experience and ticket tracking
|
||||
|
||||
Index local existing incident evidence with `ExperienceStore(data_root)`. Mark an experience verified only when persisted verification proves complete, no failures, no interruption and no pause. Evidence-less suggestions, closed tickets and model claims are never verified repairs. Match by issue code and diagnostic context; suggestions cannot grant execution authority or bypass one-retry budgets. Incorporate bounded related experiences as data into diagnosis and show evidence references.
|
||||
|
||||
`TicketTracker(data_root)` refreshes only an existing incident's bound server/repository/issue number through the existing issue publisher authentication. Read status and bounded comments, store a scrubbed cache and expose last sync/errors. Validate the ticket URL/marker against the configured repository before transmitting credentials. No model-controlled arbitrary URL or write/comment operation is exposed. Issue closure is feedback rather than proof that local CAD was fixed. Manual refresh is available without a Git installation; periodic refresh stays quiet on unchanged data.
|
||||
|
||||
## Model efficiency and usage
|
||||
|
||||
Retain the official native token display and add bounded per-session usage, duration and error/timeout state through backend runtime events. Unknown provider pricing must display unavailable rather than invented money. Repeated task reads within an unchanged revision may be cached; full evidence remains on disk, model results are bounded, and all relevant safeguards and identity fields survive compaction. Expose a bounded configurable response timeout and a stop-generation action using the native session cancel API. Cancelling model generation never falsely cancels an already confirmed task mutation or CAD operation.
|
||||
|
||||
## Scheduling
|
||||
|
||||
`ScheduleStore(data_root)` persists selected tasks, frozen plan hashes, priority, optional due time, not-before time, dependency task IDs and idle-only state. Save/cancel pass through native confirmation. Datetimes use ISO 8601 with timezone offsets; timestamps are stored in UTC. Reject unknown fields, invalid priorities, self-dependencies and invalid IDs. Dependencies must be actually completed with no unresolved evidence. Priority then scheduled time determine order.
|
||||
|
||||
The scheduler runs only while the desktop app is open. Due tasks are shown on the right dock. Automatic idle execution requires a native confirmation explicitly authorizing the saved engineering scope for that future run; otherwise the task remains awaiting manual confirmation. Before dispatch it repeats preflight, dirty-plan checks and the frozen plan comparison. Busy workers, CAD/resource blockers, changed plans and uncertainty prevent dispatch. Claiming a schedule is durable and exclusive. Interrupted dispatch is not retried automatically after restart.
|
||||
|
||||
## Integration and verification
|
||||
|
||||
All new business capabilities are exposed as backend schemas; do not put tool names or routing recipes into the persona/user prompts. Automatic incident sessions remain event-snapshot-only. Reuse authenticated context/action routes and bounded parent-process request/results. Add native right-dock sections and direct actions within the existing three-column UI.
|
||||
|
||||
Verify domain state transitions, crash/restart receipts, stale plans, truthful impact counts, dependency and schedule gates, ticket authentication confinement, experience verification and generation cancellation. Run real CLI policy checks, real-model natural-language actions and Qt/CDP clicks using isolated fixture projects and a controlled executor. No release EXE or real user engineering mutation is included.
|
||||
Reference in new issue
Block a user