Skip to content

refactor(mcp): route workflow controls through services - #361

Merged
Shooksie merged 1 commit into
mainfrom
audit/task-971-workflow-control-services
Jul 29, 2026
Merged

refactor(mcp): route workflow controls through services#361
Shooksie merged 1 commit into
mainfrom
audit/task-971-workflow-control-services

Conversation

@Shooksie

Copy link
Copy Markdown
Contributor

What changed

  • routes workflow pause, cancel, resume, approve, and reject MCP tools through typed in-process application services
  • authorizes the exact persisted workflow owner before confirmation, validation, teardown, or mutation
  • rehydrates the persisted actor for detached resume and post-approval continuations, including actor-partitioned task projections
  • exposes the now-enforced controls on actor-bound MCP servers and updates the application-contract documentation

Why

These lifecycle tools still crossed a child-CLI/argv boundary and could not safely be exposed to a user-scoped Portal application host. Workflow continuations also needed to retain their original user and tenant instead of falling back to global scope.

Impact

The Portal can control an authenticated user's workflows in process without identity downgrade. Cross-user, cross-tenant, unowned, and unknown workflow IDs remain concealed as not_found.

Validation

  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo animus-lint
  • cargo test -p orchestrator-cli --locked -- --test-threads=1 (1,428 unit tests plus binary/integration targets)
  • focused owner mutation, cross-actor concealment, and lifecycle actor-rehydration tests
  • git diff --check

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
animus-docs Ready Ready Preview, Comment Jul 29, 2026 3:38pm

Request Review

@animus-launchapp-gitprovider animus-launchapp-gitprovider Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

VERDICT: CHANGES REQUESTED

  1. crates/orchestrator-cli/src/services/operations/ops_workflow/phases.rs:approve_manual_phaseapproved_by: lifecycle_actor.as_ref().map(|actor| actor.user_id.clone()).unwrap_or_else(|| protocol::ACTOR_CLI.to_string()) records the workflow owner as the approver, even when the documented local-operator path approves an actor-owned workflow. That makes the approval audit claim Alice approved her own gate when a global CLI operator actually did it. REQUIRED CHANGE: keep the persisted lifecycle_actor exclusively for continuation and task-projection partitioning, and pass the actual approving principal into approve_manual_phase from workflow_phase_approve_application; write approved_by from the authenticated caller when present and protocol::ACTOR_CLI for the actor-less local CLI path. Verify with tests that (a) an actor-bound approval records the authenticated owner's user_id, and (b) a local actor-less approval of an actor-owned workflow records ACTOR_CLI while the continuation request and task projection still retain the persisted workflow actor.

The typed in-process routing, pre-mutation owner concealment, persisted-actor rehydration for detached continuations, and focused cross-user/cross-tenant tests are otherwise well structured and directly advance TASK-971. CI is currently still pending, with completed checks green so far.

@Shooksie
Shooksie marked this pull request as ready for review July 29, 2026 15:40
@Shooksie
Shooksie merged commit 19b511d into main Jul 29, 2026
14 checks passed
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.

1 participant