Skip to content

feat(modes): add user-defined staged workflows - #2194

Merged
vastsa merged 8 commits into
mainfrom
feat/mode-definitions
Nov 8, 2026
Merged

vastsa merged 8 commits into
mainfrom
feat/mode-definitions

Conversation

@vastsa

@vastsa vastsa commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Summary

Introduce global user-defined modes (~/.pi/modes/<id>/mode.md) with simple prompts or staged workflows, artifact checks, approval and command gates, compaction injection, and durable run controls. The existing Plan proposal pipeline stays intact. Goal uses the staged run engine rather than the retired Goal negotiation flow.

Host-core remains authoritative for definition snapshots, stage transitions, claims, permissions, budgets and settlement. Host-started turns cap Auto at Accept edits. Staged workflows are local-workspace only. Builtin mode ids are reserved; settings can duplicate them under a user id.

Original contribution and attribution

This is the maintainer-directed redesign of #1999 / #2140 / #2141, discussed in this task with explicit authorization to take the work over. The durable claim, revision-CAS, budget and settlement design originates from new-Beginner. The implementation commit retains Co-authored-by: new-Beginner <[email protected]> and the ported modules/ADR identify the source. No contributor branch was rewritten or force-pushed. The original PRs remain untouched until this replacement lands.

Verification

  • Shared: 1442 tests passed.
  • AgentHost: 66 tests passed.
  • Agent runtime: 1862 tests passed.
  • Full desktop suite: 4950 passed, 3 existing skips (concurrency 4).
  • Rust host-core: 1240 passed, 1 existing ignored.
  • Desktop TypeScript check and production Electron build passed.
  • Biome, style, architecture, agent-policy, English/Chinese docs and docs structure checks passed.
  • Rust fmt and Clippy passed; 2 existing warnings in review/transcripts, none added by this feature.
  • Real isolated Host workflow E2E: snapshot -> artifact failure/pass -> approval -> exact command gate/mismatch rejection -> completion -> Agent.
  • Headless Plan E2E: 14 passed, 4 documented environment/clock/long-timeout skips.

The macOS review-path test fails on unchanged main under the default /var temporary path; both baseline and candidate were checked. Candidate Rust validation uses an isolated canonical scratch temporary directory and passes. An initially hanging mode RPC fixture was fixed to answer the real permission request, without weakening the permission cap or extending a timeout.

No paid model API, user-running Desktop instance, verify:ui:*, or release installation was used. PR checks and the integration candidate still gate landing.

vastsa and others added 5 commits November 8, 2026 15:10
Replace closed mode selection with validated definitions and durable staged\nrun coordination. Preserve the existing Plan approval flow and reuse the\nauthoritative claim and settlement design from the Goal contribution.

Co-authored-by: new-Beginner <[email protected]>
Exercise staged workflows against an isolated real Host and retain normal\npermission approval in continuation tests. Update existing IPC fixtures for\nthe mode coordinator and document the storage and RPC contracts.
# Conflicts:
#	docs/spec/06-delivery/04-e2e-test-plan.md
Keep workspace and approval assertions for Plan while checking the explicit\nrejection of retired Goal proposals. Remove redundant snapshot error closures\nso this feature adds no Clippy warnings.
Copilot AI balanced review requested due to automatic review settings November 8, 2026 14:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

# Conflicts:
#	docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
Use the supported v-pre container so double-brace workflow variables remain\nliteral with raw HTML disabled. Keep the site-wide HTML restriction intact.
# Conflicts:
#	docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@vastsa
vastsa merged commit 181d11e into main Nov 8, 2026
6 checks passed
yg2224 pushed a commit to yg2224/PI-Desktop that referenced this pull request Nov 9, 2026
The staged-mode redesign (vastsa#2194) kept the durable Goal engine but dropped
several controls that vastsa#1999 / vastsa#2141 and issue vastsa#1995 asked for. This adds
them back on top of the mode run engine: edit the objective and budget of
an open run (modes.update, effective from the next claim), a per-run and
a settings default Goal budget (goalBudget), Remove as distinct from Stop,
a bounded closeout when a running turn is paused, and hiding the task dock
while a Goal run is open.

The closeout and Remove reach the running turn through a new sidecar
notice (agent.modeTurnNotice); both are system-side and never fake a user
message. A CompleteStage from a turn claimed for an edited objective is
refused with MODE_INPUT_CHANGED, and the next turn is told the objective
changed. All contract changes are additive.

Refs vastsa#1995
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.

2 participants