Skip to content

feat(work-panel): open plan and goal artifacts in the bundled file view - #621

Merged
vastsa merged 6 commits into
mainfrom
feat/plan-artifact-opens-in-file-view
Sep 19, 2026
Merged

vastsa merged 6 commits into
mainfrom
feat/plan-artifact-opens-in-file-view

Conversation

@Tioit-Wang

Copy link
Copy Markdown
Collaborator

What changed

A plan or goal approval artifact used to open in the host file tab while every
other project file the conversation names already opens in the bundled
pi.file-manager view, so one file family travelled through two surfaces and
the approval opener missed the file view's preview and editing support.

preferredFileWorkPanelTab / hasPluginView in
apps/desktop/src/lib/work-panel-tabs.ts now own that choice: the bundled file
view whenever it is launchable (deep-linked to the artifact path), the host file
tab otherwise. Both the plan/goal reveal (openPlanArtifact) and the approval
bar's own opener use it, and the chat file-reference hook shares the same check
instead of repeating it. The reveal itself is unchanged: the artifact still
creates or activates a tab in its originating session.

Review found a startup defect on the way: bootstrap opened each pending plan's
artifact before the renderer had read the launchable views, so a restart or
reload fell back to the host file tab and then took a second tab when
selectSession restored the same proposal. The view list is resolved before
that loop now, with a test pinning the order.

Specs follow: decision D452 plus its zh-CN mirror, 04-ux/08-component-spec.md
§5.4/§10A.2, 04-ux/09-interaction-patterns.md §5A, E2E-106, and a sweep of the
remaining pre-D451 claims in ADRs 0019/0042/0068/0105/0108, E2E-058, the
screenshots guide, and two stale zh-CN UX mirrors (#619).

Verification

On the branch tip, Windows x64:

  • pnpm build:js — pass.
  • pnpm --filter @pi-desktop/desktop typecheck — pass (exit 0).
  • pnpm --filter @pi-desktop/docs test — 11/11, including the EN/zh mirror parity
    check (node docs/scripts/check-locales.mjs → verified 78 pairs).
  • Targeted desktop suites (work-panel, work-panel-tabs, plan approval, plan
    source contract, plan renderer flow, chat review entry, bundled plugins, tool
    row file refs, plugin-view-host contracts) — 119/119.
  • Full desktop suite — 2216 tests: 2191 pass, 17 fail, 7 cancelled. Those 17
    failures are outside this diff and also fail without it: the macOS
    notarization/DMG script checks (Windows runner), plugin websocket/net timeouts,
    the agent-extensions npm runner, logger redaction, the assistant error copy,
    and the plugin fs-scope case.
  • NOT RUN: test:e2e / test:e2e:plan-ui (no display in this environment, so
    the renderer surface is covered by the targeted suites instead of Electron E2E),
    cargo test (no Rust change), and pnpm lint, which this checkout cannot run
    because an unrelated second worktree contributes a nested biome.json.

Risk

The bundled file view can edit and save the artifact, so a plan changed before
Approve now fails the host's recorded-hash check (PLAN_ARTIFACT_HASH_MISMATCH)
until the proposal is rejected and resubmitted; §10A.2 documents that in both
languages. Preventing the edit would be a separate plugin write-policy decision.

Closes #618
Closes #619
Refs #620

The contract approval card's opener handed the immutable .pi/plan or
.pi/goal markdown to the host file tab, while every other project file
the conversation names already opens in the bundled pi.file-manager
view, so a plan or goal landed in the one surface the user does not
browse project files in.

Both callers now pick their tab through one preference helper: the file
view when it is launchable, the host file tab otherwise. The chat
file-reference hook shares the same launcher check instead of repeating
it, and the decision log records the amendment as D452.

Renderer only; the approval reveal keeps creating or activating a tab in
its originating session.
The English decision log gained the D452 row and two specs gained a clause about which surface opens a plan or goal artifact, but the Chinese mirrors kept their old shape. The docs test compares table shape between every English page and its zh-CN mirror, so the missing row failed 'every English specification has a valid Chinese mirror'.

Mirror the row and both clauses so the pair stays structurally and semantically in sync.
…tore

bootstrap opened each pending plan's artifact before the renderer had read the launchable plugin views, so a restart or reload with a live approval fell back to the host file tab and then took a second tab when selectSession restored the same proposal. Refresh the view list before that loop, which is what the surface choice needs.

Also record the surface's consequence: the bundled file view can edit and save the artifact, so a plan changed before Approve fails the host's recorded-hash check (PLAN_ARTIFACT_HASH_MISMATCH) until the proposal is resubmitted, and align the E2E wording with 'not launchable'.
…tore

The previous assertion only required the view refresh to appear within 400 characters before some openPlanArtifact call, which a move into the restore loop itself would still satisfy, and nothing covered the slice call sites that forward the live list.

Pin the bootstrap order instead - the refresh, then the pending-plan loop, then the first artifact open - and require both slices to pass get().pluginViews.
The same 'for (const proposal of activePendingPlans)' shape also runs once before the set({ ready }) that precedes the restore, so a plain indexOf matched the planning-state loop and the new assertion failed for the wrong reason.

Search from the refresh index instead, which finds the restore loop and the artifact open it guards.
PR #609 removed the tool-result Review gate but left present-tense claims that a tool result or a conversation artifact still opens, creates, or activates Review: two ADRs, the ADR 0019/0042 work-panel notes, the E2E-058 expectation, the screenshots guide, and stale zh-CN mirrors of two UX pages.

Rewrite them to the shipped rule - Review opens only on explicit user action - and name the plan/goal artifact's host-chosen view (D452) in the one source comment that described who opens a work-panel view. No behavior, protocol, or decision-ID change.
vastsa added a commit that referenced this pull request Sep 19, 2026
feat(work-panel): land PR #621 plan artifacts in the file view
@vastsa
vastsa merged commit 741c1cd into main Sep 19, 2026
4 checks passed
@vastsa
vastsa deleted the feat/plan-artifact-opens-in-file-view branch September 21, 2026 11:16

This branch was successfully deployed

1 active deployment
Preview — 0a2082e0 Deployed Sep 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] D451 之后多处文档仍声明审阅由编辑产物自动打开 [Feature] 计划/目标审批工件改用内置文件视图打开

2 participants