Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
},
"scripts": {
"build": "tsc -p tsconfig.json && cp src/server/index.html dist/server/index.html && chmod +x dist/cli/cli.js && node scripts/inject-version.js",
"start": "node dist/cli/cli.js"
"start": "node dist/cli/cli.js",
"test": "node --test dist/**/*.test.js",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"json5": "^2.2.3",
Expand Down
21 changes: 16 additions & 5 deletions src/installer/step-ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,22 @@ export function claimStep(agentId: string): ClaimResult {
JOIN runs r ON r.id = s.run_id
WHERE s.agent_id = ? AND s.status = 'pending'
AND r.status NOT IN ('failed', 'cancelled')
AND NOT EXISTS (
SELECT 1 FROM steps prev
WHERE prev.run_id = s.run_id
AND prev.step_index < s.step_index
AND prev.status NOT IN ('done', 'skipped')
AND (
-- Normal case: all previous steps must be done/skipped
NOT EXISTS (
SELECT 1 FROM steps prev
WHERE prev.run_id = s.run_id
AND prev.step_index < s.step_index
AND prev.status NOT IN ('done', 'skipped')
)
-- Special case: allow claiming verify step when loop step is running (verify_each mode)
OR EXISTS (
SELECT 1 FROM steps loop_step
WHERE loop_step.run_id = s.run_id
AND loop_step.type = 'loop'
AND loop_step.status = 'running'
AND loop_step.loop_config IS NOT NULL
)
)
ORDER BY s.step_index ASC, s.step_id ASC
LIMIT 1`
Expand Down