Skip to content

feat: add strict Conductor orchestration to Poteto Mode - #52

Closed
RomiSinghio wants to merge 8 commits into
ericlitman:mainfrom
RomiSinghio:feat/conductor-poteto-mode
Closed

feat: add strict Conductor orchestration to Poteto Mode#52
RomiSinghio wants to merge 8 commits into
ericlitman:mainfrom
RomiSinghio:feat/conductor-poteto-mode

Conversation

@RomiSinghio

Copy link
Copy Markdown

Closes #51

Depends on #50. Because #50 uses a fork-only head branch, GitHub cannot select it as this upstream PR base. This draft temporarily includes its one preload commit and will shrink to only the Conductor commits after #50 merges.

What changed

  • Adds an opt-in .conductor/poteto-mode.json route shared by Claude Code and Codex.
  • Keeps the invoking Claude or Codex session as the fixed coordinator.
  • Creates one isolated Conductor workspace per delegated Claude, Codex, or Cursor/Grok worker.
  • Adds strict project-policy and live-catalog validation with no agent, model, effort, fast-mode, native-agent, or legacy-runner fallback.
  • Adds a deterministic local JSON helper for durable budgets, crash-safe run state, uncertain-create reconciliation, stable message IDs, strict session receipts, trusted result parsing, and scoped cleanup.
  • Makes setup and the Arena, Architect, How, Interrogate, Reflect, and Swarm skills honor the parent-selected Conductor route.
  • Adds published-contract fixtures. They are explicitly not live acceptance evidence.

The implementation follows the current Conductor contract. whoami is combined with get_session_status because whoami does not expose the current session ID. Uncertain workspace recovery also calls list_workspace_sessions because workspace listings do not expose session IDs.

Verification

  • Bun tests, strict typecheck, static invariants, and plugin validation pass.
  • The exact candidate is installed in every affected harness.
  • The changed behavior passes from each real user surface.
  • The installed version, action, and observed result appear below.

Completed locally:

  • bun test conductor: 47 pass, 0 fail.
  • bun run typecheck: pass.
  • bash tests/conductor-mode-repro.sh: pass.
  • PSTACK_STATIC_ONLY=1 bash tests/skill-collision-repro.sh: pass.
  • Four plugin and marketplace manifests parse: pass.
  • Clean worktree and git diff --check: pass.

Known baseline outside this change:

  • Full bun run test: 204 pass, 1 fail.
  • The failing test is runLane > spends one explicit deadline across preflight and model execution in runner/run.test.ts. It failed identically before this branch work began. Expected preflight status is passed; observed is timed-out.

Live evidence:

Not run. This T3/Codex harness has no Conductor MCP connection. Keep this PR draft until the exact candidate runs from real Claude and Codex Conductor coordinator sessions, including Cursor/Grok 4.6 at xhigh with fast mode disabled. Do not merge, tag, release, or roll it out before that gate passes.

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds an opt-in Conductor orchestration route for Poteto Mode, including strict policy and receipt validation, isolated worker workspaces, durable attempt state, uncertain-create reconciliation, scoped cleanup, shared skill routing, and contract-focused tests.

  • Keeps Claude or Codex as the fixed coordinator and prevents recursive worker delegation.
  • Adds a Bun/TypeScript boundary helper for policy validation, attempt lifecycle management, transcript parsing, receipts, and cleanup targets.
  • Updates setup and delegated workflow skills to honor the selected Conductor route.
  • Adds published-contract fixtures and static/unit coverage while explicitly retaining a live-acceptance release gate.
  • The durable lifecycle currently has defects around post-terminal attempts, ambiguous-workspace cleanup, and concurrent stale-lock recovery.

Confidence Score: 2/5

The PR is not safe to merge until durable runs remain resumable after later attempts, ambiguous workspaces can be cleaned up, and lock recovery preserves exclusive ownership.

A later attempt can remain hidden under a completed run, ambiguous uncertain creates permanently leak their workspaces, and stale-lock races can admit concurrent state writers.

Files Needing Attention: plugins/pstack/skills/poteto-mode/scripts/conductor/store.ts, plugins/pstack/skills/poteto-mode/scripts/conductor/cli.ts

Important Files Changed

Filename Overview
plugins/pstack/skills/poteto-mode/scripts/conductor/store.ts Implements durable run state, budgets, reconciliation, locking, and cleanup, but mishandles new attempts after completion, ambiguous cleanup candidates, and lock ownership races.
plugins/pstack/skills/poteto-mode/scripts/conductor/cli.ts Provides the strict command boundary for policy and attempt operations; its active-only implicit resume exposes the inconsistent completed-run state.
plugins/pstack/skills/poteto-mode/scripts/conductor/boundary.ts Strictly parses Conductor responses, binds receipts, and accepts attempt-scoped assistant results; production transcript callers enforce session ownership.
plugins/pstack/skills/poteto-mode/scripts/conductor/policy.ts Strictly parses the versioned project policy and validates configured targets against the live catalog.
plugins/pstack/skills/poteto-mode/references/conductor-dispatch.md Documents coordinator ownership, isolated dispatch, observation, uncertain-create recovery, and scoped cleanup.
plugins/pstack/skills/setup-pstack/SKILL.md Routes Conductor-enabled projects through strict validation and an isolated marker smoke while preserving portable model sheets.
plugins/pstack/skills/poteto-mode/scripts/conductor/store.test.ts Covers state transitions and sequential lock behavior but misses post-terminal planning, ambiguous cleanup, and concurrent stale-lock recovery.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Claude or Codex coordinator] --> B[Validate project policy and live catalog]
  B --> C[Start or resume durable run]
  C --> D[Plan isolated worker attempt]
  D --> E[Persist creating state]
  E --> F[Create Conductor workspace]
  F --> G[Validate post-create receipt]
  G --> H[Record dispatch cursor and send stable message]
  H --> I[Observe status, transcript, and post-run receipt]
  I -->|Valid result| J[Complete attempt]
  I -->|Failure| K[Record dropout]
  F -->|Uncertain response| L[Reconcile workspace and session]
  J --> M[Emit scoped cleanup targets]
  K --> M
  L --> H
Loading

Fix all with Greploop Fix All in Codex Fix All in Cursor

Reviews (1): Last reviewed commit: "docs: teach Poteto Mode Conductor orches..." | Re-trigger Greptile

Comment on lines +153 to +165
return {
...run,
workers: [
...run.workers,
{
state: "planned",
request,
dispatchMessageId: input.dispatchMessageId,
followUps: [],
},
],
};
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Retries Stay Marked Complete

When all current workers become terminal, the run is marked complete. If the coordinator then plans a retry or later attempt, planAttempt appends the worker without restoring the run to active. After a coordinator restart, implicit resume ignores this completed run and creates a new one, orphaning the pending or running attempt.

Knowledge Base Used:

Fix in Codex Fix in Cursor

Comment on lines +441 to +449
if (
attempt.state !== "queued" &&
attempt.state !== "working" &&
attempt.state !== "complete" &&
attempt.state !== "dropout" &&
attempt.state !== "cancelled"
) {
continue;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Ambiguous Workspaces Cannot Cleanup

When uncertain-create reconciliation finds multiple exact-name workspaces, it records their IDs but leaves the attempt in unknown. Cleanup excludes unknown attempts, so the only permitted cleanup-target command can never return these workspaces. They are therefore leaked, and changing the attempt to a dropout also discards the recorded candidate IDs.

Fix in Codex Fix in Cursor

Comment on lines +1010 to +1015
if (!(await recordedOwnerIsDead())) {
throw new RunStateError(`Conductor run store is locked: ${lockPath}`);
}
await unlink(lockPath).catch(() => undefined);
try {
await writeFile(lockPath, `${process.pid}\n`, { flag: "wx", mode: 0o600 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Lock Recovery Deletes Live Locks

Stale-lock recovery checks the recorded PID and later unlinks the lock path without confirming that the file still belongs to that owner. If two processes recover the same stale lock, one can create and start using a new lock before the other performs its delayed unlink. That unlink removes the live lock and allows concurrent writers to modify durable run state. close() has the same ownership-blind unlink behavior.

Knowledge Base Used: Poteto-mode automation

Fix in Codex Fix in Cursor

@RomiSinghio

Copy link
Copy Markdown
Author

Release preparation update: the candidate is now versioned 1.4.0 at 649206df890aca41e00fbc266ae080e35b2286de; all four marketplace/plugin manifests agree, the static invariants pass, and Claude plugin validation passes. Both Claude and Codex are OAuth-connected to Conductor for the Savari organization, and the live catalog exposes the exact Fable 5.1, Opus 5.1m, GPT-5.6 Sol, and Cursor/Grok 4.6 targets. Live coordinator receipts remain pending #50 landing and exact-candidate workspace setup; keep this PR draft.

@RomiSinghio

Copy link
Copy Markdown
Author

Superseded: Savari will own this customized Conductor mode inside Savari-LLC/savari-monorepo rather than changing the upstream project.

@RomiSinghio RomiSinghio closed this Sep 4, 2026
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.

Add strict Conductor orchestration mode to Poteto Mode

1 participant