agent-control-plane 0.1.2 → 0.1.3
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 +6 -0
- package/npm/bin/agent-control-plane.js +149 -5
- package/package.json +1 -2
- package/tools/tests/test-agent-control-plane-npm-cli.sh +0 -280
- package/tools/tests/test-agent-github-update-labels-falls-back-to-repository-id.sh +0 -56
- package/tools/tests/test-agent-project-claude-session-wrapper-clears-stale-sandbox-artifacts.sh +0 -89
- package/tools/tests/test-agent-project-claude-session-wrapper-does-not-retry-provider-quota.sh +0 -82
- package/tools/tests/test-agent-project-claude-session-wrapper-retries-transient-failures.sh +0 -90
- package/tools/tests/test-agent-project-claude-session-wrapper-times-out.sh +0 -73
- package/tools/tests/test-agent-project-claude-session-wrapper.sh +0 -103
- package/tools/tests/test-agent-project-cleanup-session-orphan-fallback.sh +0 -90
- package/tools/tests/test-agent-project-cleanup-session-skip-worktree-cleanup.sh +0 -90
- package/tools/tests/test-agent-project-codex-live-thread-persist.sh +0 -76
- package/tools/tests/test-agent-project-codex-recovery.sh +0 -731
- package/tools/tests/test-agent-project-codex-session-wrapper-clears-stale-sandbox-artifacts.sh +0 -105
- package/tools/tests/test-agent-project-codex-session-wrapper.sh +0 -97
- package/tools/tests/test-agent-project-open-pr-worktree-config-prefix.sh +0 -81
- package/tools/tests/test-agent-project-openclaw-session-wrapper-clears-stale-sandbox-artifacts.sh +0 -109
- package/tools/tests/test-agent-project-openclaw-session-wrapper-infers-blocked-result-contract.sh +0 -89
- package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-literal-env-artifacts.sh +0 -113
- package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-version-mismatch.sh +0 -135
- package/tools/tests/test-agent-project-openclaw-session-wrapper-resident.sh +0 -179
- package/tools/tests/test-agent-project-openclaw-session-wrapper-reuses-existing-agent-after-add-race.sh +0 -119
- package/tools/tests/test-agent-project-openclaw-session-wrapper-terminates-rate-limit-hang.sh +0 -91
- package/tools/tests/test-agent-project-openclaw-session-wrapper.sh +0 -117
- package/tools/tests/test-agent-project-publish-issue-pr-prunes-stale-worktree-entry.sh +0 -148
- package/tools/tests/test-agent-project-publish-issue-pr-reads-archived-session.sh +0 -146
- package/tools/tests/test-agent-project-publish-issue-pr-recovers-final-head.sh +0 -145
- package/tools/tests/test-agent-project-publish-issue-pr-reuses-existing-worktree.sh +0 -147
- package/tools/tests/test-agent-project-reconcile-failure-reason.sh +0 -456
- package/tools/tests/test-agent-project-reconcile-issue-archived-session-fallback.sh +0 -96
- package/tools/tests/test-agent-project-reconcile-issue-before-blocked.sh +0 -90
- package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery-uses-recovered-worktree.sh +0 -212
- package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery.sh +0 -207
- package/tools/tests/test-agent-project-reconcile-issue-provider-quota-schedules-provider-cooldown.sh +0 -101
- package/tools/tests/test-agent-project-reconcile-issue-session-backfills-lane-metadata-from-worker-key.sh +0 -113
- package/tools/tests/test-agent-project-reconcile-issue-session-clears-stale-failed-summary.sh +0 -117
- package/tools/tests/test-agent-project-reconcile-issue-session-initializes-shared-agent-home.sh +0 -55
- package/tools/tests/test-agent-project-reconcile-issue-session-normalizes-runner-state.sh +0 -125
- package/tools/tests/test-agent-project-reconcile-issue-session-records-invalid-contract-summary.sh +0 -118
- package/tools/tests/test-agent-project-reconcile-issue-session-skips-duplicate-blocked-comment.sh +0 -144
- package/tools/tests/test-agent-project-reconcile-issue-session-standardizes-no-commits-blocker.sh +0 -145
- package/tools/tests/test-agent-project-reconcile-issue-session-synthesizes-blocked-comment.sh +0 -139
- package/tools/tests/test-agent-project-reconcile-pr-blocked-host-recovery.sh +0 -242
- package/tools/tests/test-agent-project-reconcile-pr-guard-blocked-no-commit.sh +0 -142
- package/tools/tests/test-agent-project-reconcile-pr-provider-quota-schedules-provider-cooldown.sh +0 -106
- package/tools/tests/test-agent-project-reconcile-pr-session-initializes-shared-agent-home.sh +0 -66
- package/tools/tests/test-agent-project-reconcile-pr-updated-branch-noop.sh +0 -129
- package/tools/tests/test-audit-agent-worktrees-active-launch-skips-git-inspection.sh +0 -69
- package/tools/tests/test-audit-agent-worktrees-broken-worktree.sh +0 -43
- package/tools/tests/test-audit-agent-worktrees-pending-launch-owner.sh +0 -46
- package/tools/tests/test-audit-agent-worktrees-unreconciled-owner.sh +0 -79
- package/tools/tests/test-audit-issue-routing-managed-branch-globs.sh +0 -56
- package/tools/tests/test-branch-verification-guard-generated-artifacts.sh +0 -72
- package/tools/tests/test-branch-verification-guard-targeted-coverage.sh +0 -125
- package/tools/tests/test-codex-quota-manager-failure-driven-rotation.sh +0 -178
- package/tools/tests/test-codex-quota-wrapper.sh +0 -37
- package/tools/tests/test-contribution-docs.sh +0 -18
- package/tools/tests/test-control-plane-dashboard-runtime-smoke.sh +0 -343
- package/tools/tests/test-create-follow-up-issue.sh +0 -73
- package/tools/tests/test-dashboard-launchd-bootstrap.sh +0 -55
- package/tools/tests/test-flow-export-execution-env-exports-repo-id.sh +0 -30
- package/tools/tests/test-flow-export-github-cli-auth-env-prefers-git-credential.sh +0 -48
- package/tools/tests/test-flow-github-api-repo-fallback-preserves-input.sh +0 -85
- package/tools/tests/test-flow-github-api-repo-prefers-explicit-repository-id.sh +0 -60
- package/tools/tests/test-flow-github-issue-list-falls-back-to-repository-id.sh +0 -64
- package/tools/tests/test-flow-github-pr-list-falls-back-to-repository-id.sh +0 -77
- package/tools/tests/test-flow-resident-can-reuse-does-not-leak-metadata.sh +0 -52
- package/tools/tests/test-flow-resident-reap-stale-controllers.sh +0 -63
- package/tools/tests/test-flow-resolve-codex-quota-tools.sh +0 -104
- package/tools/tests/test-flow-runtime-doctor-profile-selection.sh +0 -27
- package/tools/tests/test-heartbeat-codex-pr-linked-issue-exclusion.sh +0 -79
- package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-idle-controller.sh +0 -115
- package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-live-lane-controller.sh +0 -117
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-claude.sh +0 -96
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-codex.sh +0 -96
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop.sh +0 -96
- package/tools/tests/test-heartbeat-loop-auth-wait-does-not-consume-capacity.sh +0 -170
- package/tools/tests/test-heartbeat-loop-blocked-recovery-lane.sh +0 -201
- package/tools/tests/test-heartbeat-loop-blocked-recovery-vs-pr-reservation.sh +0 -201
- package/tools/tests/test-heartbeat-loop-idle-resident-controller-does-not-block-launches.sh +0 -160
- package/tools/tests/test-heartbeat-loop-pr-launch-dedup.sh +0 -133
- package/tools/tests/test-heartbeat-loop-provider-cooldown-suppresses-launches.sh +0 -157
- package/tools/tests/test-heartbeat-loop-reaps-stale-resident-controller.sh +0 -181
- package/tools/tests/test-heartbeat-loop-waiting-provider-resident-controller-does-not-block-launches.sh +0 -160
- package/tools/tests/test-heartbeat-ready-issues-blocked-recovery.sh +0 -134
- package/tools/tests/test-heartbeat-safe-auto-dynamic-concurrency.sh +0 -162
- package/tools/tests/test-heartbeat-safe-auto-no-tmux-sessions.sh +0 -136
- package/tools/tests/test-heartbeat-safe-auto-openclaw-skips-codex-quota.sh +0 -139
- package/tools/tests/test-heartbeat-safe-auto-quota-health-signal.sh +0 -119
- package/tools/tests/test-heartbeat-safe-auto-stale-shared-loop-pid-does-not-skip.sh +0 -140
- package/tools/tests/test-heartbeat-safe-auto-static-capacity-without-quota-cache.sh +0 -142
- package/tools/tests/test-heartbeat-safe-auto-zero-healthy-pools.sh +0 -141
- package/tools/tests/test-heartbeat-sync-issue-labels-empty-schedule.sh +0 -65
- package/tools/tests/test-heartbeat-sync-open-agent-prs-terminal-clears-running.sh +0 -179
- package/tools/tests/test-install-dashboard-launchd.sh +0 -78
- package/tools/tests/test-install-project-launchd-adds-tool-paths.sh +0 -87
- package/tools/tests/test-install-project-launchd.sh +0 -110
- package/tools/tests/test-issue-local-workspace-install-policy.sh +0 -81
- package/tools/tests/test-issue-publish-scope-guard-docs-signal.sh +0 -70
- package/tools/tests/test-issue-reconcile-hooks-success-clears-blocked.sh +0 -36
- package/tools/tests/test-kick-scheduler-requires-explicit-profile.sh +0 -47
- package/tools/tests/test-label-follow-up-issues-falls-back-to-repository-id.sh +0 -132
- package/tools/tests/test-manual-operator-entrypoints-require-explicit-profile.sh +0 -64
- package/tools/tests/test-package-funding-metadata.sh +0 -21
- package/tools/tests/test-package-public-metadata.sh +0 -62
- package/tools/tests/test-placeholder-worker-adapters.sh +0 -38
- package/tools/tests/test-pr-reconcile-hooks-refreshes-recurring-issue-checklist.sh +0 -110
- package/tools/tests/test-pr-risk-cohesive-mobile-locale-scope.sh +0 -70
- package/tools/tests/test-pr-risk-fix-label-semantics.sh +0 -114
- package/tools/tests/test-pr-risk-local-first-no-checks.sh +0 -70
- package/tools/tests/test-prepare-worktree-simple-repo-baseline.sh +0 -67
- package/tools/tests/test-profile-activate.sh +0 -33
- package/tools/tests/test-profile-adopt-allow-missing-repo.sh +0 -68
- package/tools/tests/test-profile-adopt-skip-workspace-sync-missing-file.sh +0 -61
- package/tools/tests/test-profile-adopt-syncs-anchor-and-workspace.sh +0 -90
- package/tools/tests/test-profile-smoke-collision.sh +0 -44
- package/tools/tests/test-profile-smoke-invalid-claude-config.sh +0 -31
- package/tools/tests/test-profile-smoke-invalid-provider-pool.sh +0 -68
- package/tools/tests/test-profile-smoke-repo-slug-mismatch.sh +0 -36
- package/tools/tests/test-profile-smoke.sh +0 -45
- package/tools/tests/test-project-init-force-and-skip-sync.sh +0 -61
- package/tools/tests/test-project-init-repo-slug-mismatch.sh +0 -29
- package/tools/tests/test-project-init.sh +0 -66
- package/tools/tests/test-project-launchd-bootstrap.sh +0 -66
- package/tools/tests/test-project-remove.sh +0 -150
- package/tools/tests/test-project-runtime-supervisor.sh +0 -47
- package/tools/tests/test-project-runtimectl-launchd.sh +0 -115
- package/tools/tests/test-project-runtimectl-missing-profile.sh +0 -54
- package/tools/tests/test-project-runtimectl-start-falls-back-to-bootstrap.sh +0 -108
- package/tools/tests/test-project-runtimectl-status-reports-supervisor-as-heartbeat-parent.sh +0 -95
- package/tools/tests/test-project-runtimectl-status-supervisor-running.sh +0 -59
- package/tools/tests/test-project-runtimectl-stop-cancels-pending-kick.sh +0 -85
- package/tools/tests/test-project-runtimectl-stop-clears-running-labels.sh +0 -78
- package/tools/tests/test-project-runtimectl.sh +0 -212
- package/tools/tests/test-provider-cooldown-state-prefers-runtime-worker-context.sh +0 -39
- package/tools/tests/test-provider-cooldown-state.sh +0 -59
- package/tools/tests/test-public-repo-docs.sh +0 -161
- package/tools/tests/test-reconcile-pr-worker-acp-config-routing.sh +0 -75
- package/tools/tests/test-render-dashboard-snapshot.sh +0 -149
- package/tools/tests/test-render-flow-config-demo-profile.sh +0 -36
- package/tools/tests/test-render-flow-config-provider-pool-fallback.sh +0 -81
- package/tools/tests/test-render-flow-config.sh +0 -52
- package/tools/tests/test-run-codex-task-claude-routing.sh +0 -125
- package/tools/tests/test-run-codex-task-codex-resident-routing.sh +0 -108
- package/tools/tests/test-run-codex-task-kilo-routing.sh +0 -98
- package/tools/tests/test-run-codex-task-openclaw-resident-routing.sh +0 -117
- package/tools/tests/test-run-codex-task-openclaw-routing.sh +0 -113
- package/tools/tests/test-run-codex-task-opencode-routing.sh +0 -98
- package/tools/tests/test-run-codex-task-provider-pool-fallback-routing.sh +0 -146
- package/tools/tests/test-scaffold-profile.sh +0 -108
- package/tools/tests/test-serve-dashboard.sh +0 -93
- package/tools/tests/test-start-issue-worker-blocked-context.sh +0 -129
- package/tools/tests/test-start-issue-worker-blocks-complete-recurring-checklist.sh +0 -189
- package/tools/tests/test-start-issue-worker-local-install-routing.sh +0 -157
- package/tools/tests/test-start-issue-worker-profile-template-routing.sh +0 -149
- package/tools/tests/test-start-issue-worker-recurring-resident-reuse-codex.sh +0 -212
- package/tools/tests/test-start-issue-worker-recurring-resident-reuse.sh +0 -219
- package/tools/tests/test-start-issue-worker-renders-verification-snippet.sh +0 -155
- package/tools/tests/test-start-issue-worker-resident-reuse-falls-back-to-new-worktree.sh +0 -199
- package/tools/tests/test-start-pr-fix-worker-host-blocker-context.sh +0 -275
- package/tools/tests/test-start-resident-issue-loop-adopts-next-recurring-issue.sh +0 -185
- package/tools/tests/test-start-resident-issue-loop-clears-pending-while-waiting-due.sh +0 -152
- package/tools/tests/test-start-resident-issue-loop-consumes-queued-lease.sh +0 -186
- package/tools/tests/test-start-resident-issue-loop-fails-over-provider-pool.sh +0 -212
- package/tools/tests/test-start-resident-issue-loop-immediate-cycles.sh +0 -148
- package/tools/tests/test-start-resident-issue-loop-waits-for-provider.sh +0 -194
- package/tools/tests/test-start-resident-issue-loop-waits-for-terminal-reconcile-status.sh +0 -198
- package/tools/tests/test-start-resident-issue-loop-yields-to-live-lane-controller.sh +0 -145
- package/tools/tests/test-sync-pr-labels-fix-lane-uses-repair-queued.sh +0 -67
- package/tools/tests/test-sync-recurring-issue-checklist-backfills-workflow-complete-blocker.sh +0 -70
- package/tools/tests/test-sync-recurring-issue-checklist.sh +0 -95
- package/tools/tests/test-sync-shared-agent-home-local-source-root.sh +0 -66
- package/tools/tests/test-sync-shared-agent-home-preserves-unrelated-workflow-catalog-skill.sh +0 -47
- package/tools/tests/test-test-smoke.sh +0 -86
- package/tools/tests/test-uninstall-project-launchd.sh +0 -37
- package/tools/tests/test-update-github-labels-prefers-sibling-helper.sh +0 -49
- package/tools/tests/test-vendored-codex-quota-claude-oauth-only.sh +0 -38
- package/tools/tests/test-workflow-catalog.sh +0 -43
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
FLOW_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
5
|
-
REAL_LOOP="${FLOW_ROOT}/tools/bin/start-resident-issue-loop.sh"
|
|
6
|
-
REAL_CONFIG_LIB="${FLOW_ROOT}/tools/bin/flow-config-lib.sh"
|
|
7
|
-
REAL_SHELL_LIB="${FLOW_ROOT}/tools/bin/flow-shell-lib.sh"
|
|
8
|
-
REAL_RESIDENT_LIB="${FLOW_ROOT}/tools/bin/flow-resident-worker-lib.sh"
|
|
9
|
-
|
|
10
|
-
tmpdir="$(mktemp -d)"
|
|
11
|
-
trap 'rm -rf "$tmpdir"' EXIT
|
|
12
|
-
|
|
13
|
-
skill_root="$tmpdir/skill"
|
|
14
|
-
bin_dir="$skill_root/tools/bin"
|
|
15
|
-
hooks_dir="$skill_root/hooks"
|
|
16
|
-
assets_dir="$skill_root/assets"
|
|
17
|
-
profile_registry_root="$tmpdir/profile-registry"
|
|
18
|
-
profile_dir="$profile_registry_root/demo"
|
|
19
|
-
shim_dir="$tmpdir/shim"
|
|
20
|
-
agent_root="$tmpdir/agent"
|
|
21
|
-
repo_root="$tmpdir/repo"
|
|
22
|
-
capture_dir="$tmpdir/capture"
|
|
23
|
-
|
|
24
|
-
mkdir -p "$bin_dir" "$hooks_dir" "$assets_dir" "$profile_dir" "$shim_dir" "$agent_root" "$repo_root" "$capture_dir"
|
|
25
|
-
cp "$REAL_LOOP" "$bin_dir/start-resident-issue-loop.sh"
|
|
26
|
-
cp "$REAL_CONFIG_LIB" "$bin_dir/flow-config-lib.sh"
|
|
27
|
-
cp "$REAL_SHELL_LIB" "$bin_dir/flow-shell-lib.sh"
|
|
28
|
-
cp "$REAL_RESIDENT_LIB" "$bin_dir/flow-resident-worker-lib.sh"
|
|
29
|
-
printf '{}\n' >"$assets_dir/workflow-catalog.json"
|
|
30
|
-
|
|
31
|
-
cat >"$profile_dir/control-plane.yaml" <<EOF
|
|
32
|
-
schema_version: "1"
|
|
33
|
-
id: "demo"
|
|
34
|
-
repo:
|
|
35
|
-
slug: "example/demo"
|
|
36
|
-
root: "$repo_root"
|
|
37
|
-
default_branch: "main"
|
|
38
|
-
runtime:
|
|
39
|
-
orchestrator_agent_root: "$agent_root"
|
|
40
|
-
worktree_root: "$tmpdir/worktrees"
|
|
41
|
-
agent_repo_root: "$repo_root"
|
|
42
|
-
runs_root: "$agent_root/runs"
|
|
43
|
-
state_root: "$agent_root/state"
|
|
44
|
-
history_root: "$agent_root/history"
|
|
45
|
-
retained_repo_root: "$repo_root"
|
|
46
|
-
vscode_workspace_file: "$tmpdir/demo.code-workspace"
|
|
47
|
-
session_naming:
|
|
48
|
-
issue_prefix: "demo-issue-"
|
|
49
|
-
pr_prefix: "demo-pr-"
|
|
50
|
-
execution:
|
|
51
|
-
coding_worker: "openclaw"
|
|
52
|
-
resident_workers:
|
|
53
|
-
issue_reuse_enabled: true
|
|
54
|
-
issue_controller_max_immediate_cycles: 1
|
|
55
|
-
controller_poll_seconds: 1
|
|
56
|
-
issue_controller_idle_timeout_seconds: 1
|
|
57
|
-
EOF
|
|
58
|
-
|
|
59
|
-
cat >"$hooks_dir/heartbeat-hooks.sh" <<'EOF'
|
|
60
|
-
#!/usr/bin/env bash
|
|
61
|
-
set -euo pipefail
|
|
62
|
-
|
|
63
|
-
heartbeat_open_agent_pr_issue_ids() {
|
|
64
|
-
local count_file="${TEST_CAPTURE_DIR:?}/start-count.txt"
|
|
65
|
-
local count="0"
|
|
66
|
-
if [[ -f "${count_file}" ]]; then
|
|
67
|
-
count="$(cat "${count_file}")"
|
|
68
|
-
fi
|
|
69
|
-
if [[ "${count}" =~ ^[1-9][0-9]*$ ]]; then
|
|
70
|
-
printf '["440"]\n'
|
|
71
|
-
else
|
|
72
|
-
printf '[]\n'
|
|
73
|
-
fi
|
|
74
|
-
}
|
|
75
|
-
heartbeat_list_ready_issue_ids() { :; }
|
|
76
|
-
heartbeat_issue_is_recurring() {
|
|
77
|
-
case "${1:-}" in
|
|
78
|
-
440|441) printf 'yes\n' ;;
|
|
79
|
-
*) printf 'no\n' ;;
|
|
80
|
-
esac
|
|
81
|
-
}
|
|
82
|
-
heartbeat_issue_is_scheduled() { printf 'no\n'; }
|
|
83
|
-
heartbeat_issue_is_heavy() { printf 'no\n'; }
|
|
84
|
-
heartbeat_mark_issue_running() {
|
|
85
|
-
printf 'RUNNING:%s:%s\n' "${1:?issue id required}" "${2:-no}" >>"${TEST_CAPTURE_DIR:?}/events.log"
|
|
86
|
-
}
|
|
87
|
-
heartbeat_issue_launch_failed() {
|
|
88
|
-
printf 'FAILED:%s\n' "${1:?issue id required}" >>"${TEST_CAPTURE_DIR:?}/events.log"
|
|
89
|
-
}
|
|
90
|
-
EOF
|
|
91
|
-
chmod +x "$hooks_dir/heartbeat-hooks.sh"
|
|
92
|
-
|
|
93
|
-
cat >"$shim_dir/gh" <<'EOF'
|
|
94
|
-
#!/usr/bin/env bash
|
|
95
|
-
set -euo pipefail
|
|
96
|
-
|
|
97
|
-
if [[ "${1:-}" == "issue" && "${2:-}" == "view" ]]; then
|
|
98
|
-
issue_id="${3:-0}"
|
|
99
|
-
cat <<JSON
|
|
100
|
-
{"number":${issue_id},"state":"OPEN","title":"Resident issue ${issue_id}","body":"Keep this issue moving.","url":"https://example.test/issues/${issue_id}","labels":[{"name":"agent-keep-open"}],"comments":[]}
|
|
101
|
-
JSON
|
|
102
|
-
exit 0
|
|
103
|
-
fi
|
|
104
|
-
|
|
105
|
-
if [[ "${1:-}" == "pr" && "${2:-}" == "list" ]]; then
|
|
106
|
-
printf '[]\n'
|
|
107
|
-
exit 0
|
|
108
|
-
fi
|
|
109
|
-
|
|
110
|
-
exit 64
|
|
111
|
-
EOF
|
|
112
|
-
chmod +x "$shim_dir/gh"
|
|
113
|
-
|
|
114
|
-
cat >"$shim_dir/tmux" <<'EOF'
|
|
115
|
-
#!/usr/bin/env bash
|
|
116
|
-
set -euo pipefail
|
|
117
|
-
|
|
118
|
-
if [[ "${1:-}" == "has-session" ]]; then
|
|
119
|
-
pid_file="${TEST_CAPTURE_DIR:?}/tmux-session.pid"
|
|
120
|
-
if [[ -f "${pid_file}" ]]; then
|
|
121
|
-
pid="$(tr -d '[:space:]' <"${pid_file}" 2>/dev/null || true)"
|
|
122
|
-
if [[ -n "${pid}" ]] && kill -0 "${pid}" 2>/dev/null; then
|
|
123
|
-
exit 0
|
|
124
|
-
fi
|
|
125
|
-
rm -f "${pid_file}"
|
|
126
|
-
fi
|
|
127
|
-
exit 1
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
exit 1
|
|
131
|
-
EOF
|
|
132
|
-
chmod +x "$shim_dir/tmux"
|
|
133
|
-
|
|
134
|
-
cat >"$bin_dir/start-issue-worker.sh" <<'EOF'
|
|
135
|
-
#!/usr/bin/env bash
|
|
136
|
-
set -euo pipefail
|
|
137
|
-
|
|
138
|
-
issue_id="${1:?issue id required}"
|
|
139
|
-
capture_dir="${TEST_CAPTURE_DIR:?}"
|
|
140
|
-
count_file="${capture_dir}/start-count.txt"
|
|
141
|
-
count="0"
|
|
142
|
-
if [[ -f "${count_file}" ]]; then
|
|
143
|
-
count="$(cat "${count_file}")"
|
|
144
|
-
fi
|
|
145
|
-
count="$((count + 1))"
|
|
146
|
-
printf '%s\n' "${count}" >"${count_file}"
|
|
147
|
-
printf 'START:%s:%s\n' "${issue_id}" "${count}" >>"${capture_dir}/events.log"
|
|
148
|
-
(sleep 0.2) &
|
|
149
|
-
printf '%s\n' "$!" >"${capture_dir}/tmux-session.pid"
|
|
150
|
-
EOF
|
|
151
|
-
chmod +x "$bin_dir/start-issue-worker.sh"
|
|
152
|
-
|
|
153
|
-
cat >"$bin_dir/reconcile-issue-worker.sh" <<'EOF'
|
|
154
|
-
#!/usr/bin/env bash
|
|
155
|
-
set -euo pipefail
|
|
156
|
-
printf 'RECONCILE:%s\n' "${1:?session required}" >>"${TEST_CAPTURE_DIR:?}/events.log"
|
|
157
|
-
EOF
|
|
158
|
-
chmod +x "$bin_dir/reconcile-issue-worker.sh"
|
|
159
|
-
|
|
160
|
-
queue_dir="$agent_root/state/resident-workers/issue-queue/pending"
|
|
161
|
-
mkdir -p "$queue_dir"
|
|
162
|
-
cat >"$queue_dir/issue-441.env" <<'EOF'
|
|
163
|
-
ISSUE_ID=441
|
|
164
|
-
QUEUED_BY=test
|
|
165
|
-
QUEUED_AT=2026-03-26T00:00:00Z
|
|
166
|
-
EOF
|
|
167
|
-
|
|
168
|
-
PATH="$shim_dir:$PATH" \
|
|
169
|
-
ACP_PROJECT_ID="demo" \
|
|
170
|
-
ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
|
|
171
|
-
TEST_CAPTURE_DIR="$capture_dir" \
|
|
172
|
-
bash "$bin_dir/start-resident-issue-loop.sh" 440 >/dev/null
|
|
173
|
-
|
|
174
|
-
controller_dir="$agent_root/state/resident-workers/issues"
|
|
175
|
-
controller_file_441="$controller_dir/441/controller.env"
|
|
176
|
-
|
|
177
|
-
grep -q '^2$' "$capture_dir/start-count.txt"
|
|
178
|
-
grep -q '^START:440:1$' "$capture_dir/events.log"
|
|
179
|
-
grep -q '^START:441:2$' "$capture_dir/events.log"
|
|
180
|
-
grep -q '^RECONCILE:demo-issue-441$' "$capture_dir/events.log"
|
|
181
|
-
test ! -f "$queue_dir/issue-441.env"
|
|
182
|
-
test -f "$controller_file_441"
|
|
183
|
-
grep -q '^ISSUE_ID=441$' "$controller_file_441"
|
|
184
|
-
grep -q '^CONTROLLER_REASON=idle-timeout$' "$controller_file_441"
|
|
185
|
-
|
|
186
|
-
echo "start resident issue loop consumes queued lease test passed"
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
FLOW_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
5
|
-
REAL_LOOP="${FLOW_ROOT}/tools/bin/start-resident-issue-loop.sh"
|
|
6
|
-
REAL_CONFIG_LIB="${FLOW_ROOT}/tools/bin/flow-config-lib.sh"
|
|
7
|
-
REAL_SHELL_LIB="${FLOW_ROOT}/tools/bin/flow-shell-lib.sh"
|
|
8
|
-
REAL_RESIDENT_LIB="${FLOW_ROOT}/tools/bin/flow-resident-worker-lib.sh"
|
|
9
|
-
REAL_PROVIDER_STATE="${FLOW_ROOT}/tools/bin/provider-cooldown-state.sh"
|
|
10
|
-
REAL_RETRY_STATE="${FLOW_ROOT}/tools/bin/agent-project-retry-state"
|
|
11
|
-
|
|
12
|
-
tmpdir="$(mktemp -d)"
|
|
13
|
-
trap 'rm -rf "$tmpdir"' EXIT
|
|
14
|
-
|
|
15
|
-
skill_root="$tmpdir/skill"
|
|
16
|
-
bin_dir="$skill_root/tools/bin"
|
|
17
|
-
hooks_dir="$skill_root/hooks"
|
|
18
|
-
assets_dir="$skill_root/assets"
|
|
19
|
-
profile_registry_root="$tmpdir/profile-registry"
|
|
20
|
-
profile_dir="$profile_registry_root/demo"
|
|
21
|
-
shim_dir="$tmpdir/shim"
|
|
22
|
-
agent_root="$tmpdir/agent"
|
|
23
|
-
repo_root="$tmpdir/repo"
|
|
24
|
-
capture_dir="$tmpdir/capture"
|
|
25
|
-
state_root="$agent_root/state"
|
|
26
|
-
primary_meta_file="$state_root/resident-workers/issues/issue-lane-recurring-general-openclaw-safe/metadata.env"
|
|
27
|
-
fallback_meta_file="$state_root/resident-workers/issues/issue-lane-recurring-general-claude-safe/metadata.env"
|
|
28
|
-
primary_cooldown_file="$state_root/retries/providers/openclaw-primary-model.env"
|
|
29
|
-
|
|
30
|
-
mkdir -p "$bin_dir" "$hooks_dir" "$assets_dir" "$profile_dir" "$shim_dir" "$agent_root" "$repo_root" "$capture_dir"
|
|
31
|
-
cp "$REAL_LOOP" "$bin_dir/start-resident-issue-loop.sh"
|
|
32
|
-
cp "$REAL_CONFIG_LIB" "$bin_dir/flow-config-lib.sh"
|
|
33
|
-
cp "$REAL_SHELL_LIB" "$bin_dir/flow-shell-lib.sh"
|
|
34
|
-
cp "$REAL_RESIDENT_LIB" "$bin_dir/flow-resident-worker-lib.sh"
|
|
35
|
-
cp "$REAL_PROVIDER_STATE" "$bin_dir/provider-cooldown-state.sh"
|
|
36
|
-
cp "$REAL_RETRY_STATE" "$bin_dir/agent-project-retry-state"
|
|
37
|
-
printf '{}\n' >"$assets_dir/workflow-catalog.json"
|
|
38
|
-
|
|
39
|
-
cat >"$profile_dir/control-plane.yaml" <<EOF
|
|
40
|
-
schema_version: "1"
|
|
41
|
-
id: "demo"
|
|
42
|
-
repo:
|
|
43
|
-
slug: "example/demo"
|
|
44
|
-
root: "$repo_root"
|
|
45
|
-
default_branch: "main"
|
|
46
|
-
runtime:
|
|
47
|
-
orchestrator_agent_root: "$agent_root"
|
|
48
|
-
worktree_root: "$tmpdir/worktrees"
|
|
49
|
-
agent_repo_root: "$repo_root"
|
|
50
|
-
runs_root: "$agent_root/runs"
|
|
51
|
-
state_root: "$state_root"
|
|
52
|
-
history_root: "$agent_root/history"
|
|
53
|
-
retained_repo_root: "$repo_root"
|
|
54
|
-
vscode_workspace_file: "$tmpdir/demo.code-workspace"
|
|
55
|
-
session_naming:
|
|
56
|
-
issue_prefix: "demo-issue-"
|
|
57
|
-
pr_prefix: "demo-pr-"
|
|
58
|
-
execution:
|
|
59
|
-
coding_worker: "openclaw"
|
|
60
|
-
provider_quota:
|
|
61
|
-
cooldowns: "300,900"
|
|
62
|
-
provider_pool_order: "primary fallback"
|
|
63
|
-
provider_pools:
|
|
64
|
-
primary:
|
|
65
|
-
coding_worker: "openclaw"
|
|
66
|
-
openclaw:
|
|
67
|
-
model: "primary/model"
|
|
68
|
-
thinking: "adaptive"
|
|
69
|
-
timeout_seconds: 321
|
|
70
|
-
fallback:
|
|
71
|
-
coding_worker: "claude"
|
|
72
|
-
claude:
|
|
73
|
-
model: "fallback-sonnet"
|
|
74
|
-
permission_mode: "dontAsk"
|
|
75
|
-
effort: "high"
|
|
76
|
-
timeout_seconds: 777
|
|
77
|
-
max_attempts: 5
|
|
78
|
-
retry_backoff_seconds: 12
|
|
79
|
-
resident_workers:
|
|
80
|
-
issue_reuse_enabled: true
|
|
81
|
-
issue_controller_max_immediate_cycles: 2
|
|
82
|
-
controller_poll_seconds: 1
|
|
83
|
-
issue_controller_idle_timeout_seconds: 1
|
|
84
|
-
EOF
|
|
85
|
-
|
|
86
|
-
cat >"$hooks_dir/heartbeat-hooks.sh" <<'EOF'
|
|
87
|
-
#!/usr/bin/env bash
|
|
88
|
-
set -euo pipefail
|
|
89
|
-
heartbeat_open_agent_pr_issue_ids() { printf '[]\n'; }
|
|
90
|
-
EOF
|
|
91
|
-
chmod +x "$hooks_dir/heartbeat-hooks.sh"
|
|
92
|
-
|
|
93
|
-
cat >"$shim_dir/gh" <<'EOF'
|
|
94
|
-
#!/usr/bin/env bash
|
|
95
|
-
set -euo pipefail
|
|
96
|
-
|
|
97
|
-
if [[ "${1:-}" == "issue" && "${2:-}" == "view" ]]; then
|
|
98
|
-
issue_id="${3:-0}"
|
|
99
|
-
cat <<JSON
|
|
100
|
-
{"number":${issue_id},"state":"OPEN","title":"Resident issue ${issue_id}","body":"Keep this issue moving.","url":"https://example.test/issues/${issue_id}","labels":[{"name":"agent-keep-open"}],"comments":[]}
|
|
101
|
-
JSON
|
|
102
|
-
exit 0
|
|
103
|
-
fi
|
|
104
|
-
|
|
105
|
-
if [[ "${1:-}" == "pr" && "${2:-}" == "list" ]]; then
|
|
106
|
-
printf '[]\n'
|
|
107
|
-
exit 0
|
|
108
|
-
fi
|
|
109
|
-
|
|
110
|
-
exit 64
|
|
111
|
-
EOF
|
|
112
|
-
chmod +x "$shim_dir/gh"
|
|
113
|
-
|
|
114
|
-
cat >"$shim_dir/tmux" <<'EOF'
|
|
115
|
-
#!/usr/bin/env bash
|
|
116
|
-
set -euo pipefail
|
|
117
|
-
|
|
118
|
-
if [[ "${1:-}" == "has-session" ]]; then
|
|
119
|
-
pid_file="${TEST_CAPTURE_DIR:?}/tmux-session.pid"
|
|
120
|
-
if [[ -f "${pid_file}" ]]; then
|
|
121
|
-
pid="$(tr -d '[:space:]' <"${pid_file}" 2>/dev/null || true)"
|
|
122
|
-
if [[ -n "${pid}" ]] && kill -0 "${pid}" 2>/dev/null; then
|
|
123
|
-
exit 0
|
|
124
|
-
fi
|
|
125
|
-
rm -f "${pid_file}"
|
|
126
|
-
fi
|
|
127
|
-
exit 1
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
exit 1
|
|
131
|
-
EOF
|
|
132
|
-
chmod +x "$shim_dir/tmux"
|
|
133
|
-
|
|
134
|
-
cat >"$bin_dir/start-issue-worker.sh" <<'EOF'
|
|
135
|
-
#!/usr/bin/env bash
|
|
136
|
-
set -euo pipefail
|
|
137
|
-
|
|
138
|
-
issue_id="${1:?issue id required}"
|
|
139
|
-
capture_dir="${TEST_CAPTURE_DIR:?}"
|
|
140
|
-
count_file="${capture_dir}/start-count.txt"
|
|
141
|
-
count="0"
|
|
142
|
-
if [[ -f "${count_file}" ]]; then
|
|
143
|
-
count="$(cat "${count_file}")"
|
|
144
|
-
fi
|
|
145
|
-
count="$((count + 1))"
|
|
146
|
-
printf '%s\n' "${count}" >"${count_file}"
|
|
147
|
-
printf 'START:%s:%s:%s\n' "${issue_id}" "${count}" "${ACP_CODING_WORKER:-}" >>"${capture_dir}/events.log"
|
|
148
|
-
(sleep 0.2) &
|
|
149
|
-
printf '%s\n' "$!" >"${capture_dir}/tmux-session.pid"
|
|
150
|
-
EOF
|
|
151
|
-
chmod +x "$bin_dir/start-issue-worker.sh"
|
|
152
|
-
|
|
153
|
-
cat >"$bin_dir/reconcile-issue-worker.sh" <<EOF
|
|
154
|
-
#!/usr/bin/env bash
|
|
155
|
-
set -euo pipefail
|
|
156
|
-
|
|
157
|
-
session="\${1:?session required}"
|
|
158
|
-
capture_dir="${capture_dir}"
|
|
159
|
-
count_file="\${capture_dir}/reconcile-count.txt"
|
|
160
|
-
count="0"
|
|
161
|
-
if [[ -f "\${count_file}" ]]; then
|
|
162
|
-
count="\$(cat "\${count_file}")"
|
|
163
|
-
fi
|
|
164
|
-
count="\$((count + 1))"
|
|
165
|
-
printf '%s\n' "\${count}" >"\${count_file}"
|
|
166
|
-
printf 'RECONCILE:%s:%s\n' "\${session}" "\${count}" >>"\${capture_dir}/events.log"
|
|
167
|
-
|
|
168
|
-
mkdir -p "$(dirname "$primary_meta_file")" "$(dirname "$fallback_meta_file")" "$(dirname "$primary_cooldown_file")"
|
|
169
|
-
if [[ "\${count}" == "1" ]]; then
|
|
170
|
-
cat >"$primary_meta_file" <<'OUT'
|
|
171
|
-
LAST_FAILURE_REASON=provider-quota-limit
|
|
172
|
-
OUT
|
|
173
|
-
future_epoch=\$(( \$(date +%s) + 3600 ))
|
|
174
|
-
cat >"$primary_cooldown_file" <<OUT
|
|
175
|
-
ATTEMPTS=1
|
|
176
|
-
NEXT_ATTEMPT_EPOCH=\${future_epoch}
|
|
177
|
-
NEXT_ATTEMPT_AT=2099-01-01T00:00:00Z
|
|
178
|
-
LAST_REASON=provider-quota-limit
|
|
179
|
-
UPDATED_AT=2099-01-01T00:00:00Z
|
|
180
|
-
OUT
|
|
181
|
-
else
|
|
182
|
-
cat >"$fallback_meta_file" <<'OUT'
|
|
183
|
-
LAST_FAILURE_REASON=
|
|
184
|
-
OUT
|
|
185
|
-
fi
|
|
186
|
-
EOF
|
|
187
|
-
chmod +x "$bin_dir/reconcile-issue-worker.sh"
|
|
188
|
-
|
|
189
|
-
PATH="$shim_dir:$PATH" \
|
|
190
|
-
ACP_PROJECT_ID="demo" \
|
|
191
|
-
ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
|
|
192
|
-
TEST_CAPTURE_DIR="$capture_dir" \
|
|
193
|
-
bash "$bin_dir/start-resident-issue-loop.sh" 440 >/dev/null
|
|
194
|
-
|
|
195
|
-
controller_file="$state_root/resident-workers/issues/440/controller.env"
|
|
196
|
-
|
|
197
|
-
grep -q '^2$' "$capture_dir/start-count.txt"
|
|
198
|
-
grep -q '^START:440:1:openclaw$' "$capture_dir/events.log"
|
|
199
|
-
grep -q '^START:440:2:claude$' "$capture_dir/events.log"
|
|
200
|
-
grep -q '^RECONCILE:demo-issue-440:1$' "$capture_dir/events.log"
|
|
201
|
-
grep -q '^RECONCILE:demo-issue-440:2$' "$capture_dir/events.log"
|
|
202
|
-
grep -q '^CONTROLLER_REASON=idle-timeout$' "$controller_file"
|
|
203
|
-
grep -q '^CONTROLLER_STATE=stopped$' "$controller_file"
|
|
204
|
-
grep -q '^ACTIVE_PROVIDER_BACKEND=claude$' "$controller_file"
|
|
205
|
-
grep -q '^ACTIVE_PROVIDER_MODEL=fallback-sonnet$' "$controller_file"
|
|
206
|
-
grep -q '^LAST_PROVIDER_SWITCH_REASON=provider-failover$' "$controller_file"
|
|
207
|
-
grep -q '^LAST_PROVIDER_FROM_BACKEND=openclaw$' "$controller_file"
|
|
208
|
-
grep -q '^LAST_PROVIDER_TO_BACKEND=claude$' "$controller_file"
|
|
209
|
-
test "$(awk -F= '/^PROVIDER_SWITCH_COUNT=/{print $2}' "$controller_file")" -eq 1
|
|
210
|
-
test "$(awk -F= '/^PROVIDER_FAILOVER_COUNT=/{print $2}' "$controller_file")" -eq 1
|
|
211
|
-
|
|
212
|
-
echo "start resident issue loop provider pool failover test passed"
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
FLOW_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
5
|
-
REAL_LOOP="${FLOW_ROOT}/tools/bin/start-resident-issue-loop.sh"
|
|
6
|
-
REAL_CONFIG_LIB="${FLOW_ROOT}/tools/bin/flow-config-lib.sh"
|
|
7
|
-
REAL_SHELL_LIB="${FLOW_ROOT}/tools/bin/flow-shell-lib.sh"
|
|
8
|
-
REAL_RESIDENT_LIB="${FLOW_ROOT}/tools/bin/flow-resident-worker-lib.sh"
|
|
9
|
-
|
|
10
|
-
tmpdir="$(mktemp -d)"
|
|
11
|
-
trap 'rm -rf "$tmpdir"' EXIT
|
|
12
|
-
|
|
13
|
-
skill_root="$tmpdir/skill"
|
|
14
|
-
bin_dir="$skill_root/tools/bin"
|
|
15
|
-
hooks_dir="$skill_root/hooks"
|
|
16
|
-
assets_dir="$skill_root/assets"
|
|
17
|
-
profile_registry_root="$tmpdir/profile-registry"
|
|
18
|
-
profile_dir="$profile_registry_root/demo"
|
|
19
|
-
shim_dir="$tmpdir/shim"
|
|
20
|
-
agent_root="$tmpdir/agent"
|
|
21
|
-
repo_root="$tmpdir/repo"
|
|
22
|
-
capture_dir="$tmpdir/capture"
|
|
23
|
-
|
|
24
|
-
mkdir -p "$bin_dir" "$hooks_dir" "$assets_dir" "$profile_dir" "$shim_dir" "$agent_root" "$repo_root" "$capture_dir"
|
|
25
|
-
cp "$REAL_LOOP" "$bin_dir/start-resident-issue-loop.sh"
|
|
26
|
-
cp "$REAL_CONFIG_LIB" "$bin_dir/flow-config-lib.sh"
|
|
27
|
-
cp "$REAL_SHELL_LIB" "$bin_dir/flow-shell-lib.sh"
|
|
28
|
-
cp "$REAL_RESIDENT_LIB" "$bin_dir/flow-resident-worker-lib.sh"
|
|
29
|
-
printf '{}\n' >"$assets_dir/workflow-catalog.json"
|
|
30
|
-
|
|
31
|
-
cat >"$profile_dir/control-plane.yaml" <<EOF
|
|
32
|
-
schema_version: "1"
|
|
33
|
-
id: "demo"
|
|
34
|
-
repo:
|
|
35
|
-
slug: "example/demo"
|
|
36
|
-
root: "$repo_root"
|
|
37
|
-
default_branch: "main"
|
|
38
|
-
runtime:
|
|
39
|
-
orchestrator_agent_root: "$agent_root"
|
|
40
|
-
worktree_root: "$tmpdir/worktrees"
|
|
41
|
-
agent_repo_root: "$repo_root"
|
|
42
|
-
runs_root: "$agent_root/runs"
|
|
43
|
-
state_root: "$agent_root/state"
|
|
44
|
-
history_root: "$agent_root/history"
|
|
45
|
-
retained_repo_root: "$repo_root"
|
|
46
|
-
vscode_workspace_file: "$tmpdir/demo.code-workspace"
|
|
47
|
-
session_naming:
|
|
48
|
-
issue_prefix: "demo-issue-"
|
|
49
|
-
pr_prefix: "demo-pr-"
|
|
50
|
-
execution:
|
|
51
|
-
coding_worker: "openclaw"
|
|
52
|
-
resident_workers:
|
|
53
|
-
issue_reuse_enabled: true
|
|
54
|
-
issue_controller_max_immediate_cycles: 2
|
|
55
|
-
controller_poll_seconds: 1
|
|
56
|
-
issue_controller_idle_timeout_seconds: 1
|
|
57
|
-
EOF
|
|
58
|
-
|
|
59
|
-
cat >"$hooks_dir/heartbeat-hooks.sh" <<'EOF'
|
|
60
|
-
#!/usr/bin/env bash
|
|
61
|
-
set -euo pipefail
|
|
62
|
-
heartbeat_open_agent_pr_issue_ids() { printf '[]\n'; }
|
|
63
|
-
EOF
|
|
64
|
-
chmod +x "$hooks_dir/heartbeat-hooks.sh"
|
|
65
|
-
|
|
66
|
-
cat >"$shim_dir/gh" <<'EOF'
|
|
67
|
-
#!/usr/bin/env bash
|
|
68
|
-
set -euo pipefail
|
|
69
|
-
|
|
70
|
-
if [[ "${1:-}" == "issue" && "${2:-}" == "view" ]]; then
|
|
71
|
-
issue_id="${3:-0}"
|
|
72
|
-
cat <<JSON
|
|
73
|
-
{"number":${issue_id},"state":"OPEN","title":"Resident issue ${issue_id}","body":"Keep this issue moving.","url":"https://example.test/issues/${issue_id}","labels":[{"name":"agent-keep-open"}],"comments":[]}
|
|
74
|
-
JSON
|
|
75
|
-
exit 0
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
if [[ "${1:-}" == "pr" && "${2:-}" == "list" ]]; then
|
|
79
|
-
printf '[]\n'
|
|
80
|
-
exit 0
|
|
81
|
-
fi
|
|
82
|
-
|
|
83
|
-
exit 64
|
|
84
|
-
EOF
|
|
85
|
-
chmod +x "$shim_dir/gh"
|
|
86
|
-
|
|
87
|
-
cat >"$shim_dir/tmux" <<'EOF'
|
|
88
|
-
#!/usr/bin/env bash
|
|
89
|
-
set -euo pipefail
|
|
90
|
-
|
|
91
|
-
if [[ "${1:-}" == "has-session" ]]; then
|
|
92
|
-
pid_file="${TEST_CAPTURE_DIR:?}/tmux-session.pid"
|
|
93
|
-
if [[ -f "${pid_file}" ]]; then
|
|
94
|
-
pid="$(tr -d '[:space:]' <"${pid_file}" 2>/dev/null || true)"
|
|
95
|
-
if [[ -n "${pid}" ]] && kill -0 "${pid}" 2>/dev/null; then
|
|
96
|
-
exit 0
|
|
97
|
-
fi
|
|
98
|
-
rm -f "${pid_file}"
|
|
99
|
-
fi
|
|
100
|
-
exit 1
|
|
101
|
-
fi
|
|
102
|
-
|
|
103
|
-
exit 1
|
|
104
|
-
EOF
|
|
105
|
-
chmod +x "$shim_dir/tmux"
|
|
106
|
-
|
|
107
|
-
cat >"$bin_dir/start-issue-worker.sh" <<'EOF'
|
|
108
|
-
#!/usr/bin/env bash
|
|
109
|
-
set -euo pipefail
|
|
110
|
-
|
|
111
|
-
issue_id="${1:?issue id required}"
|
|
112
|
-
capture_dir="${TEST_CAPTURE_DIR:?}"
|
|
113
|
-
count_file="${capture_dir}/start-count.txt"
|
|
114
|
-
count="0"
|
|
115
|
-
if [[ -f "${count_file}" ]]; then
|
|
116
|
-
count="$(cat "${count_file}")"
|
|
117
|
-
fi
|
|
118
|
-
count="$((count + 1))"
|
|
119
|
-
printf '%s\n' "${count}" >"${count_file}"
|
|
120
|
-
printf 'START:%s:%s\n' "${issue_id}" "${count}" >>"${capture_dir}/events.log"
|
|
121
|
-
(sleep 0.2) &
|
|
122
|
-
printf '%s\n' "$!" >"${capture_dir}/tmux-session.pid"
|
|
123
|
-
EOF
|
|
124
|
-
chmod +x "$bin_dir/start-issue-worker.sh"
|
|
125
|
-
|
|
126
|
-
cat >"$bin_dir/reconcile-issue-worker.sh" <<'EOF'
|
|
127
|
-
#!/usr/bin/env bash
|
|
128
|
-
set -euo pipefail
|
|
129
|
-
printf 'RECONCILE:%s\n' "${1:?session required}" >>"${TEST_CAPTURE_DIR:?}/events.log"
|
|
130
|
-
EOF
|
|
131
|
-
chmod +x "$bin_dir/reconcile-issue-worker.sh"
|
|
132
|
-
|
|
133
|
-
PATH="$shim_dir:$PATH" \
|
|
134
|
-
ACP_PROJECT_ID="demo" \
|
|
135
|
-
ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
|
|
136
|
-
TEST_CAPTURE_DIR="$capture_dir" \
|
|
137
|
-
bash "$bin_dir/start-resident-issue-loop.sh" 440 >/dev/null
|
|
138
|
-
|
|
139
|
-
controller_file="$agent_root/state/resident-workers/issues/440/controller.env"
|
|
140
|
-
|
|
141
|
-
grep -q '^2$' "$capture_dir/start-count.txt"
|
|
142
|
-
test "$(grep -c '^START:440:' "$capture_dir/events.log")" -eq 2
|
|
143
|
-
test "$(grep -c '^RECONCILE:demo-issue-440$' "$capture_dir/events.log")" -eq 2
|
|
144
|
-
grep -q '^CONTROLLER_LOOP_COUNT=2$' "$controller_file"
|
|
145
|
-
grep -q '^CONTROLLER_REASON=idle-timeout$' "$controller_file"
|
|
146
|
-
grep -q '^CONTROLLER_STATE=stopped$' "$controller_file"
|
|
147
|
-
|
|
148
|
-
echo "start resident issue loop immediate cycles test passed"
|