@coralai/sps-cli 0.23.15 → 0.23.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -19
- package/dist/core/taskPrompts.d.ts +29 -0
- package/dist/core/taskPrompts.d.ts.map +1 -0
- package/dist/core/taskPrompts.js +126 -0
- package/dist/core/taskPrompts.js.map +1 -0
- package/dist/engines/CloseoutEngine.d.ts +10 -11
- package/dist/engines/CloseoutEngine.d.ts.map +1 -1
- package/dist/engines/CloseoutEngine.js +333 -58
- package/dist/engines/CloseoutEngine.js.map +1 -1
- package/dist/engines/ExecutionEngine.d.ts +0 -6
- package/dist/engines/ExecutionEngine.d.ts.map +1 -1
- package/dist/engines/ExecutionEngine.js +44 -152
- package/dist/engines/ExecutionEngine.js.map +1 -1
- package/dist/manager/post-actions.d.ts +17 -3
- package/dist/manager/post-actions.d.ts.map +1 -1
- package/dist/manager/post-actions.js +55 -35
- package/dist/manager/post-actions.js.map +1 -1
- package/dist/manager/recovery.d.ts.map +1 -1
- package/dist/manager/recovery.js +40 -46
- package/dist/manager/recovery.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,14 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
> **中文文档**: See `README-CN.md` in the source repository for Chinese documentation.
|
|
6
6
|
|
|
7
|
-
**v0.23.
|
|
7
|
+
**v0.23.17**
|
|
8
8
|
|
|
9
9
|
SPS (Smart Pipeline System) is a fully automated development pipeline CLI tool driven by AI Agents. From task card creation to code merging, the entire process runs unattended.
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
-
Create cards -> Start pipeline ->
|
|
12
|
+
Create cards -> Start pipeline -> Development worker completes branch work -> QA worker integrates branch -> Notify completion
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
Current design direction: SPS is converging on a worker-owned two-phase execution model. `Inprogress` is the development phase, `QA` is the integration/merge phase, and label-driven skill profile injection remains part of worker prompt construction. `v0.23.16` added per-worktree `.sps/development_prompt.txt` and `.sps/integration_prompt.txt`, plus phase-aware recovery prompt selection. `v0.23.17` moves the main integration path into the `QA` worker phase: development completion hands tasks to QA, and QA now launches or resumes an integration worker instead of relying on a fixed merge script as the primary path.
|
|
16
|
+
|
|
15
17
|
## Table of Contents
|
|
16
18
|
|
|
17
19
|
- [Installation](#installation)
|
|
@@ -108,20 +110,21 @@ Each task card progresses through the following state machine, fully driven by S
|
|
|
108
110
|
|
|
109
111
|
### MR_MODE=none (Default, Recommended)
|
|
110
112
|
|
|
111
|
-
|
|
113
|
+
The main path is now a worker-owned two-phase flow:
|
|
112
114
|
|
|
113
115
|
```
|
|
114
|
-
Planning -> Backlog -> Todo -> Inprogress -> Done
|
|
116
|
+
Planning -> Backlog -> Todo -> Inprogress -> QA -> Done
|
|
115
117
|
```
|
|
116
118
|
|
|
117
119
|
| Phase | Trigger Engine | Action |
|
|
118
120
|
|-------|---------------|--------|
|
|
119
121
|
| Planning -> Backlog | SchedulerEngine | Select card for queue, check admission criteria |
|
|
120
|
-
| Backlog -> Todo | ExecutionEngine | Create branch, create worktree, generate
|
|
121
|
-
| Todo -> Inprogress | ExecutionEngine | Assign Worker slot,
|
|
122
|
-
| Inprogress ->
|
|
122
|
+
| Backlog -> Todo | ExecutionEngine | Create branch, create worktree, generate phase prompts |
|
|
123
|
+
| Todo -> Inprogress | ExecutionEngine | Assign Worker slot, launch development worker |
|
|
124
|
+
| Inprogress -> QA | PostActions | Detect development completion, release slot, move card to QA |
|
|
125
|
+
| QA -> Done | CloseoutEngine | Launch/resume integration worker, verify merge evidence, release resources, clean up worktree |
|
|
123
126
|
|
|
124
|
-
|
|
127
|
+
In this model, the development worker stops at “implementation complete and committed on the task branch”. The QA worker owns integration: it must inspect the current worktree, rebase/merge the task branch back into the target branch, resolve conflicts, and finish the integration. `.sps/merge.sh` remains only as a legacy/manual fallback while the old merge helpers are being removed. See `docs/design/10-acp-worker-runtime-design.md` for the persistent Agent transport model, the full worker state breakdown, and the local same-user OAuth reuse boundary. See `docs/design/11-runtime-state-authority-and-recovery-redesign.md` for the redesign that demotes `state.json` / `acp-state.json` to projections and re-centers recovery around PM state plus worktree/git evidence. See `docs/design/12-unified-runtime-state-machine.md` for the next-step module cleanup plan that converges `Execution`, `Recovery`, `Monitor`, `Closeout`, and `PostActions` into one state machine authority plus a single runtime coordinator/write path.
|
|
125
128
|
|
|
126
129
|
PTY transport now extends the same session/run model into the default CLI-backed worker path, but the restart boundary is now explicit. Within a running `tick` process, `WORKER_TRANSPORT=pty` still uses `sessionId/runId` for retries and conflict follow-up runs. Across a `tick` restart, SPS no longer pretends it can recover the old PTY session; it recovers the task from `TaskLease + WorktreeEvidence`, judges completion from git/worktree evidence first, and starts a fresh PTY run in the same worktree only if work remains. `WORKER_TRANSPORT=acp` still keeps its session-based model. The PTY hardening sequence remains: v0.23.5 upgrades `node-pty` to a macOS-safe build, auto-restores missing execute permissions on `spawn-helper`, and auto-skips the benign Codex update notice during PTY boot so `ensureSession()` can reach `ready`; v0.23.6 fixes PTY run lifecycle tracking so newly submitted conflict-resolution runs no longer get marked `completed` during the first inspect cycle before the CLI actually leaves the prompt; v0.23.7 switches `sps worker dashboard` from raw PTY pane dumps to structured worker summaries; v0.23.9 validates persisted PTY sessions by PID before treating them as alive; v0.23.10 aligns PM and read-only views around runtime-owned cards; v0.23.11 introduces PM + worktree + session-first runtime projection; v0.23.12 moves recovery/execution onto `TaskLease + WorktreeEvidence`; v0.23.13 pulls monitor/closeout onto the same lease-first model; v0.23.14 completes the write-path migration through `RuntimeStore`; and v0.23.15 finalizes PTY restart behavior as task-level recovery instead of fake session-level recovery. Codex has been verified on launch, task-level recovery, direct merge, same-process resume, PTY conflict fallback, spawn-helper self-heal, immediate post-launch run-state inspection, summary-style dashboard rendering, cold-state liveness validation, runtime-owned PM reconciliation, read-only snapshot rendering, and lease-first recovery/execution/monitor/closeout flow; Claude still depends on host-side `claude auth login` before reaching `ready`.
|
|
127
130
|
|
|
@@ -393,7 +396,7 @@ sps tick <project> [project2] [project3] ... [--once] [--json] [--dry-run]
|
|
|
393
396
|
**Execution order (per tick cycle):**
|
|
394
397
|
|
|
395
398
|
1. **scheduler tick** -- Planning -> Backlog (select cards for queue)
|
|
396
|
-
2. **qa tick** -- QA ->
|
|
399
|
+
2. **qa tick** -- QA -> integration worker -> Done (prioritize finishing branch integration and freeing Worker slots)
|
|
397
400
|
3. **pipeline tick** -- Backlog -> Todo -> Inprogress (prepare environment + launch Worker)
|
|
398
401
|
4. **monitor tick** -- Anomaly inspection and alignment
|
|
399
402
|
|
|
@@ -540,7 +543,7 @@ sps pipeline tick <project> [--json] [--dry-run]
|
|
|
540
543
|
**Internal steps:**
|
|
541
544
|
|
|
542
545
|
1. **Check Inprogress cards** -- Detect Worker completion status. MR_MODE=none pushes directly to Done; MR_MODE=create confirms MR then pushes to Done
|
|
543
|
-
2. **Process Backlog cards** -- Create branch + create worktree + generate
|
|
546
|
+
2. **Process Backlog cards** -- Create branch + create worktree + generate phase prompts -> push to Todo
|
|
544
547
|
3. **Process Todo cards** -- Assign Worker slot + build task context + launch Worker -> push to Inprogress
|
|
545
548
|
|
|
546
549
|
Limited by `MAX_ACTIONS_PER_TICK` (default 1) to prevent launching too many Workers in a single tick cycle. There is a delay between multiple Worker launches (2 seconds in print mode, 10 seconds in interactive mode).
|
|
@@ -765,9 +768,9 @@ QA close-out and worktree cleanup.
|
|
|
765
768
|
sps qa tick <project> [--json]
|
|
766
769
|
```
|
|
767
770
|
|
|
768
|
-
**When MR_MODE=none:** The QA
|
|
771
|
+
**When MR_MODE=none:** QA is the integration phase. The QA worker must inspect the task worktree, continue merge/rebase work, resolve conflicts, and drive the branch back into the target branch. `qa tick` launches or resumes that integration worker and only moves the card to `Done` after merge evidence is observed.
|
|
769
772
|
|
|
770
|
-
**When MR_MODE=create:** QA
|
|
773
|
+
**When MR_MODE=create:** QA remains a compatibility path while MR flow is still being converged on the same worker-owned model.
|
|
771
774
|
|
|
772
775
|
**Automatic worktree cleanup:**
|
|
773
776
|
|
|
@@ -823,8 +826,10 @@ sps monitor tick my-project --json
|
|
|
823
826
|
|------|---------|-----------------|
|
|
824
827
|
| `CLAUDE.md` | Project rules for Claude Code Worker | Yes |
|
|
825
828
|
| `AGENTS.md` | Project rules for Codex Worker | Yes |
|
|
826
|
-
| `.sps/task_prompt.txt` |
|
|
827
|
-
| `.sps/
|
|
829
|
+
| `.sps/task_prompt.txt` | Development-phase compatibility prompt alias | No (.gitignore) |
|
|
830
|
+
| `.sps/development_prompt.txt` | Development-phase worker prompt | No (.gitignore) |
|
|
831
|
+
| `.sps/integration_prompt.txt` | Integration-phase worker prompt | No (.gitignore) |
|
|
832
|
+
| `.sps/merge.sh` | Legacy/manual merge fallback script | No (.gitignore) |
|
|
828
833
|
| `docs/DECISIONS.md` | Project knowledge base -- architecture decisions and technical choices | Yes (Worker auto-maintained) |
|
|
829
834
|
| `docs/CHANGELOG.md` | Project knowledge base -- change log | Yes (Worker auto-maintained) |
|
|
830
835
|
|
|
@@ -841,8 +846,9 @@ Prompt assembly order: Skill Profile -> CLAUDE.md/AGENTS.md -> DECISIONS.md/CHAN
|
|
|
841
846
|
1. `CLAUDE.md` and `AGENTS.md` are committed to the repository's main branch
|
|
842
847
|
2. When creating a git worktree, these files are automatically inherited
|
|
843
848
|
3. On startup, the Worker reads CLAUDE.md to understand project rules (auto-discovered in interactive mode; auto-loaded from cwd in print mode)
|
|
844
|
-
4. Task-specific information
|
|
845
|
-
5.
|
|
849
|
+
4. Task-specific information is written into `.sps/development_prompt.txt` and `.sps/integration_prompt.txt` inside each worktree; `.sps/task_prompt.txt` remains as a development-phase compatibility alias
|
|
850
|
+
5. Development workers use the development prompt and stop at a committed task branch; QA workers use the integration prompt and complete merge/conflict work
|
|
851
|
+
6. `.sps/merge.sh` remains only as a legacy/manual fallback while the fixed merge path is being removed
|
|
846
852
|
|
|
847
853
|
### Project Knowledge Base
|
|
848
854
|
|
|
@@ -905,7 +911,7 @@ Project conf can reference global variables (e.g., `${PLANE_URL}`).
|
|
|
905
911
|
|-------|----------|---------|-------------|
|
|
906
912
|
| `PM_TOOL` | No | `trello` | PM backend type: `plane` / `trello` / `markdown` |
|
|
907
913
|
| `PIPELINE_LABEL` | No | `AI-PIPELINE` | Pipeline card label |
|
|
908
|
-
| `MR_MODE` | No | `none` | Merge mode: `none` (
|
|
914
|
+
| `MR_MODE` | No | `none` | Merge mode: `none` (worker-owned QA integration back to target branch) / `create` (create MR, review flow under development) |
|
|
909
915
|
|
|
910
916
|
#### Worker
|
|
911
917
|
|
|
@@ -972,7 +978,7 @@ MAX_CONCURRENT_WORKERS=3
|
|
|
972
978
|
MAX_ACTIONS_PER_TICK=1
|
|
973
979
|
|
|
974
980
|
# Merge mode
|
|
975
|
-
MR_MODE="none" # none (
|
|
981
|
+
MR_MODE="none" # none (worker-owned QA integration) or create (create MR)
|
|
976
982
|
```
|
|
977
983
|
|
|
978
984
|
---
|
|
@@ -1027,7 +1033,7 @@ Layer 0 Core Runtime Configuration, paths, state, locks, logging
|
|
|
1027
1033
|
| Engine | Responsibility |
|
|
1028
1034
|
|--------|---------------|
|
|
1029
1035
|
| SchedulerEngine | Planning -> Backlog (card selection, sorting, admission checks) |
|
|
1030
|
-
| ExecutionEngine | Backlog -> Todo -> Inprogress
|
|
1036
|
+
| ExecutionEngine | Backlog -> Todo -> Inprogress (prepare environment, launch development Worker, detect completion handoff to QA) |
|
|
1031
1037
|
| CloseoutEngine | Worktree cleanup (legacy QA card handling when MR_MODE=create) |
|
|
1032
1038
|
| MonitorEngine | Anomaly detection (orphan cleanup, timeouts, blocks, state alignment, dead Worker completion detection) |
|
|
1033
1039
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CardState } from '../models/types.js';
|
|
2
|
+
import type { TaskLeasePhase } from './state.js';
|
|
3
|
+
export type WorkerTaskPhase = 'development' | 'integration';
|
|
4
|
+
export declare const DEVELOPMENT_PROMPT_FILE = "development_prompt.txt";
|
|
5
|
+
export declare const INTEGRATION_PROMPT_FILE = "integration_prompt.txt";
|
|
6
|
+
export declare const LEGACY_TASK_PROMPT_FILE = "task_prompt.txt";
|
|
7
|
+
interface SharedPromptContext {
|
|
8
|
+
taskSeq: string;
|
|
9
|
+
taskTitle: string;
|
|
10
|
+
taskDescription: string;
|
|
11
|
+
cardId: string;
|
|
12
|
+
worktreePath: string;
|
|
13
|
+
branchName: string;
|
|
14
|
+
targetBranch: string;
|
|
15
|
+
mergeMode: 'none' | 'create';
|
|
16
|
+
gitlabProjectId: string;
|
|
17
|
+
skillContent?: string;
|
|
18
|
+
projectRules?: string;
|
|
19
|
+
knowledge?: string;
|
|
20
|
+
}
|
|
21
|
+
interface PhasePromptContext extends SharedPromptContext {
|
|
22
|
+
phase: WorkerTaskPhase;
|
|
23
|
+
}
|
|
24
|
+
export declare function selectWorkerPhase(pmState: CardState | null | undefined, leasePhase?: TaskLeasePhase | null): WorkerTaskPhase;
|
|
25
|
+
export declare function promptFileForPhase(phase: WorkerTaskPhase): string;
|
|
26
|
+
export declare function buildPhasePrompt(ctx: PhasePromptContext): string;
|
|
27
|
+
export declare function buildResumePrompt(phase: WorkerTaskPhase, worktreePath: string, branchName: string, originalPrompt: string | null): string;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=taskPrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskPrompts.d.ts","sourceRoot":"","sources":["../../src/core/taskPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,aAAa,CAAC;AAE5D,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAEzD,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,kBAAmB,SAAQ,mBAAmB;IACtD,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EACrC,UAAU,CAAC,EAAE,cAAc,GAAG,IAAI,GACjC,eAAe,CAMjB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAEjE;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAsBhE;AA6ED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,MAAM,CAuBR"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export const DEVELOPMENT_PROMPT_FILE = 'development_prompt.txt';
|
|
2
|
+
export const INTEGRATION_PROMPT_FILE = 'integration_prompt.txt';
|
|
3
|
+
export const LEGACY_TASK_PROMPT_FILE = 'task_prompt.txt';
|
|
4
|
+
export function selectWorkerPhase(pmState, leasePhase) {
|
|
5
|
+
if (pmState === 'QA')
|
|
6
|
+
return 'integration';
|
|
7
|
+
if (leasePhase && ['merging', 'resolving_conflict'].includes(leasePhase)) {
|
|
8
|
+
return 'integration';
|
|
9
|
+
}
|
|
10
|
+
return 'development';
|
|
11
|
+
}
|
|
12
|
+
export function promptFileForPhase(phase) {
|
|
13
|
+
return phase === 'integration' ? INTEGRATION_PROMPT_FILE : DEVELOPMENT_PROMPT_FILE;
|
|
14
|
+
}
|
|
15
|
+
export function buildPhasePrompt(ctx) {
|
|
16
|
+
const sections = [];
|
|
17
|
+
if (ctx.skillContent?.trim()) {
|
|
18
|
+
sections.push(ctx.skillContent.trim());
|
|
19
|
+
sections.push('---');
|
|
20
|
+
}
|
|
21
|
+
if (ctx.projectRules?.trim()) {
|
|
22
|
+
sections.push(ctx.projectRules.trim());
|
|
23
|
+
sections.push('---');
|
|
24
|
+
}
|
|
25
|
+
if (ctx.knowledge?.trim()) {
|
|
26
|
+
sections.push(ctx.knowledge.trim());
|
|
27
|
+
sections.push('---');
|
|
28
|
+
}
|
|
29
|
+
sections.push(buildTaskSection(ctx));
|
|
30
|
+
sections.push(buildPhaseInstructions(ctx));
|
|
31
|
+
return sections.join('\n\n').trim() + '\n';
|
|
32
|
+
}
|
|
33
|
+
function buildTaskSection(ctx) {
|
|
34
|
+
return `# Current Task
|
|
35
|
+
|
|
36
|
+
Task ID: ${ctx.taskSeq}
|
|
37
|
+
Task: ${ctx.taskTitle}
|
|
38
|
+
Branch: ${ctx.branchName}
|
|
39
|
+
Target Branch: ${ctx.targetBranch}
|
|
40
|
+
Card Full ID: ${ctx.cardId}
|
|
41
|
+
GitLab Project ID: ${ctx.gitlabProjectId}
|
|
42
|
+
MR Mode: ${ctx.mergeMode}
|
|
43
|
+
Worktree: ${ctx.worktreePath}
|
|
44
|
+
|
|
45
|
+
Description:
|
|
46
|
+
${ctx.taskDescription || '(no description)'}`;
|
|
47
|
+
}
|
|
48
|
+
function buildPhaseInstructions(ctx) {
|
|
49
|
+
if (ctx.phase === 'integration') {
|
|
50
|
+
return `# Integration Phase Instructions
|
|
51
|
+
|
|
52
|
+
You are in the integration phase for this task.
|
|
53
|
+
|
|
54
|
+
Your responsibility in this phase is to integrate the current task branch back into the target branch.
|
|
55
|
+
|
|
56
|
+
First inspect the repository state yourself in this worktree:
|
|
57
|
+
1. Confirm the current branch
|
|
58
|
+
2. Check git status
|
|
59
|
+
3. Check whether a rebase or merge is already in progress
|
|
60
|
+
4. Inspect conflicts if they exist
|
|
61
|
+
5. Determine the exact next step required to finish integration
|
|
62
|
+
|
|
63
|
+
Rules:
|
|
64
|
+
1. Work only in the current worktree: ${ctx.worktreePath}
|
|
65
|
+
2. Integrate branch ${ctx.branchName} back into target branch ${ctx.targetBranch}
|
|
66
|
+
3. If there are conflicts, resolve them carefully based on the task intent and current codebase
|
|
67
|
+
4. Complete any required git add / rebase --continue / merge follow-up steps
|
|
68
|
+
5. If the integration requires pushing the target branch or the task branch, do it as part of this phase
|
|
69
|
+
6. Validate the repository state before finishing
|
|
70
|
+
7. Do not restart development from scratch unless the repository state clearly requires code changes to complete integration
|
|
71
|
+
8. If you are blocked by permissions, confirmations, or external policy, report the exact blocker instead of looping forever
|
|
72
|
+
9. Say "done" only after integration work is complete or you have identified a concrete external blocker
|
|
73
|
+
|
|
74
|
+
Completion rule:
|
|
75
|
+
- The preferred outcome of this phase is: branch ${ctx.branchName} has been successfully merged back into ${ctx.targetBranch}, and any required pushes have completed.
|
|
76
|
+
- Do not treat this phase as a fresh development task.`;
|
|
77
|
+
}
|
|
78
|
+
return `# Development Phase Instructions
|
|
79
|
+
|
|
80
|
+
You are in the development phase for this task.
|
|
81
|
+
|
|
82
|
+
Your responsibility in this phase is to complete the implementation work in the current task branch.
|
|
83
|
+
|
|
84
|
+
First inspect the repository state yourself in this worktree:
|
|
85
|
+
1. Confirm the current branch
|
|
86
|
+
2. Check git status
|
|
87
|
+
3. Check whether a rebase or merge is already in progress
|
|
88
|
+
4. Inspect the current code and determine what remains to finish the task
|
|
89
|
+
|
|
90
|
+
Rules:
|
|
91
|
+
1. Work only in the current worktree: ${ctx.worktreePath}
|
|
92
|
+
2. Complete the implementation for this task
|
|
93
|
+
3. Run appropriate validation or tests when needed
|
|
94
|
+
4. Commit the finished work to the current task branch ${ctx.branchName}
|
|
95
|
+
5. Do not merge into the target branch ${ctx.targetBranch} in this phase
|
|
96
|
+
6. Do not run merge scripts or perform integration work in this phase
|
|
97
|
+
7. Do not push or update the target branch in this phase
|
|
98
|
+
8. If you are blocked by permissions, confirmations, or missing environment requirements, report the exact blocker
|
|
99
|
+
9. Say "done" only after the implementation work is complete and committed on ${ctx.branchName}
|
|
100
|
+
|
|
101
|
+
Completion rule:
|
|
102
|
+
- The intended end of this phase is: the implementation is complete and committed on branch ${ctx.branchName}.
|
|
103
|
+
- Do not merge into ${ctx.targetBranch} in this phase.`;
|
|
104
|
+
}
|
|
105
|
+
export function buildResumePrompt(phase, worktreePath, branchName, originalPrompt) {
|
|
106
|
+
const phaseLabel = phase === 'integration' ? 'QA' : 'Inprogress';
|
|
107
|
+
const phaseGoal = phase === 'integration'
|
|
108
|
+
? 'Continue the integration work for this task in the current worktree.'
|
|
109
|
+
: 'Continue the development work for this task in the current worktree.';
|
|
110
|
+
const header = [
|
|
111
|
+
'The previous SPS tick process stopped. The old worker session is gone.',
|
|
112
|
+
'Recover this task at the task level in the existing worktree.',
|
|
113
|
+
`Current PM State: ${phaseLabel}`,
|
|
114
|
+
`Worktree: ${worktreePath}`,
|
|
115
|
+
`Branch: ${branchName}`,
|
|
116
|
+
'',
|
|
117
|
+
phaseGoal,
|
|
118
|
+
'First inspect the current repository state yourself before changing anything.',
|
|
119
|
+
'Then continue the same task from the current repository state instead of starting over.',
|
|
120
|
+
].join('\n');
|
|
121
|
+
if (!originalPrompt?.trim()) {
|
|
122
|
+
return header;
|
|
123
|
+
}
|
|
124
|
+
return `${header}\n\nPhase task context:\n---\n${originalPrompt.trim()}`;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=taskPrompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taskPrompts.js","sourceRoot":"","sources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AC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC;IACjE,MAAM,SAAS,GAAG,KAAK,KAAK,aAAa;QACvC,CAAC,CAAC,sEAAsE;QACxE,CAAC,CAAC,sEAAsE,CAAC;IAE3E,MAAM,MAAM,GAAG;QACb,wEAAwE;QACxE,+DAA+D;QAC/D,qBAAqB,UAAU,EAAE;QACjC,aAAa,YAAY,EAAE;QAC3B,WAAW,UAAU,EAAE;QACvB,EAAE;QACF,SAAS;QACT,+EAA+E;QAC/E,yFAAyF;KAC1F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,GAAG,MAAM,iCAAiC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -6,18 +6,12 @@ import type { Notifier } from '../interfaces/Notifier.js';
|
|
|
6
6
|
import type { AgentRuntime } from '../interfaces/AgentRuntime.js';
|
|
7
7
|
import type { CommandResult } from '../models/types.js';
|
|
8
8
|
/**
|
|
9
|
-
* CloseoutEngine handles the QA →
|
|
9
|
+
* CloseoutEngine handles the QA → Done pipeline.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* ├─ already merged → resource release → Done
|
|
16
|
-
* ├─ open + CI success + can_be_merged → attempt merge
|
|
17
|
-
* ├─ open + CI failed → self-repair or NEEDS-FIX
|
|
18
|
-
* ├─ open + CI running/pending → skip
|
|
19
|
-
* ├─ open + cannot_be_merged → CONFLICT
|
|
20
|
-
* └─ closed (not merged) → NEEDS-FIX
|
|
11
|
+
* In the worker-owned two-phase model, QA means integration:
|
|
12
|
+
* - the worker performs rebase / merge / conflict resolution
|
|
13
|
+
* - SPS only checks evidence, starts or resumes the integration worker,
|
|
14
|
+
* and finalizes the task after the branch is merged.
|
|
21
15
|
*/
|
|
22
16
|
export declare class CloseoutEngine {
|
|
23
17
|
private ctx;
|
|
@@ -31,6 +25,8 @@ export declare class CloseoutEngine {
|
|
|
31
25
|
constructor(ctx: ProjectContext, taskBackend: TaskBackend, repoBackend: RepoBackend, workerProvider: WorkerProvider, notifier?: Notifier | undefined, agentRuntime?: AgentRuntime | null);
|
|
32
26
|
tick(): Promise<CommandResult>;
|
|
33
27
|
private processQaCard;
|
|
28
|
+
private inspectQaWorker;
|
|
29
|
+
private startIntegrationWorker;
|
|
34
30
|
private processOpenMr;
|
|
35
31
|
private handleCiFailure;
|
|
36
32
|
private attemptMerge;
|
|
@@ -67,5 +63,8 @@ export declare class CloseoutEngine {
|
|
|
67
63
|
private notifySafe;
|
|
68
64
|
private resumeAcpWorker;
|
|
69
65
|
private logEvent;
|
|
66
|
+
private resolveIntegrationPrompt;
|
|
67
|
+
private isMergedToBase;
|
|
68
|
+
private releaseQaSlot;
|
|
70
69
|
}
|
|
71
70
|
//# sourceMappingURL=CloseoutEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloseoutEngine.d.ts","sourceRoot":"","sources":["../../src/engines/CloseoutEngine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CloseoutEngine.d.ts","sourceRoot":"","sources":["../../src/engines/CloseoutEngine.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAyC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