← Back to Pull requests

feat(desktop): add Work Board Phase 3 start-task spike #4598

Closed
unknown closed this pull request without merging on Sep 14, 2026 07:10 UTC
View on GitHub
unknown unknown commented on Sep 03, 2026 01:56 UTC
Author

Summary

Implements the thin Work Board Phase 3 validation spike for #2560.

  • Adds a default-off Start task path for project-scoped Work Board items whose target resolves to one available, non-archived Host/project target.

  • Reuses the existing New Task and Composer first-send flow; the draft contains the item title and optional notes.

  • Persists an idempotent Host-scoped linkedSessions reference only after a projected first-send outcome.

  • Navigates linked items through the existing Desktop Session identity path.

  • Keeps Inbox target selection, execution-state projection, automatic completion, model-visible tools, turn-tail injection, result refs, prioritization, and board redesign out of scope.

  • Keeps a claim without a projected Session until the next Start or a surface-owner mismatch; after a link failure, the resolved Session id is retained for same-item retry.
  • The experiment is enabled only in a development renderer with:

    VITE_MAKA_WORK_BOARD_START_TASK=1
    

    This is intentionally not a persisted user setting. The goal is maintainer/contributor dogfooding before deciding whether to productize the entry and continue later Work Board phases.

    Verification

  • npm test: 1580 passed, 12 skipped; runtime-host and other relevant suites passed.

  • npm --workspace @maka/desktop run build:main: passed.

  • Focused first-send cleanup tests: 16 passed.

  • Renderer TypeScript check: passed.

  • Biome lint: passed.

  • git diff --check: passed.
  • The storage workspace test run remains affected by the existing sandbox EPERM chmod restriction under ~/Library/Application Support/Maka / ~/Library/Caches/Maka; this is environmental and unrelated to the changed Work Board behavior.

    Generated-by: Codex

    AI use

    Codex assisted with implementation, review, and test execution. The contributor reviewed the resulting changes and owns the final PR.

    Review follow-up

    Addressed the review comments (3 P1 + 2 P2):

  • P1-1 – The pending Work Board claim is bound to a concrete New Task surface owner token rather than the target-scoped draft bucket. A first send from any other surface cannot consume the claim or link the wrong Session.

  • P1-2 – The claim is cleared only after linkSession succeeds. On failure the Session id is retained, so pressing Start on the same item retries the same Session instead of creating a duplicate.

  • P1-3 – workBoard:linkSession now resolves the board item's project and passes it to the Host validator, which requires the Session's workspace target to be a project matching that id. Cross-project links on the same Host are rejected.

  • P2-1 – linkedSessions is now a single-link contract (WORK_BOARD_MAX_LINKED_SESSIONS = 1): a freshly started Session replaces any previous link, so the array stays bounded. Read paths remain tolerant of legacy multi-entry arrays.

  • P2-2 – The Start task experiment now requires import.meta.env.DEV === true in addition to VITE_MAKA_WORK_BOARD_START_TASK=1, so it is unreachable in production builds.
  • Tests added: 4 wiring scenarios in workbar-controller.test.ts (surface-bound claim, same-surface link, failed-link retry reusing the Session, opening a linked Session), 2 project-ownership cases in work-board-ipc-main.test.ts, and a single-link contract case in work-board-store.test.ts. Desktop main-process suite: 2074 passed / 0 failed; typecheck, biome, and both architecture checks pass.

    Second review follow-up

    Addressed the second review round (2 P1 + 1 P2):

  • P1 (surface identity) – draftKey is a target-scoped draft bucket, not a surface identity. openNewTaskSurface() now returns the existing Session selection revision it creates; the Work Board claim stores that token immediately, and Composer carries the same captured token through first-send projection. A New Task reopened on the same Host/project gets a different revision and cannot consume the claim. This removes module-global state, render-time mutation, and the tests' manual backfill renders.

  • P1 (TOCTOU) – workBoard:linkSession now passes the item.revision read before Host validation as expectedRevision to store.linkSession, which enforces the CAS inside its write transaction (operation_conflict on mismatch). A concurrent mutation during listSessions() can no longer write a Session validated for one project into an item that has moved to another. Added a revision-CAS fail-closed test; the cross-project test now uses a production-shaped Session workspace projection.

  • P2 (retry durability) – the in-renderer pending-link claim is retained across a failed link for same-Session retry within the current renderer lifetime. Renderer reload/restart before the retry is an accepted, documented spike limitation (pending-link persistence is tracked for a later phase); recorded in docs/work-board-contract.md.
  • Desktop main-process suite: 2076 passed / 0 failed; typecheck, biome, and architecture checks pass.

    Third review follow-up

    Addressed review 5110159288:

  • Reused the renderer-owned Session selection revision as the New Task surface owner and handed it through synchronously from open to claim to projected first send.

  • Clarified that the stored-item decoder preserves valid distinct legacy links while dropping malformed/duplicate entries; only the strict mutation normalizer rejects more than one link.

  • Updated the Summary to match the implemented pending-claim lifecycle.
  • Focused first-send and Workbar tests: 35 passed / 0 failed; desktop typecheck, Biome lint, renderer architecture checks, and git diff --check pass.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: liugddx Review duration: 16154m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4598"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%
    Repository