Skip to content

Add cross-project task catalog / 添加跨项目任务目录 - #8219

Open
SivanCola wants to merge 16 commits into
esengine:main-v2from
SivanCola:feature/task-catalog
Open

Add cross-project task catalog / 添加跨项目任务目录#8219
SivanCola wants to merge 16 commits into
esengine:main-v2from
SivanCola:feature/task-catalog

Conversation

@SivanCola

@SivanCola SivanCola commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a shared internal/projectiondb lifecycle for disposable SQLite projections and move Session Catalog schema v3 pagination onto it.
  • Add a cross-project Task Catalog over authoritative task snapshots with lazy, offset-checkpointed event indexing.
  • Keep FileStore, version CAS, idempotency files, leases, symlink checks, and control decisions authoritative; SQLite is never a WriteStore.
  • Add SHA-256 project-key routing, runtime controller/job overlays, paged Wails APIs, compatibility wrappers, and a current-session/current-project/all-projects Task Center.
  • Add bounded shared-worker shutdown, diagnostics, safe rebuild commands, deterministic tests, benchmarks, and bilingual storage documentation.

Task snapshots and event JSONL remain the sole authority. SQLite lives under the cache root and can be removed or rebuilt without affecting task control.

Issues

Depends on #8186 for the shared asynchronous Session Catalog foundation. This PR is the independently reviewable Task domain built on that foundation.

For a focused review after #8186, compare:
SivanCola/DeepSeek-Reasonix@feature/session-catalog...feature/task-catalog

Verification

  • go test ./...
  • go test ./internal/projectiondb ./internal/sessioncatalog ./internal/taskcatalog ./internal/taskmonitor ./internal/control ./internal/cli
  • go test -race ./internal/projectiondb ./internal/taskcatalog ./internal/taskmonitor ./internal/control
  • go test . -run 'Task|Catalog|Control|Shutdown' -count=1 in desktop/
  • pnpm build in desktop/frontend/ (hooks lint, WAAPI contract, TypeScript, production build, and bundle budgets)
  • go run ./tools/repolint

Documentation impact

Documentation-impact: updated - added English and Chinese Task Catalog architecture, authority/control boundaries, recovery, CLI, and cache-path documentation.

Cache impact

Cache-impact: none - task projection and UI pagination do not alter provider-visible prompt, tool, memory, or skill bytes.
Cache-guard: GOCACHE=/tmp/reasonix-go-cache bash scripts/cache-guard.sh passed all agent and boot guards; authoritative FileStore/CAS/idempotency, projection-sink lock-boundary, runtime-overlay, and frontend binding tests also pass.
System-prompt-review: SivanCola explicitly reviewed the inherited boot fixture and TaskStore wiring diff and confirmed that it changes task persistence only; system-prompt bytes, tool schemas/order, memory/skill rendering, and provider serialization remain unchanged.

Compatibility and failure behavior

  • Existing snapshot/event formats and old Wails task APIs remain supported; empty arrays remain [].
  • Unknown project keys are rejected before filesystem access; actions re-read the authoritative snapshot and do not depend on the active tab.
  • Current in-memory controller/job state always overrides catalog runtime state.
  • Snapshot corruption degrades only one task, event logs are indexed lazily, and missing rows use a two-scan grace period.
  • Shutdown stops late reconcile publication and drains/closes the shared projection within the 250ms catalog budget.

Problem:
Desktop startup and project-tree queries could synchronously migrate and decode legacy session JSONL, blocking navigation, creation, and shutdown.

Root cause:
Session discovery, metadata repair, controller admission, and plugin startup shared UI-critical paths and broad lifecycle locks.

Fix:
- add a disposable SQLite session catalog with incremental reconciliation, repair checkpoints, corruption recovery, and memory fallback
- expose revisioned cursor pagination and migrate the desktop project tree to lazy loading
- move controller construction outside lifecycle admission and isolate incompatible plugin startup
- add session doctor and reindex commands while preserving authoritative JSONL and metadata
- retain CGO-free builds with platform-specific fallbacks

Verification:
- go test ./...
- cd desktop && go test ./...
- go test -race ./internal/sessioncatalog ./internal/agent
- cd desktop && go test -race .
- go vet ./... in root and desktop
- cd desktop/frontend && pnpm test:all && pnpm build
- CGO_ENABLED=0 cross-builds for supported macOS, Windows, and Linux targets
Reason:
The official base advanced by six plan-contract commits after the session catalog implementation began.

Resolution:
Merge the current official main-v2 without rewriting the reviewed feature commit.

Verification:
- go test ./... passed at the repository root after the merge
- go test ./... passed in desktop after the merge
- the feature commit retains focused race, frontend, vet, and cross-build evidence
Problem:
The initial session catalog implementation exceeded incremental repository size and complexity budgets in several existing owner files, and Desktop CI reported stale helpers plus two modernization findings.

Root cause:
Catalog lifecycle, runtime projection, frontend topic presentation, mock bindings, plugin compatibility, and CLI wiring were colocated with already-large modules. Removing the eager project tree also left legacy runtime-tree helpers unused.

Fix:
- split catalog lifecycle from runtime projection and metadata mapping
- extract frontend catalog contracts, mock bridge, topic presentation, and count formatting
- isolate plugin compatibility, session projection, and CLI completion wiring
- remove obsolete eager-tree helpers and address CI modernization findings
- preserve behavior without changing repolint baselines

Verification:
- go run ./tools/repolint
- golangci-lint v2.12.2: 0 issues
- go test affected root packages
- focused Desktop catalog and workspace regression tests
- pnpm test:all
- pnpm build
Bring the session catalog prerequisite onto the current upstream base before publishing the History, Usage, and Task follow-up branches.

# Conflicts:
#	desktop/frontend/scripts/check-bundle-budget.mjs
Problem: Each disposable catalog would otherwise duplicate SQLite migration, integrity, quarantine, permission, and in-memory fallback behavior.

Root cause: The original session catalog owned database lifecycle policy together with session-specific schema and reconciliation logic.

Fix: Extract the reusable lifecycle into internal/projectiondb, migrate the session catalog to it, and add schema-v3 keyset session pagination for follow-up consumers.

Verification: Covered by projectiondb lifecycle tests and session catalog migration, pagination, cursor, and compatibility tests.
Problem: Task Monitor could only scan the active project synchronously and could not page or safely route controls across projects.

Root cause: Task snapshots and event logs had no disposable query projection, while control APIs implicitly depended on the active tab instead of a stable project identity.

Fix: Add an observed authoritative FileStore, resumable snapshot and lazy event indexing, SHA-256 project-key routing, runtime overlays, paged Wails APIs, a cross-project Task Center, diagnostics, and bilingual documentation.

Verification: Covered by lock-boundary notifications, corrupt snapshot/event isolation, event-tail pagination, lease reconciliation, stale cursor, project-key action routing, Wails arrays, and 100,000-task warm-page benchmark tests.
Problem: the isolated Task Catalog branch lacked shell completion metadata and only flushed its shared projection during desktop shutdown, allowing late reconcile goroutines to outlive the shutdown boundary.

Root cause: the task implementation was originally layered on the integrated History branch, so domain-specific lifecycle and documentation details were lost when it was split into an independently reviewable branch.

Fix: register task reindex completions, document the task cache and recovery commands, gate reconcile scheduling during close, wait for scheduled workers, close the shared catalog within the 250ms desktop drain, and account for the measured 1 KiB frontend bundle increase.

Verification: focused Desktop tests, frontend production build and bundle budgets, repository lint, core package tests, and race tests for projectiondb, taskcatalog, taskmonitor, and control passed.
# Conflicts:
#	desktop/frontend/scripts/check-bundle-budget.mjs
# Conflicts:
#	desktop/frontend/scripts/check-bundle-budget.mjs
Problem: the latest main-v2 transcript-selection work intentionally enlarged existing frontend files after the Task branch had captured its repository lint baseline.

Fix: regenerate the carry-forward baseline on the merged Task branch without adding new domain violations.

Verification: repolint, focused Desktop tests, frontend production build, and task/control package tests pass.
@SivanCola
SivanCola requested a review from esengine as a code owner August 10, 2026 12:20
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) labels Aug 10, 2026
# Conflicts:
#	tools/repolint/baseline.json
Problem: after Session Catalog adopted projectiondb, the old filesystem probes and migration entrypoint remained unused, while CI also flagged two modern Go style issues.

Root cause: the common projection extraction preserved obsolete package-local helpers to minimize the first refactor diff.

Fix: remove the dead remote-filesystem and migration helpers, use integer range in the benchmark, and iterate managed plugin path segments with strings.SplitSeq.

Verification: sessioncatalog, pluginpkg, and projectiondb tests pass; golangci-lint reports zero issues.
Problem: the shutdown barrier used an intentionally empty mutex critical section, which staticcheck rejects.

Fix: guard a reconcileDone flag with the same mutex used for scheduling so Close prevents late WaitGroup additions without an empty critical section.

Verification: taskcatalog tests pass and golangci-lint reports zero issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) config Configuration & setup (internal/config) desktop Wails desktop app (desktop/**) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant