agent-control-plane 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +589 -0
- package/SKILL.md +149 -0
- package/assets/workflow-catalog.json +57 -0
- package/bin/audit-issue-routing.sh +74 -0
- package/bin/issue-resource-class.sh +58 -0
- package/bin/label-follow-up-issues.sh +114 -0
- package/bin/pr-risk.sh +532 -0
- package/bin/sync-pr-labels.sh +112 -0
- package/hooks/heartbeat-hooks.sh +573 -0
- package/hooks/issue-reconcile-hooks.sh +217 -0
- package/hooks/pr-reconcile-hooks.sh +225 -0
- package/npm/bin/agent-control-plane.js +1984 -0
- package/npm/public-bin/agent-control-plane +3 -0
- package/package.json +61 -0
- package/tools/bin/agent-cleanup-worktree +247 -0
- package/tools/bin/agent-github-update-labels +66 -0
- package/tools/bin/agent-init-worktree +216 -0
- package/tools/bin/agent-project-archive-run +52 -0
- package/tools/bin/agent-project-capture-worker +46 -0
- package/tools/bin/agent-project-catch-up-merged-prs +137 -0
- package/tools/bin/agent-project-cleanup-session +244 -0
- package/tools/bin/agent-project-detached-launch +107 -0
- package/tools/bin/agent-project-heartbeat-loop +2347 -0
- package/tools/bin/agent-project-open-issue-worktree +89 -0
- package/tools/bin/agent-project-open-pr-worktree +80 -0
- package/tools/bin/agent-project-publish-issue-pr +349 -0
- package/tools/bin/agent-project-reconcile-issue-session +1128 -0
- package/tools/bin/agent-project-reconcile-pr-session +1005 -0
- package/tools/bin/agent-project-retry-state +147 -0
- package/tools/bin/agent-project-run-claude-session +657 -0
- package/tools/bin/agent-project-run-codex-resilient +718 -0
- package/tools/bin/agent-project-run-codex-session +316 -0
- package/tools/bin/agent-project-run-kilo-session +27 -0
- package/tools/bin/agent-project-run-openclaw-session +984 -0
- package/tools/bin/agent-project-run-opencode-session +27 -0
- package/tools/bin/agent-project-sync-anchor-repo +128 -0
- package/tools/bin/agent-project-worker-status +143 -0
- package/tools/bin/audit-agent-worktrees.sh +310 -0
- package/tools/bin/audit-issue-routing.sh +11 -0
- package/tools/bin/audit-retained-layout.sh +58 -0
- package/tools/bin/audit-retained-overlap.sh +135 -0
- package/tools/bin/audit-retained-worktrees.sh +228 -0
- package/tools/bin/branch-verification-guard.sh +351 -0
- package/tools/bin/capture-worker.sh +18 -0
- package/tools/bin/check-skill-contracts.sh +324 -0
- package/tools/bin/cleanup-worktree.sh +44 -0
- package/tools/bin/codex-quota +31 -0
- package/tools/bin/create-follow-up-issue.sh +114 -0
- package/tools/bin/dashboard-launchd-bootstrap.sh +38 -0
- package/tools/bin/flow-config-lib.sh +2127 -0
- package/tools/bin/flow-resident-worker-lib.sh +683 -0
- package/tools/bin/flow-runtime-doctor.sh +97 -0
- package/tools/bin/flow-shell-lib.sh +266 -0
- package/tools/bin/heartbeat-recovery-preflight.sh +106 -0
- package/tools/bin/heartbeat-safe-auto.sh +551 -0
- package/tools/bin/install-dashboard-launchd.sh +152 -0
- package/tools/bin/install-project-launchd.sh +219 -0
- package/tools/bin/issue-publish-scope-guard.sh +242 -0
- package/tools/bin/issue-requires-local-workspace-install.sh +31 -0
- package/tools/bin/issue-resource-class.sh +12 -0
- package/tools/bin/kick-scheduler.sh +75 -0
- package/tools/bin/label-follow-up-issues.sh +14 -0
- package/tools/bin/new-pr-worktree.sh +50 -0
- package/tools/bin/new-worktree.sh +49 -0
- package/tools/bin/pr-risk.sh +12 -0
- package/tools/bin/prepare-worktree.sh +140 -0
- package/tools/bin/profile-activate.sh +109 -0
- package/tools/bin/profile-adopt.sh +219 -0
- package/tools/bin/profile-smoke.sh +461 -0
- package/tools/bin/project-init.sh +189 -0
- package/tools/bin/project-launchd-bootstrap.sh +54 -0
- package/tools/bin/project-remove.sh +155 -0
- package/tools/bin/project-runtime-supervisor.sh +56 -0
- package/tools/bin/project-runtimectl.sh +586 -0
- package/tools/bin/provider-cooldown-state.sh +166 -0
- package/tools/bin/publish-issue-worker.sh +31 -0
- package/tools/bin/reconcile-issue-worker.sh +34 -0
- package/tools/bin/reconcile-pr-worker.sh +34 -0
- package/tools/bin/record-verification.sh +71 -0
- package/tools/bin/render-architecture-infographics.sh +110 -0
- package/tools/bin/render-dashboard-demo-media.sh +333 -0
- package/tools/bin/render-dashboard-snapshot.py +16 -0
- package/tools/bin/render-flow-config.sh +86 -0
- package/tools/bin/retry-state.sh +31 -0
- package/tools/bin/reuse-issue-worktree.sh +75 -0
- package/tools/bin/run-codex-bypass.sh +3 -0
- package/tools/bin/run-codex-safe.sh +3 -0
- package/tools/bin/run-codex-task.sh +231 -0
- package/tools/bin/scaffold-profile.sh +374 -0
- package/tools/bin/serve-dashboard.sh +5 -0
- package/tools/bin/split-retained-slice.sh +124 -0
- package/tools/bin/start-issue-worker.sh +796 -0
- package/tools/bin/start-pr-fix-worker.sh +458 -0
- package/tools/bin/start-pr-merge-repair-worker.sh +8 -0
- package/tools/bin/start-pr-review-worker.sh +227 -0
- package/tools/bin/start-resident-issue-loop.sh +908 -0
- package/tools/bin/sync-agent-repo.sh +52 -0
- package/tools/bin/sync-dependency-baseline.sh +247 -0
- package/tools/bin/sync-pr-labels.sh +12 -0
- package/tools/bin/sync-recurring-issue-checklist.sh +274 -0
- package/tools/bin/sync-shared-agent-home.sh +214 -0
- package/tools/bin/sync-vscode-workspace.sh +157 -0
- package/tools/bin/test-smoke.sh +63 -0
- package/tools/bin/uninstall-project-launchd.sh +55 -0
- package/tools/bin/update-github-labels.sh +14 -0
- package/tools/bin/worker-status.sh +19 -0
- package/tools/bin/workflow-catalog.sh +77 -0
- package/tools/dashboard/app.js +286 -0
- package/tools/dashboard/dashboard_snapshot.py +466 -0
- package/tools/dashboard/index.html +41 -0
- package/tools/dashboard/server.py +64 -0
- package/tools/dashboard/styles.css +351 -0
- package/tools/templates/issue-prompt-template.md +109 -0
- package/tools/templates/pr-fix-template.md +120 -0
- package/tools/templates/pr-merge-repair-template.md +91 -0
- package/tools/templates/pr-review-template.md +62 -0
- package/tools/templates/scheduled-issue-prompt-template.md +62 -0
- package/tools/tests/test-agent-control-plane-npm-cli.sh +279 -0
- package/tools/tests/test-agent-github-update-labels-falls-back-to-repository-id.sh +56 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-clears-stale-sandbox-artifacts.sh +89 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-does-not-retry-provider-quota.sh +82 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-retries-transient-failures.sh +90 -0
- package/tools/tests/test-agent-project-claude-session-wrapper-times-out.sh +73 -0
- package/tools/tests/test-agent-project-claude-session-wrapper.sh +103 -0
- package/tools/tests/test-agent-project-cleanup-session-orphan-fallback.sh +90 -0
- package/tools/tests/test-agent-project-cleanup-session-skip-worktree-cleanup.sh +90 -0
- package/tools/tests/test-agent-project-codex-live-thread-persist.sh +76 -0
- package/tools/tests/test-agent-project-codex-recovery.sh +731 -0
- package/tools/tests/test-agent-project-codex-session-wrapper-clears-stale-sandbox-artifacts.sh +105 -0
- package/tools/tests/test-agent-project-codex-session-wrapper.sh +97 -0
- package/tools/tests/test-agent-project-open-pr-worktree-config-prefix.sh +81 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-clears-stale-sandbox-artifacts.sh +109 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-infers-blocked-result-contract.sh +89 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-literal-env-artifacts.sh +113 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-recovers-version-mismatch.sh +135 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-resident.sh +179 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-reuses-existing-agent-after-add-race.sh +119 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper-terminates-rate-limit-hang.sh +91 -0
- package/tools/tests/test-agent-project-openclaw-session-wrapper.sh +117 -0
- package/tools/tests/test-agent-project-publish-issue-pr-prunes-stale-worktree-entry.sh +148 -0
- package/tools/tests/test-agent-project-publish-issue-pr-reads-archived-session.sh +146 -0
- package/tools/tests/test-agent-project-publish-issue-pr-recovers-final-head.sh +145 -0
- package/tools/tests/test-agent-project-publish-issue-pr-reuses-existing-worktree.sh +147 -0
- package/tools/tests/test-agent-project-reconcile-failure-reason.sh +456 -0
- package/tools/tests/test-agent-project-reconcile-issue-archived-session-fallback.sh +96 -0
- package/tools/tests/test-agent-project-reconcile-issue-before-blocked.sh +90 -0
- package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery-uses-recovered-worktree.sh +212 -0
- package/tools/tests/test-agent-project-reconcile-issue-host-verification-recovery.sh +207 -0
- package/tools/tests/test-agent-project-reconcile-issue-provider-quota-schedules-provider-cooldown.sh +101 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-backfills-lane-metadata-from-worker-key.sh +113 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-clears-stale-failed-summary.sh +117 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-initializes-shared-agent-home.sh +55 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-normalizes-runner-state.sh +125 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-records-invalid-contract-summary.sh +118 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-skips-duplicate-blocked-comment.sh +144 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-standardizes-no-commits-blocker.sh +145 -0
- package/tools/tests/test-agent-project-reconcile-issue-session-synthesizes-blocked-comment.sh +139 -0
- package/tools/tests/test-agent-project-reconcile-pr-blocked-host-recovery.sh +242 -0
- package/tools/tests/test-agent-project-reconcile-pr-guard-blocked-no-commit.sh +142 -0
- package/tools/tests/test-agent-project-reconcile-pr-provider-quota-schedules-provider-cooldown.sh +106 -0
- package/tools/tests/test-agent-project-reconcile-pr-session-initializes-shared-agent-home.sh +66 -0
- package/tools/tests/test-agent-project-reconcile-pr-updated-branch-noop.sh +129 -0
- package/tools/tests/test-audit-agent-worktrees-active-launch-skips-git-inspection.sh +69 -0
- package/tools/tests/test-audit-agent-worktrees-broken-worktree.sh +43 -0
- package/tools/tests/test-audit-agent-worktrees-pending-launch-owner.sh +46 -0
- package/tools/tests/test-audit-agent-worktrees-unreconciled-owner.sh +79 -0
- package/tools/tests/test-audit-issue-routing-managed-branch-globs.sh +56 -0
- package/tools/tests/test-branch-verification-guard-generated-artifacts.sh +72 -0
- package/tools/tests/test-branch-verification-guard-targeted-coverage.sh +125 -0
- package/tools/tests/test-codex-quota-manager-failure-driven-rotation.sh +178 -0
- package/tools/tests/test-codex-quota-wrapper.sh +37 -0
- package/tools/tests/test-contribution-docs.sh +18 -0
- package/tools/tests/test-control-plane-dashboard-runtime-smoke.sh +343 -0
- package/tools/tests/test-create-follow-up-issue.sh +73 -0
- package/tools/tests/test-dashboard-launchd-bootstrap.sh +55 -0
- package/tools/tests/test-flow-export-execution-env-exports-repo-id.sh +30 -0
- package/tools/tests/test-flow-export-github-cli-auth-env-prefers-git-credential.sh +48 -0
- package/tools/tests/test-flow-github-api-repo-fallback-preserves-input.sh +85 -0
- package/tools/tests/test-flow-github-api-repo-prefers-explicit-repository-id.sh +60 -0
- package/tools/tests/test-flow-github-issue-list-falls-back-to-repository-id.sh +64 -0
- package/tools/tests/test-flow-github-pr-list-falls-back-to-repository-id.sh +77 -0
- package/tools/tests/test-flow-resident-can-reuse-does-not-leak-metadata.sh +52 -0
- package/tools/tests/test-flow-resident-reap-stale-controllers.sh +63 -0
- package/tools/tests/test-flow-resolve-codex-quota-tools.sh +104 -0
- package/tools/tests/test-flow-runtime-doctor-profile-selection.sh +27 -0
- package/tools/tests/test-heartbeat-codex-pr-linked-issue-exclusion.sh +79 -0
- package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-idle-controller.sh +115 -0
- package/tools/tests/test-heartbeat-hooks-enqueue-resident-issue-for-live-lane-controller.sh +117 -0
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-claude.sh +96 -0
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop-codex.sh +96 -0
- package/tools/tests/test-heartbeat-hooks-start-resident-issue-loop.sh +96 -0
- package/tools/tests/test-heartbeat-loop-auth-wait-does-not-consume-capacity.sh +170 -0
- package/tools/tests/test-heartbeat-loop-blocked-recovery-lane.sh +201 -0
- package/tools/tests/test-heartbeat-loop-blocked-recovery-vs-pr-reservation.sh +201 -0
- package/tools/tests/test-heartbeat-loop-idle-resident-controller-does-not-block-launches.sh +160 -0
- package/tools/tests/test-heartbeat-loop-pr-launch-dedup.sh +133 -0
- package/tools/tests/test-heartbeat-loop-provider-cooldown-suppresses-launches.sh +157 -0
- package/tools/tests/test-heartbeat-loop-reaps-stale-resident-controller.sh +181 -0
- package/tools/tests/test-heartbeat-loop-waiting-provider-resident-controller-does-not-block-launches.sh +160 -0
- package/tools/tests/test-heartbeat-ready-issues-blocked-recovery.sh +134 -0
- package/tools/tests/test-heartbeat-safe-auto-dynamic-concurrency.sh +162 -0
- package/tools/tests/test-heartbeat-safe-auto-no-tmux-sessions.sh +136 -0
- package/tools/tests/test-heartbeat-safe-auto-openclaw-skips-codex-quota.sh +139 -0
- package/tools/tests/test-heartbeat-safe-auto-quota-health-signal.sh +119 -0
- package/tools/tests/test-heartbeat-safe-auto-stale-shared-loop-pid-does-not-skip.sh +140 -0
- package/tools/tests/test-heartbeat-safe-auto-static-capacity-without-quota-cache.sh +142 -0
- package/tools/tests/test-heartbeat-safe-auto-zero-healthy-pools.sh +141 -0
- package/tools/tests/test-heartbeat-sync-issue-labels-empty-schedule.sh +65 -0
- package/tools/tests/test-heartbeat-sync-open-agent-prs-terminal-clears-running.sh +179 -0
- package/tools/tests/test-install-dashboard-launchd.sh +78 -0
- package/tools/tests/test-install-project-launchd-adds-tool-paths.sh +87 -0
- package/tools/tests/test-install-project-launchd.sh +110 -0
- package/tools/tests/test-issue-local-workspace-install-policy.sh +81 -0
- package/tools/tests/test-issue-publish-scope-guard-docs-signal.sh +70 -0
- package/tools/tests/test-issue-reconcile-hooks-success-clears-blocked.sh +36 -0
- package/tools/tests/test-kick-scheduler-requires-explicit-profile.sh +47 -0
- package/tools/tests/test-label-follow-up-issues-falls-back-to-repository-id.sh +132 -0
- package/tools/tests/test-manual-operator-entrypoints-require-explicit-profile.sh +64 -0
- package/tools/tests/test-package-funding-metadata.sh +21 -0
- package/tools/tests/test-package-public-metadata.sh +62 -0
- package/tools/tests/test-placeholder-worker-adapters.sh +38 -0
- package/tools/tests/test-pr-reconcile-hooks-refreshes-recurring-issue-checklist.sh +110 -0
- package/tools/tests/test-pr-risk-cohesive-mobile-locale-scope.sh +70 -0
- package/tools/tests/test-pr-risk-fix-label-semantics.sh +114 -0
- package/tools/tests/test-pr-risk-local-first-no-checks.sh +70 -0
- package/tools/tests/test-prepare-worktree-simple-repo-baseline.sh +67 -0
- package/tools/tests/test-profile-activate.sh +33 -0
- package/tools/tests/test-profile-adopt-allow-missing-repo.sh +68 -0
- package/tools/tests/test-profile-adopt-skip-workspace-sync-missing-file.sh +61 -0
- package/tools/tests/test-profile-adopt-syncs-anchor-and-workspace.sh +90 -0
- package/tools/tests/test-profile-smoke-collision.sh +44 -0
- package/tools/tests/test-profile-smoke-invalid-claude-config.sh +31 -0
- package/tools/tests/test-profile-smoke-invalid-provider-pool.sh +68 -0
- package/tools/tests/test-profile-smoke-repo-slug-mismatch.sh +36 -0
- package/tools/tests/test-profile-smoke.sh +45 -0
- package/tools/tests/test-project-init-force-and-skip-sync.sh +61 -0
- package/tools/tests/test-project-init-repo-slug-mismatch.sh +29 -0
- package/tools/tests/test-project-init.sh +66 -0
- package/tools/tests/test-project-launchd-bootstrap.sh +66 -0
- package/tools/tests/test-project-remove.sh +150 -0
- package/tools/tests/test-project-runtime-supervisor.sh +47 -0
- package/tools/tests/test-project-runtimectl-launchd.sh +115 -0
- package/tools/tests/test-project-runtimectl-missing-profile.sh +54 -0
- package/tools/tests/test-project-runtimectl-start-falls-back-to-bootstrap.sh +108 -0
- package/tools/tests/test-project-runtimectl-status-reports-supervisor-as-heartbeat-parent.sh +95 -0
- package/tools/tests/test-project-runtimectl-status-supervisor-running.sh +59 -0
- package/tools/tests/test-project-runtimectl-stop-cancels-pending-kick.sh +85 -0
- package/tools/tests/test-project-runtimectl-stop-clears-running-labels.sh +78 -0
- package/tools/tests/test-project-runtimectl.sh +212 -0
- package/tools/tests/test-provider-cooldown-state-prefers-runtime-worker-context.sh +39 -0
- package/tools/tests/test-provider-cooldown-state.sh +59 -0
- package/tools/tests/test-public-repo-docs.sh +159 -0
- package/tools/tests/test-reconcile-pr-worker-acp-config-routing.sh +75 -0
- package/tools/tests/test-render-dashboard-snapshot.sh +149 -0
- package/tools/tests/test-render-flow-config-demo-profile.sh +36 -0
- package/tools/tests/test-render-flow-config-provider-pool-fallback.sh +81 -0
- package/tools/tests/test-render-flow-config.sh +52 -0
- package/tools/tests/test-run-codex-task-claude-routing.sh +125 -0
- package/tools/tests/test-run-codex-task-codex-resident-routing.sh +108 -0
- package/tools/tests/test-run-codex-task-kilo-routing.sh +98 -0
- package/tools/tests/test-run-codex-task-openclaw-resident-routing.sh +117 -0
- package/tools/tests/test-run-codex-task-openclaw-routing.sh +113 -0
- package/tools/tests/test-run-codex-task-opencode-routing.sh +98 -0
- package/tools/tests/test-run-codex-task-provider-pool-fallback-routing.sh +146 -0
- package/tools/tests/test-scaffold-profile.sh +108 -0
- package/tools/tests/test-serve-dashboard.sh +93 -0
- package/tools/tests/test-start-issue-worker-blocked-context.sh +129 -0
- package/tools/tests/test-start-issue-worker-blocks-complete-recurring-checklist.sh +189 -0
- package/tools/tests/test-start-issue-worker-local-install-routing.sh +157 -0
- package/tools/tests/test-start-issue-worker-profile-template-routing.sh +149 -0
- package/tools/tests/test-start-issue-worker-recurring-resident-reuse-codex.sh +212 -0
- package/tools/tests/test-start-issue-worker-recurring-resident-reuse.sh +219 -0
- package/tools/tests/test-start-issue-worker-renders-verification-snippet.sh +155 -0
- package/tools/tests/test-start-issue-worker-resident-reuse-falls-back-to-new-worktree.sh +199 -0
- package/tools/tests/test-start-pr-fix-worker-host-blocker-context.sh +275 -0
- package/tools/tests/test-start-resident-issue-loop-adopts-next-recurring-issue.sh +185 -0
- package/tools/tests/test-start-resident-issue-loop-clears-pending-while-waiting-due.sh +152 -0
- package/tools/tests/test-start-resident-issue-loop-consumes-queued-lease.sh +186 -0
- package/tools/tests/test-start-resident-issue-loop-fails-over-provider-pool.sh +212 -0
- package/tools/tests/test-start-resident-issue-loop-immediate-cycles.sh +148 -0
- package/tools/tests/test-start-resident-issue-loop-waits-for-provider.sh +194 -0
- package/tools/tests/test-start-resident-issue-loop-waits-for-terminal-reconcile-status.sh +198 -0
- package/tools/tests/test-start-resident-issue-loop-yields-to-live-lane-controller.sh +145 -0
- package/tools/tests/test-sync-pr-labels-fix-lane-uses-repair-queued.sh +67 -0
- package/tools/tests/test-sync-recurring-issue-checklist-backfills-workflow-complete-blocker.sh +70 -0
- package/tools/tests/test-sync-recurring-issue-checklist.sh +95 -0
- package/tools/tests/test-sync-shared-agent-home-local-source-root.sh +66 -0
- package/tools/tests/test-sync-shared-agent-home-preserves-unrelated-workflow-catalog-skill.sh +47 -0
- package/tools/tests/test-test-smoke.sh +86 -0
- package/tools/tests/test-uninstall-project-launchd.sh +37 -0
- package/tools/tests/test-update-github-labels-prefers-sibling-helper.sh +49 -0
- package/tools/tests/test-workflow-catalog.sh +43 -0
- package/tools/vendor/codex-quota/LICENSE +21 -0
- package/tools/vendor/codex-quota/README.md +459 -0
- package/tools/vendor/codex-quota/codex-quota.js +261 -0
- package/tools/vendor/codex-quota/lib/claude-accounts.js +226 -0
- package/tools/vendor/codex-quota/lib/claude-oauth.js +174 -0
- package/tools/vendor/codex-quota/lib/claude-tokens.js +471 -0
- package/tools/vendor/codex-quota/lib/claude-usage.js +929 -0
- package/tools/vendor/codex-quota/lib/codex-accounts.js +205 -0
- package/tools/vendor/codex-quota/lib/codex-tokens.js +326 -0
- package/tools/vendor/codex-quota/lib/codex-usage.js +32 -0
- package/tools/vendor/codex-quota/lib/color.js +72 -0
- package/tools/vendor/codex-quota/lib/constants.js +57 -0
- package/tools/vendor/codex-quota/lib/container.js +143 -0
- package/tools/vendor/codex-quota/lib/display.js +1111 -0
- package/tools/vendor/codex-quota/lib/fs.js +63 -0
- package/tools/vendor/codex-quota/lib/handlers.js +2060 -0
- package/tools/vendor/codex-quota/lib/jwt.js +33 -0
- package/tools/vendor/codex-quota/lib/oauth.js +486 -0
- package/tools/vendor/codex-quota/lib/paths.js +34 -0
- package/tools/vendor/codex-quota/lib/prompts.js +44 -0
- package/tools/vendor/codex-quota/lib/sync.js +1438 -0
- package/tools/vendor/codex-quota/lib/token-match.js +96 -0
- package/tools/vendor/codex-quota-manager/scripts/auto-switch.sh +500 -0
- package/tools/vendor/codex-quota-manager/scripts/batch-add.sh +123 -0
|
@@ -0,0 +1,194 @@
|
|
|
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"
|
|
@@ -0,0 +1,198 @@
|
|
|
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"
|
|
@@ -0,0 +1,145 @@
|
|
|
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"
|
|
@@ -0,0 +1,67 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
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"
|