Skip to content

feat(journey): recover project and session journey workflow - #827

Draft
Harry19081 wants to merge 41 commits into
developfrom
dev/pr770-journey-recovery
Draft

feat(journey): recover project and session journey workflow#827
Harry19081 wants to merge 41 commits into
developfrom
dev/pr770-journey-recovery

Conversation

@Harry19081

@Harry19081 Harry19081 commented Aug 16, 2026

Copy link
Copy Markdown
Member

Problem

PR #770 contains a substantial contributor-built Journey feature, but repeated rebases and force-pushes left duplicated commit history and conflicts with current develop. Replaying the branch wholesale would also restore obsolete app-shell/history paths and unrelated provider, key-vault, search, release, and ProgressMindMap changes.

The missing product capability is one cross-layer workflow: a canonical Project → Session Journey, explicit task/fork/checkpoint/review lifecycle state, branch-scoped provider history, and exact navigation back to the durable transcript evidence.

Solution

Recovered the focused Journey workflow onto current develop using cherry-picks with source provenance, then adapted conflicts to the current architecture:

  • Projects contain canonical sessions directly; Work Items remain optional metadata and never own sessions.
  • Session Journey lifecycle mutations are revisioned/CAS-protected and persist exact durable message membership, branch, task, sequence, review provenance, and handoff capsules.
  • Provider history is filtered before reconstruction to the active fork plus exact ancestor prefixes; confirmed handoff capsules are appended without leaking sibling or parent-future transcript.
  • Project Tree, Journey graph/timeline, session controls, review dock/recovery, and task/fork/checkpoint routes are integrated into the current workstation tab architecture.
  • Exact durable message targets flow through tab reuse, pagination, scrolling, pinned headers, and highlighting.
  • Existing Agent Org inbox materialization, modular ChatHistory, sidebar status semantics, session header actions, and alternate session surfaces remain intact.
  • Review polling is single-flight and visibility-aware; Project Tree enrichment is concurrency-bounded and render-coalesced; stale async generations cannot overwrite a new session or unmounted surface.
  • Additive canonical fields use defaults so existing serialized sessions/edit artifacts remain readable. The only dependency change links the existing workspace-local orgtrack_graph crate into the desktop application; no third-party dependency was added.

Contributor commits whose changes were already represented were skipped instead of replayed as duplicate patches. Obsolete Journey Station routes and mixed-scope provider/key-vault/search/release changes were intentionally excluded.

Integrating current develop (through 47d3bbb6a) required adapting the feature to interfaces that moved underneath it:

  • ChatView was rebuilt on develop's ChatViewLiveRegion/ChatViewComposerSection split. The Journey controls' latestUserMessageId is now a selectAtom over chatEventsForSessionAtomFamily rather than reading the removed chatEvents array, so it keeps develop's narrowed-subscription behavior.
  • The exact-target scroll moved from the removed scrollToIndex handle to develop's DOM-first scrollToChatTarget, passing the durable message id alongside the display flat index.
  • Journey UI was migrated off lucide-react (deleted on develop) onto the @src/icons barrel, following docs/hugeicons-migration/icon-mapping.md.
  • WORKSTATION_TAB_ICONS gained FolderTree/GitFork so the Journey tabs resolve a glyph, as required by develop's workstationTabIcons guard test.
  • journey_commands::open_connection now returns database::db::PooledConnection, matching develop's pooled get_connection() and the sibling command modules.

Potential risks

  • This is a large cross-layer recovery (151 files) spanning SQLite persistence, Rust state machines/queueing, Tauri commands, canonical graph projection, React UI, and workstation navigation. The focused automated suites pass, but reviewer attention should remain on the persistence/wire boundaries and current-shell adaptations.
  • Rendered Tauri/WDIO coverage and screenshots were not produced. There is no deterministic Journey E2E seed/spec in the current harness, and desktop UI control was not authorized for this task. Keep this PR in Draft until the important visible states are exercised in the real app.
  • Real-process CPU/RSS, hidden-window idle behavior, and a high-session-count profile were not measured. Code-level lifecycle guards pass, but the performance verdict remains blocked for release measurement rather than claiming improvement from code shape.
  • The contributor's mixed provider-wide “uncapped review output” change was excluded. Journey review continues to use the existing 1,024-token side-query budget, which may truncate unusually large review annotations.
  • The develop integration touched the live chat surface (ChatView, ChatHistory, MessageViewer) where develop had just landed its own subscription-narrowing and find-in-chat rework. The merged behavior is covered by the full frontend suite, but the Journey controls' placement inside the new transcript slot and the exact-target scroll path are the two spots most worth a reviewer's eye.
  • The previous merge on this branch left loadSessionRoster called but not imported in WorkstationSidebarConnector — the branch head did not typecheck. That is now fixed, but it means the pre-merge state of this PR was not building, so earlier verification claims on this branch should be read as covering the feature rather than the branch head.
  • The Journey tables and metadata are additive. Rolling back the application code by reverting this PR leaves any created Journey rows inert rather than deleting user data; reapplying the feature restores access. Destructive schema rollback is neither required nor recommended.

Verification

  • pnpm typecheck — passed.
  • ESLint over every changed src/**/*.ts and src/**/*.tsx with --max-warnings 0 — passed.
  • Focused Vitest command covering Tauri adapters, Project Tree/graph, Session Journey controls/snapshot, exact ChatHistory targets, renderers, routing, and tab mutation — 18 files / 81 tests passed.
  • cargo test -p agent_core journey --lib — 51 passed.
  • cargo test -p agent_core persistence::messages --lib — 15 passed.
  • cargo test -p orgtrack_graph journey — 7 passed.
  • cargo test -p orgtrack_core — 547 passed / 8 ignored local-data benchmarks.
  • cargo test -p org2 journey — 6 passed; targeted runtime artifact projection — 1 passed; targeted file-session-history fixtures — 4 passed.
  • cargo check -p org2 — passed.
  • cargo clippy --workspace --all-targets -- -D warnings — passed under Rust 1.97.0, matching the failed CI job's toolchain and exact command.
  • rustfmt --check over every Rust file changed by this branch with child traversal disabled — passed.
  • git diff --check and added-line scans for secrets, personal paths, debug logging, build artifacts, and caches — passed.

cargo fmt --all -- --check was also attempted. It still reports formatting drift in three files unchanged by this PR: render_inline_canvas.rs, ui_metadata_tests.rs, and turn_window.rs. Those baseline files were not reformatted into this feature PR.

Not run: rendered WDIO/Tauri E2E, visual screenshots/recordings, real-process performance measurements, and Windows/Linux platform checks.

Develop integration re-verification (2026-08-28, merged tree at 4ed6e02a4)

Re-run in a dedicated worktree after merging origin/develop (4dd3f30ae, then 47d3bbb6a) and resolving six conflicted files plus seven semantic breaks the auto-merge left behind:

  • tsc --noEmit — passed.
  • ESLint --max-warnings 0 --report-unused-disable-directives over every file touched while resolving — passed.
  • Full Vitest suite — 1270 files / 10,009 tests passed, executed in directory chunks. A single whole-suite invocation repeatedly aborted with esbuild The service is no longer running; that is host memory pressure on this machine, not a code failure, and the chunked runs cover the identical file set.
  • cargo check --workspace --all-targets — passed.
  • cargo clippy --workspace --all-targets -- -D warnings — passed.
  • cargo test -p agent_core journey --lib — 51 passed.
  • cargo test -p orgtrack_graph journey — 7 passed.
  • cargo test -p orgtrack_core — 578 passed / 8 ignored.
  • cargo test -p git_api — 123 passed / 1 ignored; cargo test -p git — 135 passed. (Both crates changed on develop inside this merge.)
  • cargo test -p org2 journey — 10 passed.
  • Repository pre-commit hook — lint-staged, scoped TypeScript check, and scoped cargo clippy all passed.

Note for anyone reproducing the Rust checks locally: the first cargo clippy run reported 39 phantom resolution errors claiming the Journey types were absent from orgtrack_core/orgtrack_graph. Those were stale artifacts in the shared ~/.cargo/shared-target directory leaking across worktrees; cargo clean -p orgtrack_core -p orgtrack_graph cleared it and clippy then passed.

Still not run: rendered WDIO/Tauri E2E, visual screenshots/recordings, real-process performance measurement, and Windows/Linux platform checks. This PR stays in Draft for that reason.

Contributor credit

This feature was primarily contributed by @chsimonpan. Their original commit authorship and cherry-pick provenance are preserved throughout this PR; the recovery work resolves the rebased history and adapts the feature to current develop.

Audits

  • Architecture: docs/architecture-audit-2026-08-17/SessionJourneyRecovery.md — pass for draft review across all ten layers.
  • UI consistency: docs/frontend-ui-audit-2026-08-17/ProjectTreeAndSessionJourney.md — 0 fix / 10 keep-with-reason / 0 abstract. The configured audit skill was unavailable, so the equivalent review is recorded manually.
  • Performance guard: docs/org2-performance-guard-2026-08-17/SessionJourneyRecovery.md — lifecycle invariants pass; release verdict remains blocked on real-process measurement.

chsimonpan and others added 30 commits August 16, 2026 22:52
Add Workspace→Project→WorkItem→Session/Todo tree and project journey
view with mainline pin, file category blink, and soft prune. Ship as
org2-patch parallel to production ORG2.

(cherry picked from commit 647d981)
(cherry picked from commit 7580fc904750090c463179e08dd3d16cd653d4b5)
Replace the P1 fail-closed stub with the real data path:
- read persisted canonical sessions/edit artifacts/commit links
- scope filter: project/{id} matches workspace_path; session/{id}
  selects the session plus its parent lineage chain
- project_canonical_journey projector + independent audit (fail closed
  on uncovered canonical units)
- fork edges only emitted when parent is inside the selected scope

(cherry picked from commit 755ae6d)
…t store

project/{id} now reads linked_repos_json from projects.db and selects
every canonical session whose workspace_path is inside one of the linked
workspaces (exact or direct child). Unknown project ids and projects
without linked workspaces stay fail-closed: no guessed paths, no
synthesized data.

(cherry picked from commit db1b6b3)
Journey-only extraction from mixed historical commits.

(cherry picked from commit eb31a18ed606d9b7e071944ab6a7d4262f3a3596)

(cherry picked from commit dbe58cb6cf6313a73f2c4bb23b814a8aa2c77ce)
Harry19081 and others added 6 commits August 17, 2026 18:02
The canonical Journey graph fails closed on sessions whose durable
journey.project_id is absent, but no producer ever populated it: both
session mirrors dropped the project/work-item link on the floor, so
journey_graph_query rejected every scope. Work-item link writes also
skipped the mirror hook, leaving the canonical store stale until an
unrelated session write.

- populate journey.project_id / journey.work_item_id from the
  authoritative agent_sessions row in both mirror producers
- fire the session mirror hook from update_work_item_link and
  link_bootstrap_work_item, matching the sibling link writers
- add producer-boundary regression tests for linked and unlinked
  sessions on both mirror paths
- drop the orphaned orgtrack/journey.rs left shadowed by the
  journey_canonical #[path] module
@Harry19081 Harry19081 added enhancement New feature or request sessions Sessions, history, replay, sidebar, workspace, or worktrees project-management Projects, work items, routines, GitHub work, or team inbox labels Aug 23, 2026
Harry19081 and others added 4 commits August 27, 2026 14:25
…recovery

# Conflicts:
#	src/engines/ChatPanel/ChatHistory/index.tsx
#	src/engines/ChatPanel/ChatView.tsx
#	src/engines/ChatPanel/ChatViewHistorySurface.tsx
#	src/engines/ChatPanel/ChatViewTypes.ts
#	src/modules/ProjectManager/Panels/ProjectManagerSidebar/content/WorkspaceOrgTreeContent.tsx
#	src/modules/WorkStation/Chat/Communication/MessageViewer.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request project-management Projects, work items, routines, GitHub work, or team inbox sessions Sessions, history, replay, sidebar, workspace, or worktrees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants