agent-control-plane 0.1.1 → 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 +2 -3
- package/tools/vendor/codex-quota/README.md +8 -16
- package/tools/vendor/codex-quota/lib/claude-accounts.js +2 -68
- package/tools/vendor/codex-quota/lib/claude-usage.js +76 -667
- package/tools/vendor/codex-quota/lib/display.js +6 -14
- package/tools/vendor/codex-quota/lib/handlers.js +32 -117
- package/tools/vendor/codex-quota/lib/sync.js +9 -14
- 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 -160
- 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-workflow-catalog.sh +0 -43
|
@@ -1,194 +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
|
-
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/provider-cooldown-state.sh" <<'EOF'
|
|
108
|
-
#!/usr/bin/env bash
|
|
109
|
-
set -euo pipefail
|
|
110
|
-
|
|
111
|
-
capture_dir="${TEST_CAPTURE_DIR:?}"
|
|
112
|
-
count_file="${capture_dir}/provider-count.txt"
|
|
113
|
-
count="0"
|
|
114
|
-
if [[ -f "${count_file}" ]]; then
|
|
115
|
-
count="$(cat "${count_file}")"
|
|
116
|
-
fi
|
|
117
|
-
count="$((count + 1))"
|
|
118
|
-
printf '%s\n' "${count}" >"${count_file}"
|
|
119
|
-
|
|
120
|
-
if (( count <= 2 )); then
|
|
121
|
-
future_epoch=$(( $(date +%s) + 1 ))
|
|
122
|
-
printf 'PROVIDER:%s:no\n' "${count}" >>"${capture_dir}/events.log"
|
|
123
|
-
cat <<OUT
|
|
124
|
-
BACKEND=openclaw
|
|
125
|
-
MODEL=primary/model
|
|
126
|
-
NEXT_ATTEMPT_EPOCH=${future_epoch}
|
|
127
|
-
NEXT_ATTEMPT_AT=2099-01-01T00:00:00Z
|
|
128
|
-
READY=no
|
|
129
|
-
LAST_REASON=provider-quota-limit
|
|
130
|
-
OUT
|
|
131
|
-
else
|
|
132
|
-
printf 'PROVIDER:%s:yes\n' "${count}" >>"${capture_dir}/events.log"
|
|
133
|
-
cat <<'OUT'
|
|
134
|
-
BACKEND=openclaw
|
|
135
|
-
MODEL=primary/model
|
|
136
|
-
NEXT_ATTEMPT_EPOCH=0
|
|
137
|
-
NEXT_ATTEMPT_AT=
|
|
138
|
-
READY=yes
|
|
139
|
-
LAST_REASON=
|
|
140
|
-
OUT
|
|
141
|
-
fi
|
|
142
|
-
EOF
|
|
143
|
-
chmod +x "$bin_dir/provider-cooldown-state.sh"
|
|
144
|
-
|
|
145
|
-
cat >"$bin_dir/start-issue-worker.sh" <<'EOF'
|
|
146
|
-
#!/usr/bin/env bash
|
|
147
|
-
set -euo pipefail
|
|
148
|
-
|
|
149
|
-
issue_id="${1:?issue id required}"
|
|
150
|
-
capture_dir="${TEST_CAPTURE_DIR:?}"
|
|
151
|
-
count_file="${capture_dir}/start-count.txt"
|
|
152
|
-
count="0"
|
|
153
|
-
if [[ -f "${count_file}" ]]; then
|
|
154
|
-
count="$(cat "${count_file}")"
|
|
155
|
-
fi
|
|
156
|
-
count="$((count + 1))"
|
|
157
|
-
printf '%s\n' "${count}" >"${count_file}"
|
|
158
|
-
printf 'START:%s:%s\n' "${issue_id}" "${count}" >>"${capture_dir}/events.log"
|
|
159
|
-
(sleep 0.2) &
|
|
160
|
-
printf '%s\n' "$!" >"${capture_dir}/tmux-session.pid"
|
|
161
|
-
EOF
|
|
162
|
-
chmod +x "$bin_dir/start-issue-worker.sh"
|
|
163
|
-
|
|
164
|
-
cat >"$bin_dir/reconcile-issue-worker.sh" <<'EOF'
|
|
165
|
-
#!/usr/bin/env bash
|
|
166
|
-
set -euo pipefail
|
|
167
|
-
printf 'RECONCILE:%s\n' "${1:?session required}" >>"${TEST_CAPTURE_DIR:?}/events.log"
|
|
168
|
-
EOF
|
|
169
|
-
chmod +x "$bin_dir/reconcile-issue-worker.sh"
|
|
170
|
-
|
|
171
|
-
PATH="$shim_dir:$PATH" \
|
|
172
|
-
ACP_PROJECT_ID="demo" \
|
|
173
|
-
ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
|
|
174
|
-
TEST_CAPTURE_DIR="$capture_dir" \
|
|
175
|
-
bash "$bin_dir/start-resident-issue-loop.sh" 440 >/dev/null
|
|
176
|
-
|
|
177
|
-
controller_file="$agent_root/state/resident-workers/issues/440/controller.env"
|
|
178
|
-
line_provider_2="$(grep -n '^PROVIDER:2:no$' "$capture_dir/events.log" | cut -d: -f1)"
|
|
179
|
-
line_start_1="$(grep -n '^START:440:1$' "$capture_dir/events.log" | cut -d: -f1)"
|
|
180
|
-
|
|
181
|
-
grep -q '^1$' "$capture_dir/start-count.txt"
|
|
182
|
-
test -n "$line_provider_2"
|
|
183
|
-
test -n "$line_start_1"
|
|
184
|
-
test "$line_start_1" -gt "$line_provider_2"
|
|
185
|
-
grep -q '^RECONCILE:demo-issue-440$' "$capture_dir/events.log"
|
|
186
|
-
grep -q '^CONTROLLER_REASON=idle-timeout$' "$controller_file"
|
|
187
|
-
grep -q '^CONTROLLER_STATE=stopped$' "$controller_file"
|
|
188
|
-
grep -q '^ACTIVE_PROVIDER_BACKEND=openclaw$' "$controller_file"
|
|
189
|
-
test "$(awk -F= '/^PROVIDER_WAIT_COUNT=/{print $2}' "$controller_file")" -eq 1
|
|
190
|
-
test "$(awk -F= '/^PROVIDER_WAIT_TOTAL_SECONDS=/{print $2}' "$controller_file")" -ge 1
|
|
191
|
-
test "$(awk -F= '/^PROVIDER_LAST_WAIT_SECONDS=/{print $2}' "$controller_file")" -ge 1
|
|
192
|
-
grep -q '^PROVIDER_FAILOVER_COUNT=0$' "$controller_file"
|
|
193
|
-
|
|
194
|
-
echo "start resident issue loop waits for provider test passed"
|
|
@@ -1,198 +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() { printf '440\n441\n'; }
|
|
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
|
-
|
|
157
|
-
session="${1:?session required}"
|
|
158
|
-
capture_dir="${TEST_CAPTURE_DIR:?}"
|
|
159
|
-
count_file="${capture_dir}/reconcile-${session}.count"
|
|
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
|
-
|
|
167
|
-
if [[ "${session}" == "demo-issue-440" && "${count}" -eq 1 ]]; then
|
|
168
|
-
printf 'RECONCILE:%s:RUNNING\n' "${session}" >>"${capture_dir}/events.log"
|
|
169
|
-
printf 'STATUS=RUNNING\n'
|
|
170
|
-
exit 0
|
|
171
|
-
fi
|
|
172
|
-
|
|
173
|
-
printf 'RECONCILE:%s:FAILED\n' "${session}" >>"${capture_dir}/events.log"
|
|
174
|
-
printf 'STATUS=FAILED\n'
|
|
175
|
-
exit 0
|
|
176
|
-
EOF
|
|
177
|
-
chmod +x "$bin_dir/reconcile-issue-worker.sh"
|
|
178
|
-
|
|
179
|
-
PATH="$shim_dir:$PATH" \
|
|
180
|
-
ACP_PROJECT_ID="demo" \
|
|
181
|
-
ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
|
|
182
|
-
TEST_CAPTURE_DIR="$capture_dir" \
|
|
183
|
-
bash "$bin_dir/start-resident-issue-loop.sh" 440 >/dev/null
|
|
184
|
-
|
|
185
|
-
grep -q '^START:440:1$' "$capture_dir/events.log"
|
|
186
|
-
grep -q '^RECONCILE:demo-issue-440:RUNNING$' "$capture_dir/events.log"
|
|
187
|
-
grep -q '^RECONCILE:demo-issue-440:FAILED$' "$capture_dir/events.log"
|
|
188
|
-
grep -q '^START:441:2$' "$capture_dir/events.log"
|
|
189
|
-
|
|
190
|
-
running_line="$(grep -n '^RECONCILE:demo-issue-440:RUNNING$' "$capture_dir/events.log" | cut -d: -f1)"
|
|
191
|
-
failed_line="$(grep -n '^RECONCILE:demo-issue-440:FAILED$' "$capture_dir/events.log" | cut -d: -f1)"
|
|
192
|
-
start_441_line="$(grep -n '^START:441:2$' "$capture_dir/events.log" | cut -d: -f1)"
|
|
193
|
-
|
|
194
|
-
[[ -n "${running_line}" && -n "${failed_line}" && -n "${start_441_line}" ]]
|
|
195
|
-
(( running_line < failed_line ))
|
|
196
|
-
(( failed_line < start_441_line ))
|
|
197
|
-
|
|
198
|
-
echo "start resident issue loop waits for terminal reconcile status test passed"
|
|
@@ -1,145 +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
|
-
cleanup() {
|
|
12
|
-
if [[ -n "${controller_pid:-}" ]]; then
|
|
13
|
-
kill "${controller_pid}" >/dev/null 2>&1 || true
|
|
14
|
-
wait "${controller_pid}" >/dev/null 2>&1 || true
|
|
15
|
-
fi
|
|
16
|
-
rm -rf "$tmpdir"
|
|
17
|
-
}
|
|
18
|
-
trap cleanup EXIT
|
|
19
|
-
|
|
20
|
-
skill_root="$tmpdir/skill"
|
|
21
|
-
bin_dir="$skill_root/tools/bin"
|
|
22
|
-
hooks_dir="$skill_root/hooks"
|
|
23
|
-
assets_dir="$skill_root/assets"
|
|
24
|
-
profile_registry_root="$tmpdir/profile-registry"
|
|
25
|
-
profile_dir="$profile_registry_root/demo"
|
|
26
|
-
shim_dir="$tmpdir/shim"
|
|
27
|
-
agent_root="$tmpdir/agent"
|
|
28
|
-
repo_root="$tmpdir/repo"
|
|
29
|
-
capture_dir="$tmpdir/capture"
|
|
30
|
-
lane_key="issue-lane-recurring-general-openclaw-safe"
|
|
31
|
-
|
|
32
|
-
mkdir -p "$bin_dir" "$hooks_dir" "$assets_dir" "$profile_dir" "$shim_dir" "$agent_root" "$repo_root" "$capture_dir"
|
|
33
|
-
cp "$REAL_LOOP" "$bin_dir/start-resident-issue-loop.sh"
|
|
34
|
-
cp "$REAL_CONFIG_LIB" "$bin_dir/flow-config-lib.sh"
|
|
35
|
-
cp "$REAL_SHELL_LIB" "$bin_dir/flow-shell-lib.sh"
|
|
36
|
-
cp "$REAL_RESIDENT_LIB" "$bin_dir/flow-resident-worker-lib.sh"
|
|
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: "$agent_root/state"
|
|
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
|
-
resident_workers:
|
|
61
|
-
issue_reuse_enabled: true
|
|
62
|
-
issue_controller_max_immediate_cycles: 2
|
|
63
|
-
controller_poll_seconds: 1
|
|
64
|
-
issue_controller_idle_timeout_seconds: 30
|
|
65
|
-
EOF
|
|
66
|
-
|
|
67
|
-
cat >"$hooks_dir/heartbeat-hooks.sh" <<'EOF'
|
|
68
|
-
#!/usr/bin/env bash
|
|
69
|
-
set -euo pipefail
|
|
70
|
-
heartbeat_open_agent_pr_issue_ids() { printf '[]\n'; }
|
|
71
|
-
heartbeat_issue_is_heavy() { printf 'no\n'; }
|
|
72
|
-
heartbeat_mark_issue_running() { :; }
|
|
73
|
-
heartbeat_issue_launch_failed() { :; }
|
|
74
|
-
EOF
|
|
75
|
-
chmod +x "$hooks_dir/heartbeat-hooks.sh"
|
|
76
|
-
|
|
77
|
-
cat >"$shim_dir/gh" <<'EOF'
|
|
78
|
-
#!/usr/bin/env bash
|
|
79
|
-
set -euo pipefail
|
|
80
|
-
|
|
81
|
-
if [[ "${1:-}" == "issue" && "${2:-}" == "view" ]]; then
|
|
82
|
-
issue_id="${3:-0}"
|
|
83
|
-
cat <<JSON
|
|
84
|
-
{"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":[]}
|
|
85
|
-
JSON
|
|
86
|
-
exit 0
|
|
87
|
-
fi
|
|
88
|
-
|
|
89
|
-
if [[ "${1:-}" == "pr" && "${2:-}" == "list" ]]; then
|
|
90
|
-
printf '[]\n'
|
|
91
|
-
exit 0
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
exit 64
|
|
95
|
-
EOF
|
|
96
|
-
chmod +x "$shim_dir/gh"
|
|
97
|
-
|
|
98
|
-
cat >"$shim_dir/tmux" <<'EOF'
|
|
99
|
-
#!/usr/bin/env bash
|
|
100
|
-
set -euo pipefail
|
|
101
|
-
exit 1
|
|
102
|
-
EOF
|
|
103
|
-
chmod +x "$shim_dir/tmux"
|
|
104
|
-
|
|
105
|
-
cat >"$bin_dir/start-issue-worker.sh" <<'EOF'
|
|
106
|
-
#!/usr/bin/env bash
|
|
107
|
-
set -euo pipefail
|
|
108
|
-
printf 'START:%s\n' "${1:?issue id required}" >>"${TEST_CAPTURE_DIR:?}/events.log"
|
|
109
|
-
exit 0
|
|
110
|
-
EOF
|
|
111
|
-
chmod +x "$bin_dir/start-issue-worker.sh"
|
|
112
|
-
|
|
113
|
-
cat >"$bin_dir/reconcile-issue-worker.sh" <<'EOF'
|
|
114
|
-
#!/usr/bin/env bash
|
|
115
|
-
set -euo pipefail
|
|
116
|
-
exit 0
|
|
117
|
-
EOF
|
|
118
|
-
chmod +x "$bin_dir/reconcile-issue-worker.sh"
|
|
119
|
-
|
|
120
|
-
mkdir -p "$agent_root/state/resident-workers/issues/440"
|
|
121
|
-
(sleep 30) &
|
|
122
|
-
controller_pid="$!"
|
|
123
|
-
cat >"$agent_root/state/resident-workers/issues/440/controller.env" <<EOF
|
|
124
|
-
ISSUE_ID=440
|
|
125
|
-
CONTROLLER_PID=${controller_pid}
|
|
126
|
-
CONTROLLER_STATE=waiting-worker
|
|
127
|
-
ACTIVE_RESIDENT_WORKER_KEY=${lane_key}
|
|
128
|
-
EOF
|
|
129
|
-
|
|
130
|
-
PATH="$shim_dir:$PATH" \
|
|
131
|
-
ACP_PROJECT_ID="demo" \
|
|
132
|
-
ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
|
|
133
|
-
TEST_CAPTURE_DIR="$capture_dir" \
|
|
134
|
-
bash "$bin_dir/start-resident-issue-loop.sh" 441 >/dev/null
|
|
135
|
-
|
|
136
|
-
test ! -f "$capture_dir/events.log"
|
|
137
|
-
queue_file="$agent_root/state/resident-workers/issue-queue/pending/issue-441.env"
|
|
138
|
-
controller_file="$agent_root/state/resident-workers/issues/441/controller.env"
|
|
139
|
-
|
|
140
|
-
test -f "$queue_file"
|
|
141
|
-
grep -q '^ISSUE_ID=441$' "$queue_file"
|
|
142
|
-
grep -q '^CONTROLLER_STATE=stopped$' "$controller_file"
|
|
143
|
-
grep -q '^CONTROLLER_REASON=live-lane-controller-440-waiting-worker$' "$controller_file"
|
|
144
|
-
|
|
145
|
-
echo "start resident issue loop yields to live lane controller test passed"
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
FLOW_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
5
|
-
SOURCE_SCRIPT="${FLOW_ROOT}/bin/sync-pr-labels.sh"
|
|
6
|
-
FLOW_CONFIG_LIB="${FLOW_ROOT}/tools/bin/flow-config-lib.sh"
|
|
7
|
-
FLOW_SHELL_LIB="${FLOW_ROOT}/tools/bin/flow-shell-lib.sh"
|
|
8
|
-
|
|
9
|
-
tmpdir="$(mktemp -d)"
|
|
10
|
-
trap 'rm -rf "$tmpdir"' EXIT
|
|
11
|
-
|
|
12
|
-
adapter_bin_dir="$tmpdir/bin"
|
|
13
|
-
tools_bin_dir="$tmpdir/tools/bin"
|
|
14
|
-
shim_bin_dir="$tmpdir/shims"
|
|
15
|
-
calls_log="$tmpdir/label-calls.log"
|
|
16
|
-
|
|
17
|
-
mkdir -p "$adapter_bin_dir" "$tools_bin_dir" "$shim_bin_dir"
|
|
18
|
-
cp "$SOURCE_SCRIPT" "$adapter_bin_dir/sync-pr-labels.sh"
|
|
19
|
-
cp "$FLOW_CONFIG_LIB" "$tools_bin_dir/flow-config-lib.sh"
|
|
20
|
-
cp "$FLOW_SHELL_LIB" "$tools_bin_dir/flow-shell-lib.sh"
|
|
21
|
-
|
|
22
|
-
cat >"$adapter_bin_dir/pr-risk.sh" <<'EOF'
|
|
23
|
-
#!/usr/bin/env bash
|
|
24
|
-
set -euo pipefail
|
|
25
|
-
cat <<'JSON'
|
|
26
|
-
{"isManagedByAgent":true,"agentLane":"fix","linkedIssueId":null,"isBlocked":false,"hasManualFixOverride":false,"eligibleForAutoMerge":false,"riskTier":"high","checksBypassed":false}
|
|
27
|
-
JSON
|
|
28
|
-
EOF
|
|
29
|
-
|
|
30
|
-
cat >"$tools_bin_dir/agent-github-update-labels" <<'EOF'
|
|
31
|
-
#!/usr/bin/env bash
|
|
32
|
-
set -euo pipefail
|
|
33
|
-
printf '%s\n' "$*" >>"${TEST_LABEL_CALLS_LOG:?}"
|
|
34
|
-
EOF
|
|
35
|
-
|
|
36
|
-
cat >"$shim_bin_dir/gh" <<'EOF'
|
|
37
|
-
#!/usr/bin/env bash
|
|
38
|
-
set -euo pipefail
|
|
39
|
-
case "${1:-}" in
|
|
40
|
-
label)
|
|
41
|
-
exit 0
|
|
42
|
-
;;
|
|
43
|
-
esac
|
|
44
|
-
echo "unexpected gh args: $*" >&2
|
|
45
|
-
exit 1
|
|
46
|
-
EOF
|
|
47
|
-
|
|
48
|
-
chmod +x \
|
|
49
|
-
"$adapter_bin_dir/pr-risk.sh" \
|
|
50
|
-
"$adapter_bin_dir/sync-pr-labels.sh" \
|
|
51
|
-
"$tools_bin_dir/flow-config-lib.sh" \
|
|
52
|
-
"$tools_bin_dir/flow-shell-lib.sh" \
|
|
53
|
-
"$tools_bin_dir/agent-github-update-labels" \
|
|
54
|
-
"$shim_bin_dir/gh"
|
|
55
|
-
|
|
56
|
-
TEST_LABEL_CALLS_LOG="$calls_log" \
|
|
57
|
-
PATH="$shim_bin_dir:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin" \
|
|
58
|
-
bash "$adapter_bin_dir/sync-pr-labels.sh" 601 >/dev/null
|
|
59
|
-
|
|
60
|
-
grep -q -- '--add agent-repair-queued' "$calls_log"
|
|
61
|
-
if grep -q -- '--add agent-fix-needed' "$calls_log"; then
|
|
62
|
-
echo "sync-pr-labels unexpectedly re-added the manual override label for fix lane" >&2
|
|
63
|
-
cat "$calls_log" >&2
|
|
64
|
-
exit 1
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
echo "sync-pr-labels fix lane uses repair queued test passed"
|
package/tools/tests/test-sync-recurring-issue-checklist-backfills-workflow-complete-blocker.sh
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
FLOW_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
5
|
-
SCRIPT="${FLOW_ROOT}/tools/bin/sync-recurring-issue-checklist.sh"
|
|
6
|
-
|
|
7
|
-
tmpdir="$(mktemp -d)"
|
|
8
|
-
trap 'rm -rf "$tmpdir"' EXIT
|
|
9
|
-
|
|
10
|
-
bin_dir="$tmpdir/bin"
|
|
11
|
-
mkdir -p "$bin_dir"
|
|
12
|
-
|
|
13
|
-
cat >"$bin_dir/gh" <<'EOF'
|
|
14
|
-
#!/usr/bin/env bash
|
|
15
|
-
set -euo pipefail
|
|
16
|
-
|
|
17
|
-
capture_file="${TEST_CAPTURE_FILE:?}"
|
|
18
|
-
|
|
19
|
-
if [[ "${1:-}" == "issue" && "${2:-}" == "view" ]]; then
|
|
20
|
-
cat <<'JSON'
|
|
21
|
-
{"number":6,"state":"OPEN","title":"Recurring checklist demo","body":"Rolling summary metric improvements\n\nChecklist:\n- [x] Add an `overdueCount` field to the summary output.\n- [x] Add a helper that returns only tasks due within one day.\n- [ ] Expose `blockedCount` directly from the summary output.\n","url":"https://example.test/issues/6","labels":[{"name":"agent-keep-open"}],"comments":[{"body":"# Blocker: All checklist items already completed\n\nAll three checklist items for issue #6 are satisfied on the current baseline.","createdAt":"2026-03-28T17:39:37Z"}],"createdAt":"2026-03-28T10:00:00Z","updatedAt":"2026-03-28T17:39:37Z"}
|
|
22
|
-
JSON
|
|
23
|
-
exit 0
|
|
24
|
-
fi
|
|
25
|
-
|
|
26
|
-
if [[ "${1:-}" == "pr" && "${2:-}" == "view" ]]; then
|
|
27
|
-
exit 1
|
|
28
|
-
fi
|
|
29
|
-
|
|
30
|
-
if [[ "${1:-}" == "api" ]]; then
|
|
31
|
-
route="${2:-}"
|
|
32
|
-
shift 2
|
|
33
|
-
if [[ "${route}" == "repos/example/demo/issues/6" ]]; then
|
|
34
|
-
input_file=""
|
|
35
|
-
while [[ $# -gt 0 ]]; do
|
|
36
|
-
case "$1" in
|
|
37
|
-
--input)
|
|
38
|
-
input_file="${2:-}"
|
|
39
|
-
shift 2
|
|
40
|
-
;;
|
|
41
|
-
*)
|
|
42
|
-
shift
|
|
43
|
-
;;
|
|
44
|
-
esac
|
|
45
|
-
done
|
|
46
|
-
if [[ -n "${input_file}" && -f "${input_file}" ]]; then
|
|
47
|
-
cp "${input_file}" "${capture_file}"
|
|
48
|
-
else
|
|
49
|
-
cat >"${capture_file}"
|
|
50
|
-
fi
|
|
51
|
-
exit 0
|
|
52
|
-
fi
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
echo "unexpected gh args: $*" >&2
|
|
56
|
-
exit 1
|
|
57
|
-
EOF
|
|
58
|
-
chmod +x "$bin_dir/gh"
|
|
59
|
-
|
|
60
|
-
TEST_CAPTURE_FILE="$tmpdir/update.txt" \
|
|
61
|
-
PATH="$bin_dir:$PATH" \
|
|
62
|
-
bash "$SCRIPT" --repo-slug example/demo --issue-id 6 >"$tmpdir/out.txt"
|
|
63
|
-
|
|
64
|
-
grep -q '^CHECKLIST_SYNC_STATUS=updated$' "$tmpdir/out.txt"
|
|
65
|
-
grep -q '^CHECKLIST_TOTAL=3$' "$tmpdir/out.txt"
|
|
66
|
-
grep -q '^CHECKLIST_CHECKED=3$' "$tmpdir/out.txt"
|
|
67
|
-
grep -q '^CHECKLIST_UNCHECKED=0$' "$tmpdir/out.txt"
|
|
68
|
-
jq -r '.body' "$tmpdir/update.txt" | grep -q -- '- \[x\] Expose `blockedCount` directly from the summary output\.'
|
|
69
|
-
|
|
70
|
-
echo "sync recurring issue checklist workflow blocker backfill test passed"
|