agent-control-plane 0.1.16 → 0.3.0
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 +93 -14
- package/bin/pr-risk.sh +28 -6
- package/hooks/heartbeat-hooks.sh +62 -22
- package/npm/bin/agent-control-plane.js +360 -10
- package/package.json +6 -3
- package/references/architecture.md +8 -0
- package/references/control-plane-map.md +6 -2
- package/references/release-checklist.md +0 -2
- package/tools/bin/agent-github-update-labels +6 -1
- package/tools/bin/agent-project-catch-up-issue-pr-links +118 -0
- package/tools/bin/agent-project-catch-up-merged-prs +78 -21
- package/tools/bin/agent-project-catch-up-scheduled-issue-retries +123 -0
- package/tools/bin/agent-project-cleanup-session +132 -4
- package/tools/bin/agent-project-heartbeat-loop +116 -1461
- package/tools/bin/agent-project-reconcile-issue-session +90 -117
- package/tools/bin/agent-project-reconcile-pr-session +76 -111
- package/tools/bin/agent-project-run-claude-session +12 -2
- package/tools/bin/agent-project-run-codex-resilient +86 -9
- package/tools/bin/agent-project-run-codex-session +16 -5
- package/tools/bin/agent-project-run-kilo-session +356 -14
- package/tools/bin/agent-project-run-ollama-session +658 -0
- package/tools/bin/agent-project-run-openclaw-session +37 -25
- package/tools/bin/agent-project-run-opencode-session +364 -14
- package/tools/bin/agent-project-run-pi-session +479 -0
- package/tools/bin/agent-project-worker-status +11 -8
- package/tools/bin/cleanup-worktree.sh +6 -1
- package/tools/bin/flow-config-lib.sh +196 -3
- package/tools/bin/flow-resident-worker-lib.sh +120 -2
- package/tools/bin/flow-shell-lib.sh +29 -2
- package/tools/bin/heartbeat-loop-cache-lib.sh +164 -0
- package/tools/bin/heartbeat-loop-counting-lib.sh +306 -0
- package/tools/bin/heartbeat-loop-pr-strategy-lib.sh +199 -0
- package/tools/bin/heartbeat-loop-scheduling-lib.sh +506 -0
- package/tools/bin/heartbeat-loop-worker-lib.sh +319 -0
- package/tools/bin/heartbeat-recovery-preflight.sh +13 -1
- package/tools/bin/heartbeat-safe-auto.sh +119 -20
- package/tools/bin/install-project-launchd.sh +19 -2
- package/tools/bin/prepare-worktree.sh +4 -4
- package/tools/bin/profile-activate.sh +2 -2
- package/tools/bin/profile-adopt.sh +2 -2
- package/tools/bin/project-init.sh +1 -1
- package/tools/bin/project-launchd-bootstrap.sh +11 -8
- package/tools/bin/project-runtimectl.sh +90 -7
- package/tools/bin/provider-cooldown-state.sh +14 -14
- package/tools/bin/reconcile-bootstrap-lib.sh +113 -0
- package/tools/bin/render-flow-config.sh +30 -33
- package/tools/bin/resident-issue-controller-lib.sh +448 -0
- package/tools/bin/resident-issue-queue-status.py +35 -0
- package/tools/bin/run-codex-task.sh +53 -4
- package/tools/bin/scaffold-profile.sh +18 -3
- package/tools/bin/start-issue-worker.sh +1 -1
- package/tools/bin/start-pr-fix-worker.sh +30 -0
- package/tools/bin/start-pr-review-worker.sh +31 -0
- package/tools/bin/start-resident-issue-loop.sh +27 -438
- package/tools/bin/sync-agent-repo.sh +2 -2
- package/tools/bin/sync-dependency-baseline.sh +3 -3
- package/tools/bin/sync-shared-agent-home.sh +4 -1
- package/tools/dashboard/app.js +7 -0
- package/tools/dashboard/dashboard_snapshot.py +13 -29
- package/tools/templates/pr-fix-template.md +3 -7
- package/tools/templates/pr-merge-repair-template.md +3 -7
- package/tools/templates/pr-review-template.md +2 -1
- package/SKILL.md +0 -149
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# resident-issue-controller-lib.sh — controller_* functions for the resident
|
|
3
|
+
# issue loop. Sourced by start-resident-issue-loop.sh to keep the main script
|
|
4
|
+
# focused on the top-level loop logic.
|
|
5
|
+
|
|
6
|
+
controller_unregister_pending_issue() {
|
|
7
|
+
local issue_id="${1:-${ISSUE_ID:-}}"
|
|
8
|
+
[[ -n "${issue_id}" ]] || return 0
|
|
9
|
+
rm -f "$(issue_pending_file "${issue_id}")"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
controller_register_pending_issue() {
|
|
13
|
+
[[ -n "${ISSUE_ID:-}" ]] || return 0
|
|
14
|
+
printf '%s\n' "$$" >"$(issue_pending_file "${ISSUE_ID}")"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
controller_refresh_execution_context() {
|
|
18
|
+
unset \
|
|
19
|
+
ACP_CODING_WORKER \
|
|
20
|
+
ACP_CODEX_PROFILE_SAFE F_LOSNING_CODEX_PROFILE_SAFE \
|
|
21
|
+
ACP_CODEX_PROFILE_BYPASS F_LOSNING_CODEX_PROFILE_BYPASS \
|
|
22
|
+
ACP_CLAUDE_MODEL F_LOSNING_CLAUDE_MODEL \
|
|
23
|
+
ACP_CLAUDE_PERMISSION_MODE F_LOSNING_CLAUDE_PERMISSION_MODE \
|
|
24
|
+
ACP_CLAUDE_EFFORT F_LOSNING_CLAUDE_EFFORT \
|
|
25
|
+
ACP_CLAUDE_TIMEOUT_SECONDS F_LOSNING_CLAUDE_TIMEOUT_SECONDS \
|
|
26
|
+
ACP_CLAUDE_MAX_ATTEMPTS F_LOSNING_CLAUDE_MAX_ATTEMPTS \
|
|
27
|
+
ACP_CLAUDE_RETRY_BACKOFF_SECONDS F_LOSNING_CLAUDE_RETRY_BACKOFF_SECONDS \
|
|
28
|
+
ACP_OPENCLAW_MODEL F_LOSNING_OPENCLAW_MODEL \
|
|
29
|
+
ACP_OPENCLAW_THINKING F_LOSNING_OPENCLAW_THINKING \
|
|
30
|
+
ACP_OPENCLAW_TIMEOUT_SECONDS F_LOSNING_OPENCLAW_TIMEOUT_SECONDS \
|
|
31
|
+
ACP_OPENCLAW_STALL_SECONDS F_LOSNING_OPENCLAW_STALL_SECONDS \
|
|
32
|
+
ACP_ACTIVE_PROVIDER_POOL_NAME F_LOSNING_ACTIVE_PROVIDER_POOL_NAME \
|
|
33
|
+
ACP_ACTIVE_PROVIDER_BACKEND F_LOSNING_ACTIVE_PROVIDER_BACKEND \
|
|
34
|
+
ACP_ACTIVE_PROVIDER_MODEL F_LOSNING_ACTIVE_PROVIDER_MODEL \
|
|
35
|
+
ACP_ACTIVE_PROVIDER_KEY F_LOSNING_ACTIVE_PROVIDER_KEY \
|
|
36
|
+
ACP_PROVIDER_POOLS_EXHAUSTED F_LOSNING_PROVIDER_POOLS_EXHAUSTED \
|
|
37
|
+
ACP_PROVIDER_POOL_SELECTION_REASON F_LOSNING_PROVIDER_POOL_SELECTION_REASON \
|
|
38
|
+
ACP_PROVIDER_POOL_NEXT_ATTEMPT_EPOCH F_LOSNING_PROVIDER_POOL_NEXT_ATTEMPT_EPOCH \
|
|
39
|
+
ACP_PROVIDER_POOL_NEXT_ATTEMPT_AT F_LOSNING_PROVIDER_POOL_NEXT_ATTEMPT_AT \
|
|
40
|
+
ACP_PROVIDER_POOL_LAST_REASON F_LOSNING_PROVIDER_POOL_LAST_REASON
|
|
41
|
+
flow_export_execution_env "${CONFIG_YAML}"
|
|
42
|
+
flow_export_project_env_aliases
|
|
43
|
+
CODING_WORKER="${ACP_CODING_WORKER:-codex}"
|
|
44
|
+
controller_capture_active_provider_context
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
controller_refresh_issue_lane_context() {
|
|
48
|
+
local is_scheduled="${1:-no}"
|
|
49
|
+
local schedule_interval_seconds="${2:-0}"
|
|
50
|
+
|
|
51
|
+
if [[ "${is_scheduled}" == "yes" ]]; then
|
|
52
|
+
ACTIVE_RESIDENT_LANE_KIND="scheduled"
|
|
53
|
+
ACTIVE_RESIDENT_LANE_VALUE="${schedule_interval_seconds}"
|
|
54
|
+
else
|
|
55
|
+
ACTIVE_RESIDENT_LANE_KIND="recurring"
|
|
56
|
+
ACTIVE_RESIDENT_LANE_VALUE="general"
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
ACTIVE_RESIDENT_WORKER_KEY="$(flow_resident_issue_lane_key "${CODING_WORKER}" "${MODE}" "${ACTIVE_RESIDENT_LANE_KIND}" "${ACTIVE_RESIDENT_LANE_VALUE}")"
|
|
60
|
+
ACTIVE_RESIDENT_META_FILE="$(flow_resident_issue_lane_meta_file "${CONFIG_YAML}" "${ACTIVE_RESIDENT_WORKER_KEY}")"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
controller_live_lane_peer() {
|
|
64
|
+
[[ -n "${ACTIVE_RESIDENT_WORKER_KEY}" ]] || return 1
|
|
65
|
+
flow_resident_live_issue_controller_for_key "${CONFIG_YAML}" "${ACTIVE_RESIDENT_WORKER_KEY}" "$$" || return 1
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
controller_yield_to_live_lane_peer() {
|
|
69
|
+
local live_controller=""
|
|
70
|
+
local controller_issue_id=""
|
|
71
|
+
local controller_state=""
|
|
72
|
+
|
|
73
|
+
live_controller="$(controller_live_lane_peer || true)"
|
|
74
|
+
[[ -n "${live_controller}" ]] || return 1
|
|
75
|
+
|
|
76
|
+
controller_issue_id="$(awk -F= '/^ISSUE_ID=/{print $2; exit}' <<<"${live_controller}")"
|
|
77
|
+
controller_state="$(awk -F= '/^CONTROLLER_STATE=/{print $2; exit}' <<<"${live_controller}")"
|
|
78
|
+
|
|
79
|
+
if [[ -n "${controller_issue_id}" && "${controller_issue_id}" != "${ISSUE_ID}" ]]; then
|
|
80
|
+
flow_resident_issue_enqueue "${CONFIG_YAML}" "${ISSUE_ID}" "resident-live-lane" >/dev/null || true
|
|
81
|
+
CONTROLLER_REASON="live-lane-controller-${controller_issue_id}-${controller_state:-running}"
|
|
82
|
+
else
|
|
83
|
+
CONTROLLER_REASON="duplicate-live-lane-controller"
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
return 0
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
controller_capture_active_provider_context() {
|
|
90
|
+
ACTIVE_PROVIDER_POOL_NAME="${ACP_ACTIVE_PROVIDER_POOL_NAME:-${F_LOSNING_ACTIVE_PROVIDER_POOL_NAME:-}}"
|
|
91
|
+
ACTIVE_PROVIDER_BACKEND="${ACP_ACTIVE_PROVIDER_BACKEND:-${F_LOSNING_ACTIVE_PROVIDER_BACKEND:-${CODING_WORKER:-}}}"
|
|
92
|
+
ACTIVE_PROVIDER_MODEL="${ACP_ACTIVE_PROVIDER_MODEL:-${F_LOSNING_ACTIVE_PROVIDER_MODEL:-}}"
|
|
93
|
+
ACTIVE_PROVIDER_KEY="${ACP_ACTIVE_PROVIDER_KEY:-${F_LOSNING_ACTIVE_PROVIDER_KEY:-}}"
|
|
94
|
+
ACTIVE_PROVIDER_SELECTION_REASON="${ACP_PROVIDER_POOL_SELECTION_REASON:-${F_LOSNING_PROVIDER_POOL_SELECTION_REASON:-}}"
|
|
95
|
+
ACTIVE_PROVIDER_NEXT_ATTEMPT_EPOCH="${ACP_PROVIDER_POOL_NEXT_ATTEMPT_EPOCH:-${F_LOSNING_PROVIDER_POOL_NEXT_ATTEMPT_EPOCH:-}}"
|
|
96
|
+
ACTIVE_PROVIDER_NEXT_ATTEMPT_AT="${ACP_PROVIDER_POOL_NEXT_ATTEMPT_AT:-${F_LOSNING_PROVIDER_POOL_NEXT_ATTEMPT_AT:-}}"
|
|
97
|
+
ACTIVE_PROVIDER_LAST_REASON="${ACP_PROVIDER_POOL_LAST_REASON:-${F_LOSNING_PROVIDER_POOL_LAST_REASON:-}}"
|
|
98
|
+
|
|
99
|
+
if [[ -z "${ACTIVE_PROVIDER_MODEL}" ]]; then
|
|
100
|
+
case "${ACTIVE_PROVIDER_BACKEND}" in
|
|
101
|
+
openclaw)
|
|
102
|
+
ACTIVE_PROVIDER_MODEL="${ACP_OPENCLAW_MODEL:-${F_LOSNING_OPENCLAW_MODEL:-}}"
|
|
103
|
+
;;
|
|
104
|
+
claude)
|
|
105
|
+
ACTIVE_PROVIDER_MODEL="${ACP_CLAUDE_MODEL:-${F_LOSNING_CLAUDE_MODEL:-}}"
|
|
106
|
+
;;
|
|
107
|
+
codex)
|
|
108
|
+
ACTIVE_PROVIDER_MODEL="${ACP_CODEX_PROFILE_SAFE:-${F_LOSNING_CODEX_PROFILE_SAFE:-}}"
|
|
109
|
+
;;
|
|
110
|
+
opencode)
|
|
111
|
+
ACTIVE_PROVIDER_MODEL="${ACP_OPENCODE_MODEL:-${F_LOSNING_OPENCODE_MODEL:-}}"
|
|
112
|
+
;;
|
|
113
|
+
kilo)
|
|
114
|
+
ACTIVE_PROVIDER_MODEL="${ACP_KILO_MODEL:-${F_LOSNING_KILO_MODEL:-}}"
|
|
115
|
+
;;
|
|
116
|
+
esac
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
if [[ -z "${ACTIVE_PROVIDER_KEY}" && -n "${ACTIVE_PROVIDER_BACKEND}" && -n "${ACTIVE_PROVIDER_MODEL}" ]]; then
|
|
120
|
+
ACTIVE_PROVIDER_KEY="$(flow_sanitize_provider_key "${ACTIVE_PROVIDER_BACKEND}-${ACTIVE_PROVIDER_MODEL}")"
|
|
121
|
+
fi
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
controller_set_recorded_provider_from_active() {
|
|
125
|
+
LAST_RECORDED_PROVIDER_POOL_NAME="${ACTIVE_PROVIDER_POOL_NAME}"
|
|
126
|
+
LAST_RECORDED_PROVIDER_BACKEND="${ACTIVE_PROVIDER_BACKEND}"
|
|
127
|
+
LAST_RECORDED_PROVIDER_MODEL="${ACTIVE_PROVIDER_MODEL}"
|
|
128
|
+
LAST_RECORDED_PROVIDER_KEY="${ACTIVE_PROVIDER_KEY}"
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
controller_mark_provider_launched() {
|
|
132
|
+
LAST_LAUNCHED_PROVIDER_POOL_NAME="${ACTIVE_PROVIDER_POOL_NAME}"
|
|
133
|
+
LAST_LAUNCHED_PROVIDER_BACKEND="${ACTIVE_PROVIDER_BACKEND}"
|
|
134
|
+
LAST_LAUNCHED_PROVIDER_MODEL="${ACTIVE_PROVIDER_MODEL}"
|
|
135
|
+
LAST_LAUNCHED_PROVIDER_KEY="${ACTIVE_PROVIDER_KEY}"
|
|
136
|
+
|
|
137
|
+
if [[ -z "${LAST_RECORDED_PROVIDER_KEY}" ]]; then
|
|
138
|
+
controller_set_recorded_provider_from_active
|
|
139
|
+
fi
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
controller_track_provider_selection() {
|
|
143
|
+
local reason="${1:-provider-selection}"
|
|
144
|
+
local now_at=""
|
|
145
|
+
|
|
146
|
+
[[ -n "${ACTIVE_PROVIDER_KEY}" ]] || return 0
|
|
147
|
+
|
|
148
|
+
if [[ -z "${LAST_RECORDED_PROVIDER_KEY}" ]]; then
|
|
149
|
+
controller_set_recorded_provider_from_active
|
|
150
|
+
return 0
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
if [[ "${ACTIVE_PROVIDER_KEY}" == "${LAST_RECORDED_PROVIDER_KEY}" ]]; then
|
|
154
|
+
return 0
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
now_at="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
|
158
|
+
PROVIDER_SWITCH_COUNT=$((PROVIDER_SWITCH_COUNT + 1))
|
|
159
|
+
LAST_PROVIDER_SWITCH_AT="${now_at}"
|
|
160
|
+
LAST_PROVIDER_SWITCH_REASON="${reason}"
|
|
161
|
+
LAST_PROVIDER_FROM_POOL_NAME="${LAST_RECORDED_PROVIDER_POOL_NAME}"
|
|
162
|
+
LAST_PROVIDER_FROM_BACKEND="${LAST_RECORDED_PROVIDER_BACKEND}"
|
|
163
|
+
LAST_PROVIDER_FROM_MODEL="${LAST_RECORDED_PROVIDER_MODEL}"
|
|
164
|
+
LAST_PROVIDER_FROM_KEY="${LAST_RECORDED_PROVIDER_KEY}"
|
|
165
|
+
LAST_PROVIDER_TO_POOL_NAME="${ACTIVE_PROVIDER_POOL_NAME}"
|
|
166
|
+
LAST_PROVIDER_TO_BACKEND="${ACTIVE_PROVIDER_BACKEND}"
|
|
167
|
+
LAST_PROVIDER_TO_MODEL="${ACTIVE_PROVIDER_MODEL}"
|
|
168
|
+
LAST_PROVIDER_TO_KEY="${ACTIVE_PROVIDER_KEY}"
|
|
169
|
+
|
|
170
|
+
if [[ "${reason}" == "provider-failover" ]]; then
|
|
171
|
+
PROVIDER_FAILOVER_COUNT=$((PROVIDER_FAILOVER_COUNT + 1))
|
|
172
|
+
LAST_PROVIDER_FAILOVER_AT="${now_at}"
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
controller_set_recorded_provider_from_active
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
controller_adopt_issue() {
|
|
179
|
+
local next_issue_id="${1:?issue id required}"
|
|
180
|
+
local previous_issue_id="${ISSUE_ID:-}"
|
|
181
|
+
local previous_controller_file="${CONTROLLER_FILE:-}"
|
|
182
|
+
|
|
183
|
+
if [[ -n "${previous_issue_id}" && "${previous_issue_id}" != "${next_issue_id}" ]]; then
|
|
184
|
+
controller_unregister_pending_issue "${previous_issue_id}"
|
|
185
|
+
if [[ -n "${previous_controller_file}" && -f "${previous_controller_file}" ]]; then
|
|
186
|
+
rm -f "${previous_controller_file}"
|
|
187
|
+
fi
|
|
188
|
+
fi
|
|
189
|
+
|
|
190
|
+
ISSUE_ID="${next_issue_id}"
|
|
191
|
+
SESSION="${ISSUE_SESSION_PREFIX}${ISSUE_ID}"
|
|
192
|
+
CONTROLLER_FILE="$(flow_resident_issue_controller_file "${CONFIG_YAML}" "${ISSUE_ID}")"
|
|
193
|
+
RESIDENT_META_FILE="$(flow_resident_issue_meta_file "${CONFIG_YAML}" "${ISSUE_ID}")"
|
|
194
|
+
CONTROLLER_LOOP_COUNT="0"
|
|
195
|
+
NEXT_WAKE_EPOCH=""
|
|
196
|
+
NEXT_WAKE_AT=""
|
|
197
|
+
IDLE_WAIT_STARTED_EPOCH=""
|
|
198
|
+
ACTIVE_RESIDENT_WORKER_KEY=""
|
|
199
|
+
ACTIVE_RESIDENT_META_FILE=""
|
|
200
|
+
ACTIVE_RESIDENT_LANE_KIND=""
|
|
201
|
+
ACTIVE_RESIDENT_LANE_VALUE=""
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
controller_mark_issue_running() {
|
|
205
|
+
local is_heavy="no"
|
|
206
|
+
|
|
207
|
+
if declare -F heartbeat_issue_is_heavy >/dev/null 2>&1; then
|
|
208
|
+
is_heavy="$(heartbeat_issue_is_heavy "${ISSUE_ID}" 2>/dev/null || printf 'no\n')"
|
|
209
|
+
fi
|
|
210
|
+
|
|
211
|
+
if declare -F heartbeat_mark_issue_running >/dev/null 2>&1; then
|
|
212
|
+
heartbeat_mark_issue_running "${ISSUE_ID}" "${is_heavy}" >/dev/null 2>&1 || true
|
|
213
|
+
fi
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
controller_rollback_issue_launch() {
|
|
217
|
+
if declare -F heartbeat_issue_launch_failed >/dev/null 2>&1; then
|
|
218
|
+
heartbeat_issue_launch_failed "${ISSUE_ID}" >/dev/null 2>&1 || true
|
|
219
|
+
fi
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
controller_adopt_next_recurring_issue() {
|
|
223
|
+
local next_issue_id=""
|
|
224
|
+
local claim_out=""
|
|
225
|
+
local claim_file=""
|
|
226
|
+
|
|
227
|
+
claim_out="$(flow_resident_issue_claim_next "${CONFIG_YAML}" "${SESSION}" "${ISSUE_ID}" || true)"
|
|
228
|
+
next_issue_id="$(awk -F= '/^ISSUE_ID=/{print $2}' <<<"${claim_out}")"
|
|
229
|
+
claim_file="$(awk -F= '/^CLAIM_FILE=/{print $2}' <<<"${claim_out}")"
|
|
230
|
+
if [[ -z "${next_issue_id}" ]]; then
|
|
231
|
+
next_issue_id="$(select_next_recurring_issue_id || true)"
|
|
232
|
+
fi
|
|
233
|
+
[[ -n "${next_issue_id}" ]] || return 1
|
|
234
|
+
|
|
235
|
+
controller_adopt_issue "${next_issue_id}"
|
|
236
|
+
flow_resident_issue_release_claim "${claim_file}"
|
|
237
|
+
CONTROLLER_REASON="adopted-next-recurring-issue"
|
|
238
|
+
controller_write_state "adopting-issue" ""
|
|
239
|
+
return 0
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
controller_wait_for_leased_issue() {
|
|
243
|
+
local idle_timeout="${IDLE_TIMEOUT_SECONDS:-0}"
|
|
244
|
+
local now_epoch=""
|
|
245
|
+
|
|
246
|
+
case "${idle_timeout}" in
|
|
247
|
+
''|*[!0-9]*) idle_timeout="0" ;;
|
|
248
|
+
esac
|
|
249
|
+
|
|
250
|
+
if [[ "${idle_timeout}" -le 0 ]]; then
|
|
251
|
+
return 1
|
|
252
|
+
fi
|
|
253
|
+
|
|
254
|
+
if [[ -z "${IDLE_WAIT_STARTED_EPOCH}" ]]; then
|
|
255
|
+
IDLE_WAIT_STARTED_EPOCH="$(date +%s)"
|
|
256
|
+
fi
|
|
257
|
+
|
|
258
|
+
while true; do
|
|
259
|
+
if controller_adopt_next_recurring_issue; then
|
|
260
|
+
return 0
|
|
261
|
+
fi
|
|
262
|
+
|
|
263
|
+
now_epoch="$(date +%s)"
|
|
264
|
+
if (( now_epoch - IDLE_WAIT_STARTED_EPOCH >= idle_timeout )); then
|
|
265
|
+
CONTROLLER_REASON="idle-timeout"
|
|
266
|
+
return 1
|
|
267
|
+
fi
|
|
268
|
+
|
|
269
|
+
controller_write_state "idle" ""
|
|
270
|
+
sleep "${POLL_SECONDS}"
|
|
271
|
+
done
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
controller_write_state() {
|
|
275
|
+
local state="${1:?state required}"
|
|
276
|
+
local reason="${2:-${CONTROLLER_REASON}}"
|
|
277
|
+
|
|
278
|
+
CONTROLLER_STATE="${state}"
|
|
279
|
+
CONTROLLER_REASON="${reason}"
|
|
280
|
+
flow_resident_write_metadata "${CONTROLLER_FILE}" \
|
|
281
|
+
"ISSUE_ID=${ISSUE_ID}" \
|
|
282
|
+
"SESSION=${SESSION}" \
|
|
283
|
+
"CONTROLLER_PID=$$" \
|
|
284
|
+
"CONTROLLER_MODE=${MODE}" \
|
|
285
|
+
"CONTROLLER_LOOP_COUNT=${CONTROLLER_LOOP_COUNT}" \
|
|
286
|
+
"CONTROLLER_STATE=${CONTROLLER_STATE}" \
|
|
287
|
+
"CONTROLLER_REASON=${CONTROLLER_REASON}" \
|
|
288
|
+
"ACTIVE_RESIDENT_WORKER_KEY=${ACTIVE_RESIDENT_WORKER_KEY}" \
|
|
289
|
+
"ACTIVE_RESIDENT_LANE_KIND=${ACTIVE_RESIDENT_LANE_KIND}" \
|
|
290
|
+
"ACTIVE_RESIDENT_LANE_VALUE=${ACTIVE_RESIDENT_LANE_VALUE}" \
|
|
291
|
+
"ACTIVE_PROVIDER_POOL_NAME=${ACTIVE_PROVIDER_POOL_NAME}" \
|
|
292
|
+
"ACTIVE_PROVIDER_BACKEND=${ACTIVE_PROVIDER_BACKEND}" \
|
|
293
|
+
"ACTIVE_PROVIDER_MODEL=${ACTIVE_PROVIDER_MODEL}" \
|
|
294
|
+
"ACTIVE_PROVIDER_KEY=${ACTIVE_PROVIDER_KEY}" \
|
|
295
|
+
"ACTIVE_PROVIDER_SELECTION_REASON=${ACTIVE_PROVIDER_SELECTION_REASON}" \
|
|
296
|
+
"ACTIVE_PROVIDER_NEXT_ATTEMPT_EPOCH=${ACTIVE_PROVIDER_NEXT_ATTEMPT_EPOCH}" \
|
|
297
|
+
"ACTIVE_PROVIDER_NEXT_ATTEMPT_AT=${ACTIVE_PROVIDER_NEXT_ATTEMPT_AT}" \
|
|
298
|
+
"ACTIVE_PROVIDER_LAST_REASON=${ACTIVE_PROVIDER_LAST_REASON}" \
|
|
299
|
+
"LAST_LAUNCHED_PROVIDER_POOL_NAME=${LAST_LAUNCHED_PROVIDER_POOL_NAME}" \
|
|
300
|
+
"LAST_LAUNCHED_PROVIDER_BACKEND=${LAST_LAUNCHED_PROVIDER_BACKEND}" \
|
|
301
|
+
"LAST_LAUNCHED_PROVIDER_MODEL=${LAST_LAUNCHED_PROVIDER_MODEL}" \
|
|
302
|
+
"LAST_LAUNCHED_PROVIDER_KEY=${LAST_LAUNCHED_PROVIDER_KEY}" \
|
|
303
|
+
"PROVIDER_SWITCH_COUNT=${PROVIDER_SWITCH_COUNT}" \
|
|
304
|
+
"PROVIDER_FAILOVER_COUNT=${PROVIDER_FAILOVER_COUNT}" \
|
|
305
|
+
"LAST_PROVIDER_SWITCH_AT=${LAST_PROVIDER_SWITCH_AT}" \
|
|
306
|
+
"LAST_PROVIDER_SWITCH_REASON=${LAST_PROVIDER_SWITCH_REASON}" \
|
|
307
|
+
"LAST_PROVIDER_FROM_POOL_NAME=${LAST_PROVIDER_FROM_POOL_NAME}" \
|
|
308
|
+
"LAST_PROVIDER_FROM_BACKEND=${LAST_PROVIDER_FROM_BACKEND}" \
|
|
309
|
+
"LAST_PROVIDER_FROM_MODEL=${LAST_PROVIDER_FROM_MODEL}" \
|
|
310
|
+
"LAST_PROVIDER_FROM_KEY=${LAST_PROVIDER_FROM_KEY}" \
|
|
311
|
+
"LAST_PROVIDER_TO_POOL_NAME=${LAST_PROVIDER_TO_POOL_NAME}" \
|
|
312
|
+
"LAST_PROVIDER_TO_BACKEND=${LAST_PROVIDER_TO_BACKEND}" \
|
|
313
|
+
"LAST_PROVIDER_TO_MODEL=${LAST_PROVIDER_TO_MODEL}" \
|
|
314
|
+
"LAST_PROVIDER_TO_KEY=${LAST_PROVIDER_TO_KEY}" \
|
|
315
|
+
"LAST_PROVIDER_FAILOVER_AT=${LAST_PROVIDER_FAILOVER_AT}" \
|
|
316
|
+
"PROVIDER_WAIT_COUNT=${PROVIDER_WAIT_COUNT}" \
|
|
317
|
+
"PROVIDER_WAIT_TOTAL_SECONDS=${PROVIDER_WAIT_TOTAL_SECONDS}" \
|
|
318
|
+
"PROVIDER_LAST_WAIT_SECONDS=${PROVIDER_LAST_WAIT_SECONDS}" \
|
|
319
|
+
"PROVIDER_LAST_WAIT_STARTED_AT=${PROVIDER_LAST_WAIT_STARTED_AT}" \
|
|
320
|
+
"PROVIDER_LAST_WAIT_COMPLETED_AT=${PROVIDER_LAST_WAIT_COMPLETED_AT}" \
|
|
321
|
+
"NEXT_WAKE_EPOCH=${NEXT_WAKE_EPOCH}" \
|
|
322
|
+
"NEXT_WAKE_AT=${NEXT_WAKE_AT}" \
|
|
323
|
+
"UPDATED_AT=$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
|
|
324
|
+
|
|
325
|
+
if [[ "${CONTROLLER_STATE}" == "stopped" ]]; then
|
|
326
|
+
controller_unregister_pending_issue "${ISSUE_ID}"
|
|
327
|
+
elif flow_resident_issue_controller_counts_as_pending "${CONTROLLER_STATE}"; then
|
|
328
|
+
controller_register_pending_issue
|
|
329
|
+
else
|
|
330
|
+
controller_unregister_pending_issue "${ISSUE_ID}"
|
|
331
|
+
fi
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
controller_last_failure_reason() {
|
|
335
|
+
local metadata_file="${ACTIVE_RESIDENT_META_FILE:-${RESIDENT_META_FILE:-}}"
|
|
336
|
+
[[ -n "${metadata_file}" && -f "${metadata_file}" ]] || return 1
|
|
337
|
+
awk -F= '/^LAST_FAILURE_REASON=/{print $2; exit}' "${metadata_file}" 2>/dev/null | tr -d '"' || true
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
controller_provider_state() {
|
|
341
|
+
local provider_state_script="${FLOW_TOOLS_DIR}/provider-cooldown-state.sh"
|
|
342
|
+
local provider_state=""
|
|
343
|
+
|
|
344
|
+
if [[ ! -x "${provider_state_script}" ]]; then
|
|
345
|
+
printf 'READY=yes\n'
|
|
346
|
+
return 0
|
|
347
|
+
fi
|
|
348
|
+
|
|
349
|
+
provider_state="$(
|
|
350
|
+
env \
|
|
351
|
+
-u ACP_CODING_WORKER \
|
|
352
|
+
-u ACP_CODEX_PROFILE_SAFE -u F_LOSNING_CODEX_PROFILE_SAFE \
|
|
353
|
+
-u ACP_CODEX_PROFILE_BYPASS -u F_LOSNING_CODEX_PROFILE_BYPASS \
|
|
354
|
+
-u ACP_CLAUDE_MODEL -u F_LOSNING_CLAUDE_MODEL \
|
|
355
|
+
-u ACP_CLAUDE_PERMISSION_MODE -u F_LOSNING_CLAUDE_PERMISSION_MODE \
|
|
356
|
+
-u ACP_CLAUDE_EFFORT -u F_LOSNING_CLAUDE_EFFORT \
|
|
357
|
+
-u ACP_CLAUDE_TIMEOUT_SECONDS -u F_LOSNING_CLAUDE_TIMEOUT_SECONDS \
|
|
358
|
+
-u ACP_CLAUDE_MAX_ATTEMPTS -u F_LOSNING_CLAUDE_MAX_ATTEMPTS \
|
|
359
|
+
-u ACP_CLAUDE_RETRY_BACKOFF_SECONDS -u F_LOSNING_CLAUDE_RETRY_BACKOFF_SECONDS \
|
|
360
|
+
-u ACP_OPENCLAW_MODEL -u F_LOSNING_OPENCLAW_MODEL \
|
|
361
|
+
-u ACP_OPENCLAW_THINKING -u F_LOSNING_OPENCLAW_THINKING \
|
|
362
|
+
-u ACP_OPENCLAW_TIMEOUT_SECONDS -u F_LOSNING_OPENCLAW_TIMEOUT_SECONDS \
|
|
363
|
+
-u ACP_ACTIVE_PROVIDER_POOL_NAME -u F_LOSNING_ACTIVE_PROVIDER_POOL_NAME \
|
|
364
|
+
-u ACP_ACTIVE_PROVIDER_BACKEND -u F_LOSNING_ACTIVE_PROVIDER_BACKEND \
|
|
365
|
+
-u ACP_ACTIVE_PROVIDER_MODEL -u F_LOSNING_ACTIVE_PROVIDER_MODEL \
|
|
366
|
+
-u ACP_ACTIVE_PROVIDER_KEY -u F_LOSNING_ACTIVE_PROVIDER_KEY \
|
|
367
|
+
-u ACP_PROVIDER_POOLS_EXHAUSTED -u F_LOSNING_PROVIDER_POOLS_EXHAUSTED \
|
|
368
|
+
-u ACP_PROVIDER_POOL_SELECTION_REASON -u F_LOSNING_PROVIDER_POOL_SELECTION_REASON \
|
|
369
|
+
-u ACP_PROVIDER_POOL_NEXT_ATTEMPT_EPOCH -u F_LOSNING_PROVIDER_POOL_NEXT_ATTEMPT_EPOCH \
|
|
370
|
+
-u ACP_PROVIDER_POOL_NEXT_ATTEMPT_AT -u F_LOSNING_PROVIDER_POOL_NEXT_ATTEMPT_AT \
|
|
371
|
+
-u ACP_PROVIDER_POOL_LAST_REASON -u F_LOSNING_PROVIDER_POOL_LAST_REASON \
|
|
372
|
+
"${provider_state_script}" get 2>/dev/null || true
|
|
373
|
+
)"
|
|
374
|
+
if [[ -z "${provider_state}" ]]; then
|
|
375
|
+
printf 'READY=yes\n'
|
|
376
|
+
return 0
|
|
377
|
+
fi
|
|
378
|
+
|
|
379
|
+
printf '%s\n' "${provider_state}"
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
controller_wait_for_provider_capacity() {
|
|
383
|
+
local provider_state=""
|
|
384
|
+
local provider_ready=""
|
|
385
|
+
local provider_next_epoch=""
|
|
386
|
+
local provider_next_at=""
|
|
387
|
+
local now_epoch=""
|
|
388
|
+
local remaining=""
|
|
389
|
+
local sleep_seconds=""
|
|
390
|
+
local wait_started_epoch=""
|
|
391
|
+
local wait_completed_epoch=""
|
|
392
|
+
|
|
393
|
+
PROVIDER_WAITED="no"
|
|
394
|
+
|
|
395
|
+
while true; do
|
|
396
|
+
provider_state="$(controller_provider_state)"
|
|
397
|
+
provider_ready="$(flow_kv_get "${provider_state}" "READY")"
|
|
398
|
+
if [[ "${provider_ready}" == "yes" ]]; then
|
|
399
|
+
if [[ -n "${wait_started_epoch}" ]]; then
|
|
400
|
+
wait_completed_epoch="$(date +%s)"
|
|
401
|
+
if (( wait_completed_epoch >= wait_started_epoch )); then
|
|
402
|
+
PROVIDER_LAST_WAIT_SECONDS=$((wait_completed_epoch - wait_started_epoch))
|
|
403
|
+
PROVIDER_WAIT_TOTAL_SECONDS=$((PROVIDER_WAIT_TOTAL_SECONDS + PROVIDER_LAST_WAIT_SECONDS))
|
|
404
|
+
PROVIDER_LAST_WAIT_COMPLETED_AT="$(date -u -r "${wait_completed_epoch}" +"%Y-%m-%dT%H:%M:%SZ")"
|
|
405
|
+
fi
|
|
406
|
+
fi
|
|
407
|
+
NEXT_WAKE_EPOCH=""
|
|
408
|
+
NEXT_WAKE_AT=""
|
|
409
|
+
return 0
|
|
410
|
+
fi
|
|
411
|
+
|
|
412
|
+
provider_next_epoch="$(flow_kv_get "${provider_state}" "NEXT_ATTEMPT_EPOCH")"
|
|
413
|
+
provider_next_at="$(flow_kv_get "${provider_state}" "NEXT_ATTEMPT_AT")"
|
|
414
|
+
if ! [[ "${provider_next_epoch}" =~ ^[0-9]+$ ]] || [[ "${provider_next_epoch}" == "0" ]]; then
|
|
415
|
+
return 1
|
|
416
|
+
fi
|
|
417
|
+
|
|
418
|
+
if [[ -z "${wait_started_epoch}" ]]; then
|
|
419
|
+
wait_started_epoch="$(date +%s)"
|
|
420
|
+
PROVIDER_WAIT_COUNT=$((PROVIDER_WAIT_COUNT + 1))
|
|
421
|
+
PROVIDER_LAST_WAIT_STARTED_AT="$(date -u -r "${wait_started_epoch}" +"%Y-%m-%dT%H:%M:%SZ")"
|
|
422
|
+
fi
|
|
423
|
+
|
|
424
|
+
PROVIDER_WAITED="yes"
|
|
425
|
+
NEXT_WAKE_EPOCH="${provider_next_epoch}"
|
|
426
|
+
NEXT_WAKE_AT="${provider_next_at}"
|
|
427
|
+
CONTROLLER_REASON="provider-cooldown"
|
|
428
|
+
controller_write_state "waiting-provider" ""
|
|
429
|
+
|
|
430
|
+
now_epoch="$(date +%s)"
|
|
431
|
+
remaining=$((provider_next_epoch - now_epoch))
|
|
432
|
+
sleep_seconds="${POLL_SECONDS}"
|
|
433
|
+
if ! [[ "${sleep_seconds}" =~ ^[1-9][0-9]*$ ]]; then
|
|
434
|
+
sleep_seconds="60"
|
|
435
|
+
fi
|
|
436
|
+
if (( remaining > 0 && remaining < sleep_seconds )); then
|
|
437
|
+
sleep_seconds="${remaining}"
|
|
438
|
+
fi
|
|
439
|
+
if (( sleep_seconds <= 0 )); then
|
|
440
|
+
sleep_seconds="1"
|
|
441
|
+
fi
|
|
442
|
+
sleep "${sleep_seconds}"
|
|
443
|
+
done
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
controller_cleanup() {
|
|
447
|
+
controller_write_state "stopped" "${CONTROLLER_REASON:-stopped}"
|
|
448
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
ROOT_DIR = Path(__file__).resolve().parents[1]
|
|
12
|
+
DASHBOARD_DIR = ROOT_DIR / "dashboard"
|
|
13
|
+
if str(DASHBOARD_DIR) not in sys.path:
|
|
14
|
+
sys.path.insert(0, str(DASHBOARD_DIR))
|
|
15
|
+
|
|
16
|
+
from issue_queue_state import collect_issue_queue
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> int:
|
|
20
|
+
parser = argparse.ArgumentParser(description="Render resident issue queue state as JSON.")
|
|
21
|
+
parser.add_argument("--state-root", default=os.environ.get("ACP_STATE_ROOT", "").strip(), help="ACP runtime state root")
|
|
22
|
+
parser.add_argument("--pretty", action="store_true", help="Pretty-print JSON output")
|
|
23
|
+
args = parser.parse_args()
|
|
24
|
+
|
|
25
|
+
if not args.state_root:
|
|
26
|
+
parser.error("--state-root is required")
|
|
27
|
+
|
|
28
|
+
payload = collect_issue_queue(Path(args.state_root).expanduser())
|
|
29
|
+
json.dump(payload, sys.stdout, indent=2 if args.pretty else None, sort_keys=True)
|
|
30
|
+
sys.stdout.write("\n")
|
|
31
|
+
return 0
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if __name__ == "__main__":
|
|
35
|
+
raise SystemExit(main())
|
|
@@ -35,7 +35,7 @@ RECONCILE_COMMAND=""
|
|
|
35
35
|
ADAPTER_ID="$(flow_resolve_adapter_id "${CONFIG_YAML}")"
|
|
36
36
|
ISSUE_SESSION_PREFIX="$(flow_resolve_issue_session_prefix "${CONFIG_YAML}")"
|
|
37
37
|
PR_SESSION_PREFIX="$(flow_resolve_pr_session_prefix "${CONFIG_YAML}")"
|
|
38
|
-
CODING_WORKER="${ACP_CODING_WORKER
|
|
38
|
+
CODING_WORKER="${ACP_CODING_WORKER:-codex}"
|
|
39
39
|
CODEX_PROFILE_SAFE="${ACP_CODEX_PROFILE_SAFE:-${F_LOSNING_CODEX_PROFILE_SAFE:-${CODEX_PROFILE_SAFE:-f_losning_safe_auto}}}"
|
|
40
40
|
CODEX_PROFILE_BYPASS="${ACP_CODEX_PROFILE_BYPASS:-${F_LOSNING_CODEX_PROFILE_BYPASS:-${CODEX_PROFILE_BYPASS:-f_losning_yolo}}}"
|
|
41
41
|
if [[ "$MODE" == "bypass" ]]; then
|
|
@@ -64,23 +64,47 @@ RESIDENT_OPENCLAW_CONFIG_PATH="${ACP_RESIDENT_OPENCLAW_CONFIG_PATH:-${F_LOSNING_
|
|
|
64
64
|
OPENCLAW_MODEL="${OPENCLAW_MODEL:-${ACP_OPENCLAW_MODEL:-${F_LOSNING_OPENCLAW_MODEL:-openrouter/qwen/qwen3.6-plus-preview:free}}}"
|
|
65
65
|
OPENCLAW_THINKING="${OPENCLAW_THINKING:-${ACP_OPENCLAW_THINKING:-${F_LOSNING_OPENCLAW_THINKING:-low}}}"
|
|
66
66
|
OPENCLAW_TIMEOUT_SECONDS="${OPENCLAW_TIMEOUT_SECONDS:-${ACP_OPENCLAW_TIMEOUT_SECONDS:-${F_LOSNING_OPENCLAW_TIMEOUT_SECONDS:-900}}}"
|
|
67
|
+
OLLAMA_MODEL="${ACP_OLLAMA_MODEL:-${F_LOSNING_OLLAMA_MODEL:-qwen2.5-coder:7b}}"
|
|
68
|
+
OLLAMA_BASE_URL="${ACP_OLLAMA_BASE_URL:-${F_LOSNING_OLLAMA_BASE_URL:-http://localhost:11434}}"
|
|
69
|
+
OLLAMA_TIMEOUT_SECONDS="${ACP_OLLAMA_TIMEOUT_SECONDS:-${F_LOSNING_OLLAMA_TIMEOUT_SECONDS:-900}}"
|
|
70
|
+
PI_MODEL="${ACP_PI_MODEL:-${F_LOSNING_PI_MODEL:-openrouter/qwen/qwen3.6-plus:free}}"
|
|
71
|
+
PI_THINKING="${ACP_PI_THINKING:-${F_LOSNING_PI_THINKING:-low}}"
|
|
72
|
+
PI_TIMEOUT_SECONDS="${ACP_PI_TIMEOUT_SECONDS:-${F_LOSNING_PI_TIMEOUT_SECONDS:-900}}"
|
|
73
|
+
PI_STALL_SECONDS="${ACP_PI_STALL_SECONDS:-${F_LOSNING_PI_STALL_SECONDS:-300}}"
|
|
74
|
+
OPENCODE_MODEL="${ACP_OPENCODE_MODEL:-${F_LOSNING_OPENCODE_MODEL:-anthropic/claude-sonnet-4-20250514}}"
|
|
75
|
+
OPENCODE_TIMEOUT_SECONDS="${ACP_OPENCODE_TIMEOUT_SECONDS:-${F_LOSNING_OPENCODE_TIMEOUT_SECONDS:-900}}"
|
|
76
|
+
KILO_MODEL="${ACP_KILO_MODEL:-${F_LOSNING_KILO_MODEL:-anthropic/claude-sonnet-4-20250514}}"
|
|
77
|
+
KILO_TIMEOUT_SECONDS="${ACP_KILO_TIMEOUT_SECONDS:-${F_LOSNING_KILO_TIMEOUT_SECONDS:-900}}"
|
|
67
78
|
printf -v SESSION_Q '%q' "$SESSION"
|
|
68
79
|
printf -v CONFIG_YAML_Q '%q' "$CONFIG_YAML"
|
|
69
80
|
printf -v ADAPTER_ID_Q '%q' "$ADAPTER_ID"
|
|
70
|
-
|
|
81
|
+
printf -v CANONICAL_REPO_ROOT_Q '%q' "$CANONICAL_REPO_ROOT"
|
|
82
|
+
RECONCILE_ENV_PREFIX="ACP_PROJECT_ID=${ADAPTER_ID_Q} AGENT_PROJECT_ID=${ADAPTER_ID_Q} AGENT_CONTROL_PLANE_CONFIG=${CONFIG_YAML_Q} ACP_CONFIG=${CONFIG_YAML_Q} ACP_ROOT=${CANONICAL_REPO_ROOT_Q} AGENT_CONTROL_PLANE_ROOT=${CANONICAL_REPO_ROOT_Q}"
|
|
83
|
+
|
|
84
|
+
# The materialized skills surface is cleaned up after each heartbeat cycle.
|
|
85
|
+
# Reconcile runs post-tmux via nohup, after the skills dir is gone.
|
|
86
|
+
# Use the permanent runtime-home/tools/bin path derived from AGENT_PLATFORM_HOME.
|
|
87
|
+
_runtime_tools_bin="${AGENT_PLATFORM_HOME:-${HOME}/.agent-runtime}/runtime-home/tools/bin"
|
|
88
|
+
if [[ -f "${_runtime_tools_bin}/reconcile-pr-worker.sh" ]]; then
|
|
89
|
+
RECONCILE_ISSUE_BIN="${_runtime_tools_bin}/reconcile-issue-worker.sh"
|
|
90
|
+
RECONCILE_PR_BIN="${_runtime_tools_bin}/reconcile-pr-worker.sh"
|
|
91
|
+
else
|
|
92
|
+
RECONCILE_ISSUE_BIN="${WORKSPACE_DIR}/bin/reconcile-issue-worker.sh"
|
|
93
|
+
RECONCILE_PR_BIN="${WORKSPACE_DIR}/bin/reconcile-pr-worker.sh"
|
|
94
|
+
fi
|
|
71
95
|
|
|
72
96
|
case "$SESSION" in
|
|
73
97
|
"${ISSUE_SESSION_PREFIX}"*)
|
|
74
98
|
TASK_KIND="issue"
|
|
75
99
|
TASK_ID="${ISSUE_ID:-${SESSION#${ISSUE_SESSION_PREFIX}}}"
|
|
76
100
|
if [[ "${RESIDENT_WORKER_ENABLED}" != "yes" ]]; then
|
|
77
|
-
RECONCILE_COMMAND="${RECONCILE_ENV_PREFIX} ${
|
|
101
|
+
RECONCILE_COMMAND="${RECONCILE_ENV_PREFIX} ${RECONCILE_ISSUE_BIN} ${SESSION_Q}"
|
|
78
102
|
fi
|
|
79
103
|
;;
|
|
80
104
|
"${PR_SESSION_PREFIX}"*)
|
|
81
105
|
TASK_KIND="pr"
|
|
82
106
|
TASK_ID="${PR_NUMBER:-${SESSION#${PR_SESSION_PREFIX}}}"
|
|
83
|
-
RECONCILE_COMMAND="${RECONCILE_ENV_PREFIX} ${
|
|
107
|
+
RECONCILE_COMMAND="${RECONCILE_ENV_PREFIX} ${RECONCILE_PR_BIN} ${SESSION_Q}"
|
|
84
108
|
;;
|
|
85
109
|
esac
|
|
86
110
|
|
|
@@ -219,11 +243,36 @@ case "$CODING_WORKER" in
|
|
|
219
243
|
bash "${FLOW_TOOLS_DIR}/agent-project-run-openclaw-session" "${ARGS[@]}"
|
|
220
244
|
;;
|
|
221
245
|
opencode)
|
|
246
|
+
ARGS+=(
|
|
247
|
+
--opencode-model "${OPENCODE_MODEL}"
|
|
248
|
+
--opencode-timeout-seconds "${OPENCODE_TIMEOUT_SECONDS}"
|
|
249
|
+
)
|
|
222
250
|
bash "${FLOW_TOOLS_DIR}/agent-project-run-opencode-session" "${ARGS[@]}"
|
|
223
251
|
;;
|
|
224
252
|
kilo)
|
|
253
|
+
ARGS+=(
|
|
254
|
+
--kilo-model "${KILO_MODEL}"
|
|
255
|
+
--kilo-timeout-seconds "${KILO_TIMEOUT_SECONDS}"
|
|
256
|
+
)
|
|
225
257
|
bash "${FLOW_TOOLS_DIR}/agent-project-run-kilo-session" "${ARGS[@]}"
|
|
226
258
|
;;
|
|
259
|
+
ollama)
|
|
260
|
+
ARGS+=(
|
|
261
|
+
--ollama-model "${OLLAMA_MODEL}"
|
|
262
|
+
--ollama-base-url "${OLLAMA_BASE_URL}"
|
|
263
|
+
--ollama-timeout-seconds "${OLLAMA_TIMEOUT_SECONDS}"
|
|
264
|
+
)
|
|
265
|
+
bash "${FLOW_TOOLS_DIR}/agent-project-run-ollama-session" "${ARGS[@]}"
|
|
266
|
+
;;
|
|
267
|
+
pi)
|
|
268
|
+
ARGS+=(
|
|
269
|
+
--pi-model "${PI_MODEL}"
|
|
270
|
+
--pi-thinking "${PI_THINKING}"
|
|
271
|
+
--pi-timeout-seconds "${PI_TIMEOUT_SECONDS}"
|
|
272
|
+
--pi-stall-seconds "${PI_STALL_SECONDS}"
|
|
273
|
+
)
|
|
274
|
+
bash "${FLOW_TOOLS_DIR}/agent-project-run-pi-session" "${ARGS[@]}"
|
|
275
|
+
;;
|
|
227
276
|
*)
|
|
228
277
|
echo "unsupported coding worker: ${CODING_WORKER}" >&2
|
|
229
278
|
exit 1
|
|
@@ -22,7 +22,7 @@ Options:
|
|
|
22
22
|
--worktree-root <path> Worktree parent root
|
|
23
23
|
--retained-repo-root <path> Optional retained/manual checkout root
|
|
24
24
|
--vscode-workspace-file <path> Optional VS Code workspace file
|
|
25
|
-
--coding-worker <codex|openclaw|claude>
|
|
25
|
+
--coding-worker <codex|openclaw|claude|ollama|pi|opencode|kilo>
|
|
26
26
|
Default coding backend (default: openclaw)
|
|
27
27
|
--claude-model <model> Claude model alias or full name
|
|
28
28
|
--claude-permission-mode <mode> Claude permission mode (default: acceptEdits)
|
|
@@ -97,9 +97,9 @@ if [[ ! "$profile_id" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
|
|
|
97
97
|
fi
|
|
98
98
|
|
|
99
99
|
case "$coding_worker" in
|
|
100
|
-
codex|openclaw|claude) ;;
|
|
100
|
+
codex|openclaw|claude|ollama|pi|opencode|kilo) ;;
|
|
101
101
|
*)
|
|
102
|
-
echo "--coding-worker must be codex, openclaw, or
|
|
102
|
+
echo "--coding-worker must be codex, openclaw, claude, ollama, pi, opencode, or kilo" >&2
|
|
103
103
|
exit 1
|
|
104
104
|
;;
|
|
105
105
|
esac
|
|
@@ -271,6 +271,21 @@ execution:
|
|
|
271
271
|
model: "${openclaw_model}"
|
|
272
272
|
thinking: "${openclaw_thinking}"
|
|
273
273
|
timeout_seconds: ${openclaw_timeout_seconds}
|
|
274
|
+
ollama:
|
|
275
|
+
model: "qwen2.5-coder:7b"
|
|
276
|
+
base_url: "http://localhost:11434"
|
|
277
|
+
timeout_seconds: 900
|
|
278
|
+
pi:
|
|
279
|
+
model: "openrouter/qwen/qwen3.6-plus:free"
|
|
280
|
+
thinking: "low"
|
|
281
|
+
timeout_seconds: 900
|
|
282
|
+
stall_seconds: 300
|
|
283
|
+
opencode:
|
|
284
|
+
model: "anthropic/claude-sonnet-4-20250514"
|
|
285
|
+
timeout_seconds: 900
|
|
286
|
+
kilo:
|
|
287
|
+
model: "anthropic/claude-sonnet-4-20250514"
|
|
288
|
+
timeout_seconds: 900
|
|
274
289
|
review_requires_independent_final_review: true
|
|
275
290
|
verification:
|
|
276
291
|
web_playwright_command: "pnpm exec playwright test"
|
|
@@ -30,7 +30,7 @@ LOCAL_INSTALL_POLICY_BIN="${WORKSPACE_DIR}/bin/issue-requires-local-workspace-in
|
|
|
30
30
|
SESSION="${ISSUE_SESSION_PREFIX}${ISSUE_ID}"
|
|
31
31
|
RUN_DIR="${RUNS_ROOT}/${SESSION}"
|
|
32
32
|
UPDATE_LABELS_BIN="${WORKSPACE_DIR}/bin/agent-github-update-labels"
|
|
33
|
-
CODING_WORKER="${ACP_CODING_WORKER
|
|
33
|
+
CODING_WORKER="${ACP_CODING_WORKER:-codex}"
|
|
34
34
|
launch_success="no"
|
|
35
35
|
label_rollback_armed="no"
|
|
36
36
|
RECURRING_CHECKLIST_SYNC_BIN="${FLOW_TOOLS_DIR}/sync-recurring-issue-checklist.sh"
|