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.
Files changed (184) hide show
  1. package/README.md +6 -0
  2. package/npm/bin/agent-control-plane.js +149 -5
  3. package/package.json +2 -3
  4. package/tools/vendor/codex-quota/README.md +8 -16
  5. package/tools/vendor/codex-quota/lib/claude-accounts.js +2 -68
  6. package/tools/vendor/codex-quota/lib/claude-usage.js +76 -667
  7. package/tools/vendor/codex-quota/lib/display.js +6 -14
  8. package/tools/vendor/codex-quota/lib/handlers.js +32 -117
  9. package/tools/vendor/codex-quota/lib/sync.js +9 -14
  10. package/tools/tests/test-agent-control-plane-npm-cli.sh +0 -280
  11. package/tools/tests/test-agent-github-update-labels-falls-back-to-repository-id.sh +0 -56
  12. package/tools/tests/test-agent-project-claude-session-wrapper-clears-stale-sandbox-artifacts.sh +0 -89
  13. package/tools/tests/test-agent-project-claude-session-wrapper-does-not-retry-provider-quota.sh +0 -82
  14. package/tools/tests/test-agent-project-claude-session-wrapper-retries-transient-failures.sh +0 -90
  15. package/tools/tests/test-agent-project-claude-session-wrapper-times-out.sh +0 -73
  16. package/tools/tests/test-agent-project-claude-session-wrapper.sh +0 -103
  17. package/tools/tests/test-agent-project-cleanup-session-orphan-fallback.sh +0 -90
  18. package/tools/tests/test-agent-project-cleanup-session-skip-worktree-cleanup.sh +0 -90
  19. package/tools/tests/test-agent-project-codex-live-thread-persist.sh +0 -76
  20. package/tools/tests/test-agent-project-codex-recovery.sh +0 -731
  21. package/tools/tests/test-agent-project-codex-session-wrapper-clears-stale-sandbox-artifacts.sh +0 -105
  22. package/tools/tests/test-agent-project-codex-session-wrapper.sh +0 -97
  23. package/tools/tests/test-agent-project-open-pr-worktree-config-prefix.sh +0 -81
  24. package/tools/tests/test-agent-project-openclaw-session-wrapper-clears-stale-sandbox-artifacts.sh +0 -109
  25. package/tools/tests/test-agent-project-openclaw-session-wrapper-infers-blocked-result-contract.sh +0 -89
  26. package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-literal-env-artifacts.sh +0 -113
  27. package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-version-mismatch.sh +0 -135
  28. package/tools/tests/test-agent-project-openclaw-session-wrapper-resident.sh +0 -179
  29. package/tools/tests/test-agent-project-openclaw-session-wrapper-reuses-existing-agent-after-add-race.sh +0 -119
  30. package/tools/tests/test-agent-project-openclaw-session-wrapper-terminates-rate-limit-hang.sh +0 -91
  31. package/tools/tests/test-agent-project-openclaw-session-wrapper.sh +0 -117
  32. package/tools/tests/test-agent-project-publish-issue-pr-prunes-stale-worktree-entry.sh +0 -148
  33. package/tools/tests/test-agent-project-publish-issue-pr-reads-archived-session.sh +0 -146
  34. package/tools/tests/test-agent-project-publish-issue-pr-recovers-final-head.sh +0 -145
  35. package/tools/tests/test-agent-project-publish-issue-pr-reuses-existing-worktree.sh +0 -147
  36. package/tools/tests/test-agent-project-reconcile-failure-reason.sh +0 -456
  37. package/tools/tests/test-agent-project-reconcile-issue-archived-session-fallback.sh +0 -96
  38. package/tools/tests/test-agent-project-reconcile-issue-before-blocked.sh +0 -90
  39. package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery-uses-recovered-worktree.sh +0 -212
  40. package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery.sh +0 -207
  41. package/tools/tests/test-agent-project-reconcile-issue-provider-quota-schedules-provider-cooldown.sh +0 -101
  42. package/tools/tests/test-agent-project-reconcile-issue-session-backfills-lane-metadata-from-worker-key.sh +0 -113
  43. package/tools/tests/test-agent-project-reconcile-issue-session-clears-stale-failed-summary.sh +0 -117
  44. package/tools/tests/test-agent-project-reconcile-issue-session-initializes-shared-agent-home.sh +0 -55
  45. package/tools/tests/test-agent-project-reconcile-issue-session-normalizes-runner-state.sh +0 -125
  46. package/tools/tests/test-agent-project-reconcile-issue-session-records-invalid-contract-summary.sh +0 -118
  47. package/tools/tests/test-agent-project-reconcile-issue-session-skips-duplicate-blocked-comment.sh +0 -144
  48. package/tools/tests/test-agent-project-reconcile-issue-session-standardizes-no-commits-blocker.sh +0 -145
  49. package/tools/tests/test-agent-project-reconcile-issue-session-synthesizes-blocked-comment.sh +0 -139
  50. package/tools/tests/test-agent-project-reconcile-pr-blocked-host-recovery.sh +0 -242
  51. package/tools/tests/test-agent-project-reconcile-pr-guard-blocked-no-commit.sh +0 -142
  52. package/tools/tests/test-agent-project-reconcile-pr-provider-quota-schedules-provider-cooldown.sh +0 -106
  53. package/tools/tests/test-agent-project-reconcile-pr-session-initializes-shared-agent-home.sh +0 -66
  54. package/tools/tests/test-agent-project-reconcile-pr-updated-branch-noop.sh +0 -129
  55. package/tools/tests/test-audit-agent-worktrees-active-launch-skips-git-inspection.sh +0 -69
  56. package/tools/tests/test-audit-agent-worktrees-broken-worktree.sh +0 -43
  57. package/tools/tests/test-audit-agent-worktrees-pending-launch-owner.sh +0 -46
  58. package/tools/tests/test-audit-agent-worktrees-unreconciled-owner.sh +0 -79
  59. package/tools/tests/test-audit-issue-routing-managed-branch-globs.sh +0 -56
  60. package/tools/tests/test-branch-verification-guard-generated-artifacts.sh +0 -72
  61. package/tools/tests/test-branch-verification-guard-targeted-coverage.sh +0 -125
  62. package/tools/tests/test-codex-quota-manager-failure-driven-rotation.sh +0 -178
  63. package/tools/tests/test-codex-quota-wrapper.sh +0 -37
  64. package/tools/tests/test-contribution-docs.sh +0 -18
  65. package/tools/tests/test-control-plane-dashboard-runtime-smoke.sh +0 -343
  66. package/tools/tests/test-create-follow-up-issue.sh +0 -73
  67. package/tools/tests/test-dashboard-launchd-bootstrap.sh +0 -55
  68. package/tools/tests/test-flow-export-execution-env-exports-repo-id.sh +0 -30
  69. package/tools/tests/test-flow-export-github-cli-auth-env-prefers-git-credential.sh +0 -48
  70. package/tools/tests/test-flow-github-api-repo-fallback-preserves-input.sh +0 -85
  71. package/tools/tests/test-flow-github-api-repo-prefers-explicit-repository-id.sh +0 -60
  72. package/tools/tests/test-flow-github-issue-list-falls-back-to-repository-id.sh +0 -64
  73. package/tools/tests/test-flow-github-pr-list-falls-back-to-repository-id.sh +0 -77
  74. package/tools/tests/test-flow-resident-can-reuse-does-not-leak-metadata.sh +0 -52
  75. package/tools/tests/test-flow-resident-reap-stale-controllers.sh +0 -63
  76. package/tools/tests/test-flow-resolve-codex-quota-tools.sh +0 -104
  77. package/tools/tests/test-flow-runtime-doctor-profile-selection.sh +0 -27
  78. package/tools/tests/test-heartbeat-codex-pr-linked-issue-exclusion.sh +0 -79
  79. package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-idle-controller.sh +0 -115
  80. package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-live-lane-controller.sh +0 -117
  81. package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-claude.sh +0 -96
  82. package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-codex.sh +0 -96
  83. package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop.sh +0 -96
  84. package/tools/tests/test-heartbeat-loop-auth-wait-does-not-consume-capacity.sh +0 -170
  85. package/tools/tests/test-heartbeat-loop-blocked-recovery-lane.sh +0 -201
  86. package/tools/tests/test-heartbeat-loop-blocked-recovery-vs-pr-reservation.sh +0 -201
  87. package/tools/tests/test-heartbeat-loop-idle-resident-controller-does-not-block-launches.sh +0 -160
  88. package/tools/tests/test-heartbeat-loop-pr-launch-dedup.sh +0 -133
  89. package/tools/tests/test-heartbeat-loop-provider-cooldown-suppresses-launches.sh +0 -157
  90. package/tools/tests/test-heartbeat-loop-reaps-stale-resident-controller.sh +0 -181
  91. package/tools/tests/test-heartbeat-loop-waiting-provider-resident-controller-does-not-block-launches.sh +0 -160
  92. package/tools/tests/test-heartbeat-ready-issues-blocked-recovery.sh +0 -134
  93. package/tools/tests/test-heartbeat-safe-auto-dynamic-concurrency.sh +0 -162
  94. package/tools/tests/test-heartbeat-safe-auto-no-tmux-sessions.sh +0 -136
  95. package/tools/tests/test-heartbeat-safe-auto-openclaw-skips-codex-quota.sh +0 -139
  96. package/tools/tests/test-heartbeat-safe-auto-quota-health-signal.sh +0 -119
  97. package/tools/tests/test-heartbeat-safe-auto-stale-shared-loop-pid-does-not-skip.sh +0 -140
  98. package/tools/tests/test-heartbeat-safe-auto-static-capacity-without-quota-cache.sh +0 -142
  99. package/tools/tests/test-heartbeat-safe-auto-zero-healthy-pools.sh +0 -141
  100. package/tools/tests/test-heartbeat-sync-issue-labels-empty-schedule.sh +0 -65
  101. package/tools/tests/test-heartbeat-sync-open-agent-prs-terminal-clears-running.sh +0 -179
  102. package/tools/tests/test-install-dashboard-launchd.sh +0 -78
  103. package/tools/tests/test-install-project-launchd-adds-tool-paths.sh +0 -87
  104. package/tools/tests/test-install-project-launchd.sh +0 -110
  105. package/tools/tests/test-issue-local-workspace-install-policy.sh +0 -81
  106. package/tools/tests/test-issue-publish-scope-guard-docs-signal.sh +0 -70
  107. package/tools/tests/test-issue-reconcile-hooks-success-clears-blocked.sh +0 -36
  108. package/tools/tests/test-kick-scheduler-requires-explicit-profile.sh +0 -47
  109. package/tools/tests/test-label-follow-up-issues-falls-back-to-repository-id.sh +0 -132
  110. package/tools/tests/test-manual-operator-entrypoints-require-explicit-profile.sh +0 -64
  111. package/tools/tests/test-package-funding-metadata.sh +0 -21
  112. package/tools/tests/test-package-public-metadata.sh +0 -62
  113. package/tools/tests/test-placeholder-worker-adapters.sh +0 -38
  114. package/tools/tests/test-pr-reconcile-hooks-refreshes-recurring-issue-checklist.sh +0 -110
  115. package/tools/tests/test-pr-risk-cohesive-mobile-locale-scope.sh +0 -70
  116. package/tools/tests/test-pr-risk-fix-label-semantics.sh +0 -114
  117. package/tools/tests/test-pr-risk-local-first-no-checks.sh +0 -70
  118. package/tools/tests/test-prepare-worktree-simple-repo-baseline.sh +0 -67
  119. package/tools/tests/test-profile-activate.sh +0 -33
  120. package/tools/tests/test-profile-adopt-allow-missing-repo.sh +0 -68
  121. package/tools/tests/test-profile-adopt-skip-workspace-sync-missing-file.sh +0 -61
  122. package/tools/tests/test-profile-adopt-syncs-anchor-and-workspace.sh +0 -90
  123. package/tools/tests/test-profile-smoke-collision.sh +0 -44
  124. package/tools/tests/test-profile-smoke-invalid-claude-config.sh +0 -31
  125. package/tools/tests/test-profile-smoke-invalid-provider-pool.sh +0 -68
  126. package/tools/tests/test-profile-smoke-repo-slug-mismatch.sh +0 -36
  127. package/tools/tests/test-profile-smoke.sh +0 -45
  128. package/tools/tests/test-project-init-force-and-skip-sync.sh +0 -61
  129. package/tools/tests/test-project-init-repo-slug-mismatch.sh +0 -29
  130. package/tools/tests/test-project-init.sh +0 -66
  131. package/tools/tests/test-project-launchd-bootstrap.sh +0 -66
  132. package/tools/tests/test-project-remove.sh +0 -150
  133. package/tools/tests/test-project-runtime-supervisor.sh +0 -47
  134. package/tools/tests/test-project-runtimectl-launchd.sh +0 -115
  135. package/tools/tests/test-project-runtimectl-missing-profile.sh +0 -54
  136. package/tools/tests/test-project-runtimectl-start-falls-back-to-bootstrap.sh +0 -108
  137. package/tools/tests/test-project-runtimectl-status-reports-supervisor-as-heartbeat-parent.sh +0 -95
  138. package/tools/tests/test-project-runtimectl-status-supervisor-running.sh +0 -59
  139. package/tools/tests/test-project-runtimectl-stop-cancels-pending-kick.sh +0 -85
  140. package/tools/tests/test-project-runtimectl-stop-clears-running-labels.sh +0 -78
  141. package/tools/tests/test-project-runtimectl.sh +0 -212
  142. package/tools/tests/test-provider-cooldown-state-prefers-runtime-worker-context.sh +0 -39
  143. package/tools/tests/test-provider-cooldown-state.sh +0 -59
  144. package/tools/tests/test-public-repo-docs.sh +0 -160
  145. package/tools/tests/test-reconcile-pr-worker-acp-config-routing.sh +0 -75
  146. package/tools/tests/test-render-dashboard-snapshot.sh +0 -149
  147. package/tools/tests/test-render-flow-config-demo-profile.sh +0 -36
  148. package/tools/tests/test-render-flow-config-provider-pool-fallback.sh +0 -81
  149. package/tools/tests/test-render-flow-config.sh +0 -52
  150. package/tools/tests/test-run-codex-task-claude-routing.sh +0 -125
  151. package/tools/tests/test-run-codex-task-codex-resident-routing.sh +0 -108
  152. package/tools/tests/test-run-codex-task-kilo-routing.sh +0 -98
  153. package/tools/tests/test-run-codex-task-openclaw-resident-routing.sh +0 -117
  154. package/tools/tests/test-run-codex-task-openclaw-routing.sh +0 -113
  155. package/tools/tests/test-run-codex-task-opencode-routing.sh +0 -98
  156. package/tools/tests/test-run-codex-task-provider-pool-fallback-routing.sh +0 -146
  157. package/tools/tests/test-scaffold-profile.sh +0 -108
  158. package/tools/tests/test-serve-dashboard.sh +0 -93
  159. package/tools/tests/test-start-issue-worker-blocked-context.sh +0 -129
  160. package/tools/tests/test-start-issue-worker-blocks-complete-recurring-checklist.sh +0 -189
  161. package/tools/tests/test-start-issue-worker-local-install-routing.sh +0 -157
  162. package/tools/tests/test-start-issue-worker-profile-template-routing.sh +0 -149
  163. package/tools/tests/test-start-issue-worker-recurring-resident-reuse-codex.sh +0 -212
  164. package/tools/tests/test-start-issue-worker-recurring-resident-reuse.sh +0 -219
  165. package/tools/tests/test-start-issue-worker-renders-verification-snippet.sh +0 -155
  166. package/tools/tests/test-start-issue-worker-resident-reuse-falls-back-to-new-worktree.sh +0 -199
  167. package/tools/tests/test-start-pr-fix-worker-host-blocker-context.sh +0 -275
  168. package/tools/tests/test-start-resident-issue-loop-adopts-next-recurring-issue.sh +0 -185
  169. package/tools/tests/test-start-resident-issue-loop-clears-pending-while-waiting-due.sh +0 -152
  170. package/tools/tests/test-start-resident-issue-loop-consumes-queued-lease.sh +0 -186
  171. package/tools/tests/test-start-resident-issue-loop-fails-over-provider-pool.sh +0 -212
  172. package/tools/tests/test-start-resident-issue-loop-immediate-cycles.sh +0 -148
  173. package/tools/tests/test-start-resident-issue-loop-waits-for-provider.sh +0 -194
  174. package/tools/tests/test-start-resident-issue-loop-waits-for-terminal-reconcile-status.sh +0 -198
  175. package/tools/tests/test-start-resident-issue-loop-yields-to-live-lane-controller.sh +0 -145
  176. package/tools/tests/test-sync-pr-labels-fix-lane-uses-repair-queued.sh +0 -67
  177. package/tools/tests/test-sync-recurring-issue-checklist-backfills-workflow-complete-blocker.sh +0 -70
  178. package/tools/tests/test-sync-recurring-issue-checklist.sh +0 -95
  179. package/tools/tests/test-sync-shared-agent-home-local-source-root.sh +0 -66
  180. package/tools/tests/test-sync-shared-agent-home-preserves-unrelated-workflow-catalog-skill.sh +0 -47
  181. package/tools/tests/test-test-smoke.sh +0 -86
  182. package/tools/tests/test-uninstall-project-launchd.sh +0 -37
  183. package/tools/tests/test-update-github-labels-prefers-sibling-helper.sh +0 -49
  184. package/tools/tests/test-workflow-catalog.sh +0 -43
@@ -1,275 +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}/tools/bin/start-pr-fix-worker.sh"
6
- SOURCE_TEMPLATE="${FLOW_ROOT}/tools/templates/pr-fix-template.md"
7
- SOURCE_CONFIG_LIB="${FLOW_ROOT}/tools/bin/flow-config-lib.sh"
8
- SOURCE_SHELL_LIB="${FLOW_ROOT}/tools/bin/flow-shell-lib.sh"
9
-
10
- tmpdir="$(mktemp -d)"
11
- trap 'rm -rf "$tmpdir"' EXIT
12
-
13
- workspace_root="$tmpdir/workspace/tools"
14
- bin_dir="$workspace_root/bin"
15
- template_dir="$workspace_root/templates"
16
- assets_dir="$workspace_root/assets"
17
- profile_registry_root="$tmpdir/profile-registry"
18
- profile_dir="$profile_registry_root/alpha"
19
- shim_bin_dir="$tmpdir/shims"
20
- agent_root="$tmpdir/agent-root"
21
- history_root="$agent_root/history"
22
- runs_root="$agent_root/runs"
23
- repo_root="$tmpdir/repo-root"
24
- worktree_root="$tmpdir/worktree"
25
- origin_repo="$tmpdir/origin.git"
26
- node_bin_dir="$(dirname "$(command -v node)")"
27
-
28
- mkdir -p "$bin_dir" "$template_dir" "$assets_dir" "$profile_dir" "$shim_bin_dir" "$history_root" "$runs_root" "$repo_root" "$worktree_root"
29
-
30
- cp "$SOURCE_SCRIPT" "$bin_dir/start-pr-fix-worker.sh"
31
- cp "$SOURCE_CONFIG_LIB" "$bin_dir/flow-config-lib.sh"
32
- cp "$SOURCE_SHELL_LIB" "$bin_dir/flow-shell-lib.sh"
33
- cp "$SOURCE_TEMPLATE" "$template_dir/pr-fix-template.md"
34
- printf '{}\n' >"$assets_dir/workflow-catalog.json"
35
-
36
- cat >"$profile_dir/control-plane.yaml" <<EOF
37
- schema_version: "1"
38
- id: "alpha"
39
- repo:
40
- slug: "example/repo"
41
- root: "$repo_root"
42
- default_branch: "main"
43
- runtime:
44
- orchestrator_agent_root: "$agent_root"
45
- worktree_root: "$worktree_root"
46
- agent_repo_root: "$repo_root"
47
- runs_root: "$runs_root"
48
- state_root: "$agent_root/state"
49
- retained_repo_root: "$repo_root"
50
- vscode_workspace_file: "$tmpdir/alpha.code-workspace"
51
- session_naming:
52
- issue_prefix: "fl-issue-"
53
- pr_prefix: "fl-pr-"
54
- issue_branch_prefix: "agent/alpha/issue"
55
- pr_worktree_branch_prefix: "agent/alpha/pr"
56
- managed_pr_branch_globs: "agent/alpha/* codex/* openclaw/*"
57
- execution:
58
- coding_worker: "codex"
59
- safe_profile: "mock-safe"
60
- bypass_profile: "mock-bypass"
61
- openclaw:
62
- model: "openrouter/stepfun/step-3.5-flash:free"
63
- thinking: "minimal"
64
- timeout_seconds: 600
65
- verification:
66
- web_playwright_command: "pnpm exec playwright test"
67
- review_requires_independent_final_review: true
68
- EOF
69
-
70
- cat >"$bin_dir/new-pr-worktree.sh" <<EOF
71
- #!/usr/bin/env bash
72
- set -euo pipefail
73
- printf 'WORKTREE=%s\n' "$worktree_root"
74
- EOF
75
-
76
- cat >"$bin_dir/run-codex-safe.sh" <<'EOF'
77
- #!/usr/bin/env bash
78
- set -euo pipefail
79
- printf 'RUNNER=stub\n'
80
- EOF
81
-
82
- cat >"$bin_dir/run-codex-bypass.sh" <<'EOF'
83
- #!/usr/bin/env bash
84
- set -euo pipefail
85
- printf 'RUNNER=stub\n'
86
- EOF
87
-
88
- cat >"$bin_dir/pr-risk.sh" <<'EOF'
89
- #!/usr/bin/env bash
90
- set -euo pipefail
91
- cat <<'JSON'
92
- {"risk":"high","riskReason":"paths-outside-low-risk-allowlist:apps/api/src/modules/auth/auth.service.ts","linkedIssueId":415,"files":["apps/api/src/modules/auth/auth.service.extended.spec.ts","apps/api/src/modules/auth/auth.service.ts","apps/web/e2e/archive/auth/tenant-isolation-login.spec.ts","apps/web/src/app/(auth)/login/page.spec.tsx","apps/web/src/app/(auth)/login/page.tsx"],"checkFailures":[],"pendingChecks":[],"missingReasons":["agent-status-blocker-present"]}
93
- JSON
94
- EOF
95
-
96
- cat >"$bin_dir/agent-github-update-labels" <<'EOF'
97
- #!/usr/bin/env bash
98
- set -euo pipefail
99
- exit 0
100
- EOF
101
-
102
- cat >"$shim_bin_dir/gh" <<'EOF'
103
- #!/usr/bin/env bash
104
- set -euo pipefail
105
-
106
- if [[ "${1:-}" == "pr" && "${2:-}" == "view" ]]; then
107
- cat <<'JSON'
108
- {"number":601,"title":"fix(auth): carry host verification blocker into prompt","body":"Closes #415","url":"https://example.test/pr/601","headRefName":"agent/alpha/issue-415-host-blocker-context","baseRefName":"main","mergeStateStatus":"CLEAN","statusCheckRollup":[],"labels":[{"name":"agent-repair-queued"}],"comments":[]}
109
- JSON
110
- exit 0
111
- fi
112
-
113
- if [[ "${1:-}" == "api" ]]; then
114
- case "${2:-}" in
115
- repos/example/repo/pulls/601)
116
- cat <<'JSON'
117
- {"head":{"sha":"sha601"},"mergeable":true}
118
- JSON
119
- exit 0
120
- ;;
121
- repos/example/repo/pulls/601/comments)
122
- printf '[]\n'
123
- exit 0
124
- ;;
125
- repos/example/repo/issues/601/comments)
126
- printf '[]\n'
127
- exit 0
128
- ;;
129
- esac
130
- fi
131
-
132
- echo "unexpected gh args: $*" >&2
133
- exit 1
134
- EOF
135
-
136
- cat >"$shim_bin_dir/tmux" <<'EOF'
137
- #!/usr/bin/env bash
138
- set -euo pipefail
139
- if [[ "${1:-}" == "has-session" ]]; then
140
- exit 1
141
- fi
142
- exit 0
143
- EOF
144
-
145
- chmod +x \
146
- "$bin_dir/start-pr-fix-worker.sh" \
147
- "$bin_dir/flow-config-lib.sh" \
148
- "$bin_dir/flow-shell-lib.sh" \
149
- "$bin_dir/new-pr-worktree.sh" \
150
- "$bin_dir/run-codex-safe.sh" \
151
- "$bin_dir/run-codex-bypass.sh" \
152
- "$bin_dir/pr-risk.sh" \
153
- "$bin_dir/agent-github-update-labels" \
154
- "$shim_bin_dir/gh" \
155
- "$shim_bin_dir/tmux"
156
-
157
- git init --bare "$origin_repo" >/dev/null 2>&1
158
- git clone "$origin_repo" "$worktree_root" >/dev/null 2>&1
159
-
160
- mkdir -p \
161
- "$worktree_root/apps/api/src/modules/auth" \
162
- "$worktree_root/apps/web/e2e/archive/auth" \
163
- "$worktree_root/apps/web/src/app/(auth)/login"
164
-
165
- cat >"$worktree_root/apps/api/src/modules/auth/auth.service.ts" <<'EOF'
166
- export const loginFailureMode = 'legacy';
167
- EOF
168
-
169
- cat >"$worktree_root/apps/api/src/modules/auth/auth.service.extended.spec.ts" <<'EOF'
170
- describe('auth service', () => {
171
- it('handles login failures', () => {
172
- expect(true).toBe(true)
173
- })
174
- })
175
- EOF
176
-
177
- cat >"$worktree_root/apps/web/src/app/(auth)/login/page.tsx" <<'EOF'
178
- export default function LoginPage() {
179
- return null
180
- }
181
- EOF
182
-
183
- cat >"$worktree_root/apps/web/src/app/(auth)/login/page.spec.tsx" <<'EOF'
184
- describe('login page', () => {
185
- it('renders', () => {
186
- expect(true).toBe(true)
187
- })
188
- })
189
- EOF
190
-
191
- cat >"$worktree_root/apps/web/e2e/archive/auth/tenant-isolation-login.spec.ts" <<'EOF'
192
- test('tenant isolation login', async () => {
193
- expect(true).toBeTruthy()
194
- })
195
- EOF
196
-
197
- git -C "$worktree_root" add .
198
- git -C "$worktree_root" -c user.name=Test -c user.email=test@example.com commit -m "init" >/dev/null
199
- git -C "$worktree_root" branch -M main >/dev/null 2>&1
200
- git -C "$worktree_root" push origin main >/dev/null 2>&1
201
- git -C "$worktree_root" checkout -b agent/alpha/issue-415-host-blocker-context >/dev/null 2>&1
202
-
203
- cat >"$worktree_root/apps/api/src/modules/auth/auth.service.ts" <<'EOF'
204
- export const loginFailureMode = 'generic-invalid-credentials';
205
- EOF
206
-
207
- cat >"$worktree_root/apps/api/src/modules/auth/auth.service.extended.spec.ts" <<'EOF'
208
- describe('auth service', () => {
209
- it('normalizes tenant login failures', () => {
210
- expect(true).toBe(true)
211
- })
212
- })
213
- EOF
214
-
215
- cat >"$worktree_root/apps/web/src/app/(auth)/login/page.tsx" <<'EOF'
216
- export default function LoginPage() {
217
- return 'Invalid credentials'
218
- }
219
- EOF
220
-
221
- cat >"$worktree_root/apps/web/src/app/(auth)/login/page.spec.tsx" <<'EOF'
222
- describe('login page', () => {
223
- it('shows the generic invalid credentials message', () => {
224
- expect(true).toBe(true)
225
- })
226
- })
227
- EOF
228
-
229
- cat >"$worktree_root/apps/web/e2e/archive/auth/tenant-isolation-login.spec.ts" <<'EOF'
230
- test('tenant isolation login hides tenant existence', async () => {
231
- expect(true).toBeTruthy()
232
- })
233
- EOF
234
-
235
- git -C "$worktree_root" add .
236
- git -C "$worktree_root" -c user.name=Test -c user.email=test@example.com commit -m "pr changes" >/dev/null
237
-
238
- mkdir -p "$history_root/fl-pr-601-20260316-000001"
239
- cat >"$history_root/fl-pr-601-20260316-000001/host-blocker.md" <<'EOF'
240
- Verification guard blocked branch publication.
241
-
242
- Why it was blocked:
243
- - missing API typecheck or repo typecheck for API changes
244
- - missing Web verification command for web changes
245
- EOF
246
-
247
- worker_output="$(
248
- PATH="$shim_bin_dir:$node_bin_dir:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin" \
249
- ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
250
- ACP_PROJECT_ID="alpha" \
251
- ACP_PR_SESSION_PREFIX="fl-pr-" \
252
- F_LOSNING_PR_SESSION_PREFIX="fl-pr-" \
253
- F_LOSNING_AGENT_ROOT="$agent_root" \
254
- F_LOSNING_REPO_SLUG="example/repo" \
255
- F_LOSNING_REPO_ROOT="$repo_root" \
256
- F_LOSNING_DEPENDENCY_SOURCE_ROOT="$repo_root" \
257
- bash "$bin_dir/start-pr-fix-worker.sh" 601 safe fix
258
- )"
259
-
260
- prompt_file="$(awk -F= '/^PROMPT=/{print $2}' <<<"$worker_output")"
261
- test -n "$prompt_file"
262
- test -f "$prompt_file"
263
-
264
- grep -Fq 'Current host-side publish blocker summary:' "$prompt_file"
265
- grep -Fq 'Verification guard blocked branch publication.' "$prompt_file"
266
- grep -Fq 'missing API typecheck or repo typecheck for API changes' "$prompt_file"
267
- grep -Fq 'Required targeted verification coverage before `updated-branch`:' "$prompt_file"
268
- grep -Fq 'apps/api/src/modules/auth/auth.service.extended.spec.ts' "$prompt_file"
269
- grep -Fq 'apps/web/e2e/archive/auth/tenant-isolation-login.spec.ts' "$prompt_file"
270
- grep -Fq 'Pre-approved local verification fallbacks:' "$prompt_file"
271
- grep -Fq 'loopback retry command:' "$prompt_file"
272
- grep -Fq 'playwright test e2e/archive/auth/tenant-isolation-login.spec.ts --project=chromium' "$prompt_file"
273
- grep -Fq 'Do not ask the user for clarification, approval, or a next-step choice from inside the worker.' "$prompt_file"
274
-
275
- echo "start-pr-fix-worker host blocker context test passed"
@@ -1,185 +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
- 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
- PATH="$shim_dir:$PATH" \
161
- ACP_PROJECT_ID="demo" \
162
- ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
163
- TEST_CAPTURE_DIR="$capture_dir" \
164
- bash "$bin_dir/start-resident-issue-loop.sh" 440 >/dev/null
165
-
166
- controller_dir="$agent_root/state/resident-workers/issues"
167
- controller_file_441="$controller_dir/441/controller.env"
168
-
169
- grep -q '^2$' "$capture_dir/start-count.txt"
170
- grep -q '^RUNNING:440:no$' "$capture_dir/events.log"
171
- grep -q '^START:440:1$' "$capture_dir/events.log"
172
- grep -q '^RECONCILE:demo-issue-440$' "$capture_dir/events.log"
173
- grep -q '^RUNNING:441:no$' "$capture_dir/events.log"
174
- grep -q '^START:441:2$' "$capture_dir/events.log"
175
- grep -q '^RECONCILE:demo-issue-441$' "$capture_dir/events.log"
176
- test ! -f "$controller_dir/440/controller.env"
177
- test -f "$controller_file_441"
178
- grep -q '^ISSUE_ID=441$' "$controller_file_441"
179
- grep -q '^CONTROLLER_LOOP_COUNT=1$' "$controller_file_441"
180
- grep -q '^CONTROLLER_REASON=idle-timeout$' "$controller_file_441"
181
- grep -q '^CONTROLLER_STATE=stopped$' "$controller_file_441"
182
- test ! -f "$agent_root/state/pending-launches/issue-440.pid"
183
- test ! -f "$agent_root/state/pending-launches/issue-441.pid"
184
-
185
- echo "start resident issue loop adopts next recurring issue test passed"
@@ -1,152 +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 "${loop_pid:-}" ]]; then
13
- kill "${loop_pid}" >/dev/null 2>&1 || true
14
- wait "${loop_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
-
31
- mkdir -p "$bin_dir" "$hooks_dir" "$assets_dir" "$profile_dir" "$shim_dir" "$agent_root" "$repo_root" "$capture_dir"
32
- cp "$REAL_LOOP" "$bin_dir/start-resident-issue-loop.sh"
33
- cp "$REAL_CONFIG_LIB" "$bin_dir/flow-config-lib.sh"
34
- cp "$REAL_SHELL_LIB" "$bin_dir/flow-shell-lib.sh"
35
- cp "$REAL_RESIDENT_LIB" "$bin_dir/flow-resident-worker-lib.sh"
36
- printf '{}\n' >"$assets_dir/workflow-catalog.json"
37
-
38
- cat >"$profile_dir/control-plane.yaml" <<EOF
39
- schema_version: "1"
40
- id: "demo"
41
- repo:
42
- slug: "example/demo"
43
- root: "$repo_root"
44
- default_branch: "main"
45
- runtime:
46
- orchestrator_agent_root: "$agent_root"
47
- worktree_root: "$tmpdir/worktrees"
48
- agent_repo_root: "$repo_root"
49
- runs_root: "$agent_root/runs"
50
- state_root: "$agent_root/state"
51
- history_root: "$agent_root/history"
52
- retained_repo_root: "$repo_root"
53
- vscode_workspace_file: "$tmpdir/demo.code-workspace"
54
- session_naming:
55
- issue_prefix: "demo-issue-"
56
- pr_prefix: "demo-pr-"
57
- execution:
58
- coding_worker: "openclaw"
59
- resident_workers:
60
- issue_reuse_enabled: true
61
- issue_controller_max_immediate_cycles: 1
62
- controller_poll_seconds: 1
63
- issue_controller_idle_timeout_seconds: 30
64
- EOF
65
-
66
- cat >"$hooks_dir/heartbeat-hooks.sh" <<'EOF'
67
- #!/usr/bin/env bash
68
- set -euo pipefail
69
- heartbeat_open_agent_pr_issue_ids() { printf '[]\n'; }
70
- heartbeat_issue_is_heavy() { printf 'no\n'; }
71
- heartbeat_mark_issue_running() { :; }
72
- heartbeat_issue_launch_failed() { :; }
73
- EOF
74
- chmod +x "$hooks_dir/heartbeat-hooks.sh"
75
-
76
- cat >"$shim_dir/gh" <<'EOF'
77
- #!/usr/bin/env bash
78
- set -euo pipefail
79
-
80
- if [[ "${1:-}" == "issue" && "${2:-}" == "view" ]]; then
81
- issue_id="${3:-0}"
82
- cat <<JSON
83
- {"number":${issue_id},"state":"OPEN","title":"Scheduled issue ${issue_id}","body":"Agent schedule: every 5m","url":"https://example.test/issues/${issue_id}","labels":[{"name":"agent-scheduled"}],"comments":[]}
84
- JSON
85
- exit 0
86
- fi
87
-
88
- if [[ "${1:-}" == "pr" && "${2:-}" == "list" ]]; then
89
- printf '[]\n'
90
- exit 0
91
- fi
92
-
93
- exit 64
94
- EOF
95
- chmod +x "$shim_dir/gh"
96
-
97
- cat >"$shim_dir/tmux" <<'EOF'
98
- #!/usr/bin/env bash
99
- set -euo pipefail
100
-
101
- if [[ "${1:-}" == "has-session" ]]; then
102
- pid_file="${TEST_CAPTURE_DIR:?}/tmux-session.pid"
103
- if [[ -f "${pid_file}" ]]; then
104
- pid="$(tr -d '[:space:]' <"${pid_file}" 2>/dev/null || true)"
105
- if [[ -n "${pid}" ]] && kill -0 "${pid}" 2>/dev/null; then
106
- exit 0
107
- fi
108
- rm -f "${pid_file}"
109
- fi
110
- exit 1
111
- fi
112
-
113
- exit 1
114
- EOF
115
- chmod +x "$shim_dir/tmux"
116
-
117
- cat >"$bin_dir/start-issue-worker.sh" <<'EOF'
118
- #!/usr/bin/env bash
119
- set -euo pipefail
120
- (sleep 0.2) &
121
- printf '%s\n' "$!" >"${TEST_CAPTURE_DIR:?}/tmux-session.pid"
122
- EOF
123
- chmod +x "$bin_dir/start-issue-worker.sh"
124
-
125
- cat >"$bin_dir/reconcile-issue-worker.sh" <<'EOF'
126
- #!/usr/bin/env bash
127
- set -euo pipefail
128
- exit 0
129
- EOF
130
- chmod +x "$bin_dir/reconcile-issue-worker.sh"
131
-
132
- PATH="$shim_dir:$PATH" \
133
- ACP_PROJECT_ID="demo" \
134
- ACP_PROFILE_REGISTRY_ROOT="$profile_registry_root" \
135
- TEST_CAPTURE_DIR="$capture_dir" \
136
- bash "$bin_dir/start-resident-issue-loop.sh" 440 >/dev/null &
137
- loop_pid="$!"
138
-
139
- controller_file="$agent_root/state/resident-workers/issues/440/controller.env"
140
- pending_file="$agent_root/state/pending-launches/issue-440.pid"
141
-
142
- for _ in $(seq 1 100); do
143
- if [[ -f "$controller_file" ]] && grep -q '^CONTROLLER_STATE=sleeping$' "$controller_file"; then
144
- break
145
- fi
146
- sleep 0.1
147
- done
148
-
149
- grep -q '^CONTROLLER_STATE=sleeping$' "$controller_file"
150
- test ! -f "$pending_file"
151
-
152
- echo "start resident issue loop clears pending while sleeping test passed"