Skip to content

feat: introduce PR workflow support with workflowType and idempotent execution#205

Open
patkaryash wants to merge 2 commits into
OpenScanAI:masterfrom
patkaryash:feat/pr-workflow-and-workflowType
Open

feat: introduce PR workflow support with workflowType and idempotent execution#205
patkaryash wants to merge 2 commits into
OpenScanAI:masterfrom
patkaryash:feat/pr-workflow-and-workflowType

Conversation

@patkaryash

Copy link
Copy Markdown

Summary

Introduce first-class PR workflow support by adding a dedicated workflowType (issue | pr) throughout Paperclip.

This enables the system to distinguish standard issue workflows from Pull Request workflows and apply PR-specific behavior such as isolated workspaces, deterministic execution, and idempotent PR handling.

##What Changed
-added a workflow_type column to the issues table with migration 0094.
-Introduced the shared IssueWorkflowType type, constants, validators, and exports.
-Propagated workflowType through issue APIs, heartbeat execution, task payloads, and runtime context.
-Updated the execution workspace policy so PR workflows default to isolated workspaces when no explicit policy is configured.
-Added a workflow type selector to the New Issue dialog and a PR badge on the Issue Detail page.
-Added the PR workflow idempotency service with deterministic step resolution, resume/skip logic, and SHA-256 fingerprinting.
-Added onboarding assets and updated tests, Storybook fixtures, and validation.

##Validation
-Added and updated automated tests.
-execution-workspace-policy.test.ts — 16 passing
-pr-workflow-idempotency.test.ts — 31 passing
-Verified end-to-end PR workflow execution using YAS-243, including branch creation, commit, push, and Pull Request creation.

##Risks
-Database migration introducing a new non-null workflow_type column.
-Existing issues continue to default to issue, maintaining backward compatibility.
-Runtime behavior changes apply only to PR workflow issues.

##Thinking Path
-Paperclip orchestrates AI agents that execute engineering work across repositories.
-Engineering tasks may result in either discussion or Pull Requests.
-Previously, both workflows were represented identically, preventing the runtime from applying PR-specific behavior.
-This limited workspace isolation and made deterministic PR execution difficult.
-This pull request introduces a first-class workflowType and propagates it through the database, backend, runtime, workspace policy, and UI.
The result is a more reliable and extensible foundation for PR-based workflows.

Add the IssueWorkflowType type and plumbing needed for PR workflows.

- Database: add workflow_type column to issues table with migration 0094
- Shared: ISSUE_WORKFLOW_TYPES constants, IssueWorkflowType type, validator and export plumbing
- API: include workflowType in issue selects and heartbeat wake payload/task markdown
- Workspace policy: PR workflow issues default to isolated_workspace when no explicit policy is set
- UI: workflowType selector in NewIssueDialog, PR badge on IssueDetail, fixture/story updates
- Onboarding: PR_WORKFLOW_EXIT_GATE.md default instruction asset
- PR workflow idempotency service with tests (step resolution, skip/resume/recreate logic, sha256 fingerprints)

Validation: tested via end-to-end PR workflow executions including a clean validation using YAS-243.
- Patch hermes-paperclip-adapter@0.2.0 for Paperclip auth and workspace resolution
- Add Authorization header guidance and propagate PAPERCLIP_API_KEY from ctx.authToken
- Resolve cwd from paperclipWorkspace realizations
- Ignore persisted sessions by default for fresh issue conversations
- Unwrap structured env values
- Only apply tsx loader to TS plugin worker entrypoints to avoid tsx Windows ESM bug
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