@apralabs/apra-fleet 0.4.3 → 0.4.4
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 +66 -30
- package/dist/agents/backlog-groomer.md +75 -27
- package/dist/agents/ci-watcher.md +37 -22
- package/dist/agents/deployer.md +39 -22
- package/dist/agents/doer.md +74 -40
- package/dist/agents/harvester.md +49 -40
- package/dist/agents/integ-test-runner.md +40 -23
- package/dist/agents/kb-reconciler.md +28 -7
- package/dist/agents/plan-reviewer.md +49 -24
- package/dist/agents/planner.md +66 -43
- package/dist/agents/regression-test-runner.md +101 -78
- package/dist/agents/reviewer.md +117 -56
- package/dist/agents/schemas/backlog-groomer-output.json +1 -1
- package/dist/agents/schemas/doer-output.json +32 -0
- package/dist/agents/schemas/harvester-input.json +1 -5
- package/dist/agents/schemas/planner-output.json +1 -1
- package/dist/agents/schemas/regression-test-runner-output.json +41 -7
- package/dist/agents/schemas/reviewer-output.json +62 -3
- package/dist/cli/agent-transform.d.ts +7 -0
- package/dist/cli/agent-transform.js +46 -1
- package/dist/cli/auth.d.ts +1 -0
- package/dist/cli/auth.js +38 -8
- package/dist/cli/beads-install.d.ts +35 -0
- package/dist/cli/beads-install.js +125 -0
- package/dist/cli/beads-pin.d.ts +5 -0
- package/dist/cli/beads-pin.js +27 -0
- package/dist/cli/call.d.ts +27 -0
- package/dist/cli/call.js +177 -0
- package/dist/cli/config.d.ts +24 -1
- package/dist/cli/config.js +69 -2
- package/dist/cli/dolt-install.d.ts +18 -2
- package/dist/cli/dolt-install.js +46 -15
- package/dist/cli/fleet-se-guard.d.ts +51 -0
- package/dist/cli/fleet-se-guard.js +215 -0
- package/dist/cli/install-guard.d.ts +54 -0
- package/dist/cli/install-guard.js +132 -4
- package/dist/cli/install.d.ts +77 -21
- package/dist/cli/install.js +610 -152
- package/dist/cli/kb-commit.d.ts +2 -1
- package/dist/cli/kb-commit.js +1 -1
- package/dist/cli/kb-import.d.ts +2 -1
- package/dist/cli/kb-import.js +1 -1
- package/dist/cli/register-member.js +20 -3
- package/dist/cli/remove-member.d.ts +4 -0
- package/dist/cli/remove-member.js +63 -0
- package/dist/cli/secret.js +9 -0
- package/dist/cli/start.js +59 -4
- package/dist/cli/status.d.ts +3 -0
- package/dist/cli/status.js +45 -12
- package/dist/cli/stop.js +64 -9
- package/dist/cli/uninstall.js +101 -15
- package/dist/cli/update.js +33 -2
- package/dist/cli/watch.js +1 -1
- package/dist/cli/workflow.js +3 -2
- package/dist/commands/kb-server.js +9 -2
- package/dist/hub-service/http-server.d.ts +5 -1
- package/dist/hub-service/http-server.js +55 -5
- package/dist/index.js +155 -8
- package/dist/os/child-env-bound.d.ts +77 -0
- package/dist/os/child-env-bound.js +171 -0
- package/dist/os/linux.d.ts +7 -2
- package/dist/os/linux.js +40 -14
- package/dist/os/macos.d.ts +1 -1
- package/dist/os/macos.js +2 -11
- package/dist/os/os-commands.d.ts +17 -2
- package/dist/os/windows-gitbash.d.ts +1 -0
- package/dist/os/windows-gitbash.js +17 -3
- package/dist/os/windows-wrapper.d.ts +0 -4
- package/dist/os/windows-wrapper.js +2 -1
- package/dist/os/windows.d.ts +5 -2
- package/dist/os/windows.js +75 -29
- package/dist/paths.d.ts +21 -0
- package/dist/paths.js +35 -0
- package/dist/providers/agy.d.ts +6 -2
- package/dist/providers/agy.js +245 -106
- package/dist/providers/claude-permission-denial.d.ts +7 -0
- package/dist/providers/claude-permission-denial.js +137 -0
- package/dist/providers/claude.d.ts +86 -38
- package/dist/providers/claude.js +426 -164
- package/dist/providers/codex.js +5 -1
- package/dist/providers/copilot.js +5 -1
- package/dist/providers/opencode.d.ts +10 -2
- package/dist/providers/opencode.js +114 -53
- package/dist/providers/provider.d.ts +171 -33
- package/dist/providers/provider.js +164 -3
- package/dist/services/agent-provisioner.d.ts +29 -0
- package/dist/services/agent-provisioner.js +107 -0
- package/dist/services/agent-shadow.d.ts +96 -0
- package/dist/services/agent-shadow.js +479 -0
- package/dist/services/agy-project.d.ts +2 -1
- package/dist/services/agy-project.js +15 -17
- package/dist/services/auth-socket.d.ts +25 -0
- package/dist/services/auth-socket.js +68 -23
- package/dist/services/auth-web.js +1 -1
- package/dist/services/budget-awareness.d.ts +11 -11
- package/dist/services/budget-awareness.js +15 -3
- package/dist/services/claude-local-scope-mcp.d.ts +19 -0
- package/dist/services/claude-local-scope-mcp.js +91 -0
- package/dist/services/cloud/aws.js +2 -1
- package/dist/services/cloud/lifecycle.js +19 -2
- package/dist/services/cloud/task-wrapper.d.ts +0 -9
- package/dist/services/cloud/task-wrapper.js +15 -6
- package/dist/services/event-loop-watchdog.d.ts +32 -0
- package/dist/services/event-loop-watchdog.js +140 -0
- package/dist/services/http-transport.d.ts +49 -1
- package/dist/services/http-transport.js +190 -24
- package/dist/services/in-flight-agents.d.ts +2 -0
- package/dist/services/in-flight-agents.js +4 -0
- package/dist/services/knowledge/bible-basis-filter.d.ts +53 -0
- package/dist/services/knowledge/bible-basis-filter.js +134 -0
- package/dist/services/knowledge/bible-blob-id.d.ts +44 -0
- package/dist/services/knowledge/bible-blob-id.js +113 -0
- package/dist/services/knowledge/bible-import.d.ts +65 -0
- package/dist/services/knowledge/bible-import.js +211 -0
- package/dist/services/knowledge/file-hash.d.ts +31 -0
- package/dist/services/knowledge/file-hash.js +153 -23
- package/dist/services/knowledge/http-provider.d.ts +4 -3
- package/dist/services/knowledge/http-provider.js +17 -5
- package/dist/services/knowledge/kb-maintainer-grant.d.ts +15 -0
- package/dist/services/knowledge/kb-maintainer-grant.js +34 -0
- package/dist/services/knowledge/kb-providers.d.ts +4 -0
- package/dist/services/knowledge/kb-providers.js +8 -0
- package/dist/services/knowledge/kb-removed-scope-keys.d.ts +28 -0
- package/dist/services/knowledge/kb-removed-scope-keys.js +59 -0
- package/dist/services/knowledge/kb-scopes.d.ts +14 -0
- package/dist/services/knowledge/kb-scopes.js +47 -0
- package/dist/services/knowledge/kb-self.d.ts +91 -0
- package/dist/services/knowledge/kb-self.js +198 -0
- package/dist/services/knowledge/member-bible-view.d.ts +21 -0
- package/dist/services/knowledge/member-bible-view.js +194 -0
- package/dist/services/knowledge/pre-init.js +1 -0
- package/dist/services/knowledge/project-slug.js +2 -2
- package/dist/services/knowledge/sqlite-provider.d.ts +64 -11
- package/dist/services/knowledge/sqlite-provider.js +303 -41
- package/dist/services/knowledge/types.d.ts +45 -2
- package/dist/services/member-access-secret.d.ts +70 -0
- package/dist/services/member-access-secret.js +195 -0
- package/dist/services/member-call-counts.d.ts +24 -0
- package/dist/services/member-call-counts.js +58 -0
- package/dist/services/member-config-io.d.ts +192 -0
- package/dist/services/member-config-io.js +443 -0
- package/dist/services/member-fleet-install.d.ts +710 -0
- package/dist/services/member-fleet-install.js +1895 -0
- package/dist/services/member-secret-env.d.ts +42 -0
- package/dist/services/member-secret-env.js +68 -0
- package/dist/services/member-tool-allowlist.d.ts +49 -0
- package/dist/services/member-tool-allowlist.js +111 -0
- package/dist/services/model-pricing.d.ts +19 -0
- package/dist/services/model-pricing.js +54 -8
- package/dist/services/port-holder.d.ts +86 -0
- package/dist/services/port-holder.js +351 -0
- package/dist/services/preflight-check.js +2 -0
- package/dist/services/registry.d.ts +13 -2
- package/dist/services/registry.js +27 -1
- package/dist/services/relay-strategy.d.ts +2 -0
- package/dist/services/relay-strategy.js +8 -0
- package/dist/services/server-lifecycle.d.ts +26 -0
- package/dist/services/server-lifecycle.js +85 -0
- package/dist/services/service-manager/index.d.ts +7 -1
- package/dist/services/service-manager/index.js +17 -4
- package/dist/services/service-manager/linux.d.ts +1 -1
- package/dist/services/service-manager/linux.js +15 -7
- package/dist/services/service-manager/macos.d.ts +11 -1
- package/dist/services/service-manager/macos.js +45 -7
- package/dist/services/service-manager/service-path.d.ts +24 -0
- package/dist/services/service-manager/service-path.js +55 -0
- package/dist/services/service-manager/types.d.ts +38 -3
- package/dist/services/service-manager/types.js +29 -0
- package/dist/services/service-manager/windows.d.ts +181 -2
- package/dist/services/service-manager/windows.js +666 -49
- package/dist/services/service-notice.d.ts +14 -0
- package/dist/services/service-notice.js +62 -0
- package/dist/services/service-start-guard.d.ts +20 -0
- package/dist/services/service-start-guard.js +86 -0
- package/dist/services/session-cost.d.ts +24 -0
- package/dist/services/session-cost.js +105 -0
- package/dist/services/session-mcp-config.d.ts +83 -0
- package/dist/services/session-mcp-config.js +211 -0
- package/dist/services/sftp.d.ts +34 -0
- package/dist/services/sftp.js +304 -76
- package/dist/services/shell-probe.d.ts +0 -24
- package/dist/services/shell-probe.js +28 -3
- package/dist/services/singleton.d.ts +68 -2
- package/dist/services/singleton.js +168 -11
- package/dist/services/sprint-coordination.js +9 -3
- package/dist/services/ssh.d.ts +27 -0
- package/dist/services/ssh.js +229 -38
- package/dist/services/stall/find-log-file.js +12 -5
- package/dist/services/stall/index.d.ts +1 -1
- package/dist/services/stall/read-log-tail.d.ts +23 -0
- package/dist/services/stall/read-log-tail.js +33 -2
- package/dist/services/stall/stall-detector.d.ts +25 -1
- package/dist/services/stall/stall-detector.js +85 -6
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.js +50 -6
- package/dist/services/stopped-marker.d.ts +16 -0
- package/dist/services/stopped-marker.js +55 -0
- package/dist/services/strategy.d.ts +33 -1
- package/dist/services/strategy.js +86 -17
- package/dist/services/supervisor-service-cleanup.d.ts +52 -0
- package/dist/services/supervisor-service-cleanup.js +332 -0
- package/dist/services/tool-registry.d.ts +8 -1
- package/dist/services/tool-registry.js +160 -59
- package/dist/services/tool-scope.d.ts +58 -0
- package/dist/services/tool-scope.js +99 -0
- package/dist/services/watch/project-resolver.js +1 -0
- package/dist/skills/auto-sprint-args/SKILL.md +2 -2
- package/dist/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/dist/skills/pm/SKILL.md +3 -3
- package/dist/skills/pm/index.md +4 -2
- package/dist/skills/pm/kb-reconcile.md +29 -14
- package/dist/skills/pm/kb-review.md +1 -0
- package/dist/skills/pm/sprint.md +5 -5
- package/dist/tools/check-status.d.ts +53 -5
- package/dist/tools/check-status.js +210 -53
- package/dist/tools/child-id-allocator.d.ts +2 -2
- package/dist/tools/child-id-allocator.js +1 -1
- package/dist/tools/code-index-heal.d.ts +8 -0
- package/dist/tools/code-index-heal.js +21 -0
- package/dist/tools/code-index-state.d.ts +45 -0
- package/dist/tools/code-index-state.js +115 -0
- package/dist/tools/code-intelligence-codebase-memory.js +6 -33
- package/dist/tools/code-intelligence-freshness.js +1 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts +30 -0
- package/dist/tools/code-intelligence-gitnexus.js +333 -57
- package/dist/tools/code-intelligence-kb-enrich.js +7 -6
- package/dist/tools/code-intelligence-readiness.d.ts +99 -0
- package/dist/tools/code-intelligence-readiness.js +206 -0
- package/dist/tools/code-intelligence-reindex.d.ts +195 -0
- package/dist/tools/code-intelligence-reindex.js +530 -50
- package/dist/tools/code-intelligence-telemetry.d.ts +6 -1
- package/dist/tools/code-intelligence-telemetry.js +12 -3
- package/dist/tools/code-intelligence.d.ts +81 -31
- package/dist/tools/code-intelligence.js +156 -52
- package/dist/tools/compose-permissions.d.ts +57 -2
- package/dist/tools/compose-permissions.js +497 -44
- package/dist/tools/execute-command.d.ts +11 -0
- package/dist/tools/execute-command.js +80 -12
- package/dist/tools/execute-prompt.d.ts +59 -15
- package/dist/tools/execute-prompt.js +544 -133
- package/dist/tools/kb-bible-commit.d.ts +65 -0
- package/dist/tools/kb-bible-commit.js +239 -0
- package/dist/tools/kb-capture.d.ts +13 -9
- package/dist/tools/kb-capture.js +42 -11
- package/dist/tools/kb-context.d.ts +27 -7
- package/dist/tools/kb-context.js +60 -9
- package/dist/tools/kb-export.d.ts +96 -7
- package/dist/tools/kb-export.js +228 -65
- package/dist/tools/kb-feedback.d.ts +13 -9
- package/dist/tools/kb-feedback.js +13 -7
- package/dist/tools/kb-freshness-sweep.d.ts +11 -7
- package/dist/tools/kb-freshness-sweep.js +7 -7
- package/dist/tools/kb-harvest.d.ts +11 -7
- package/dist/tools/kb-harvest.js +7 -7
- package/dist/tools/kb-import.d.ts +26 -10
- package/dist/tools/kb-import.js +169 -159
- package/dist/tools/kb-invalidate.d.ts +17 -10
- package/dist/tools/kb-invalidate.js +41 -8
- package/dist/tools/kb-list.d.ts +14 -10
- package/dist/tools/kb-list.js +30 -10
- package/dist/tools/kb-promote.d.ts +11 -7
- package/dist/tools/kb-promote.js +14 -8
- package/dist/tools/kb-query.d.ts +21 -11
- package/dist/tools/kb-query.js +76 -13
- package/dist/tools/kb-reconcile-prefilter.d.ts +11 -7
- package/dist/tools/kb-reconcile-prefilter.js +10 -8
- package/dist/tools/kb-resolve-contradiction.d.ts +11 -7
- package/dist/tools/kb-resolve-contradiction.js +7 -7
- package/dist/tools/kb-session-prime.d.ts +14 -7
- package/dist/tools/kb-session-prime.js +44 -44
- package/dist/tools/kb-setup.d.ts +11 -4
- package/dist/tools/kb-setup.js +25 -11
- package/dist/tools/kb-stats.d.ts +11 -10
- package/dist/tools/kb-stats.js +22 -41
- package/dist/tools/list-members.js +5 -2
- package/dist/tools/member-detail.d.ts +3 -0
- package/dist/tools/member-detail.js +88 -17
- package/dist/tools/member-reservation.d.ts +2 -2
- package/dist/tools/provision-auth.d.ts +39 -1
- package/dist/tools/provision-auth.js +269 -47
- package/dist/tools/provision-vcs-auth.d.ts +2 -2
- package/dist/tools/receive-files.js +3 -1
- package/dist/tools/register-member.d.ts +34 -8
- package/dist/tools/register-member.js +76 -58
- package/dist/tools/remove-member.js +110 -32
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/send-files.js +6 -4
- package/dist/tools/session-stats.d.ts +17 -0
- package/dist/tools/session-stats.js +27 -0
- package/dist/tools/shutdown-server.js +5 -0
- package/dist/tools/update-agent-cli.d.ts +19 -0
- package/dist/tools/update-agent-cli.js +59 -2
- package/dist/tools/update-member.d.ts +13 -10
- package/dist/tools/update-member.js +138 -7
- package/dist/tools/vcs-credential-exec.js +8 -2
- package/dist/types.d.ts +98 -1
- package/dist/utils/agent-helpers.js +2 -0
- package/dist/utils/auth-env.d.ts +15 -4
- package/dist/utils/auth-env.js +52 -23
- package/dist/utils/find-on-path.d.ts +37 -0
- package/dist/utils/find-on-path.js +85 -0
- package/dist/utils/log-helpers.d.ts +37 -0
- package/dist/utils/log-helpers.js +106 -20
- package/dist/utils/owner-only-fs.d.ts +56 -0
- package/dist/utils/owner-only-fs.js +98 -0
- package/dist/utils/process-utils.d.ts +28 -0
- package/dist/utils/process-utils.js +68 -0
- package/dist/utils/prompt-errors.js +4 -1
- package/dist/utils/session-caller.d.ts +4 -2
- package/dist/utils/session-caller.js +3 -2
- package/dist/utils/shell-escape.d.ts +42 -3
- package/dist/utils/shell-escape.js +70 -4
- package/dist/utils/ssh-error-messages.js +3 -0
- package/dist/utils/workspace-trust.d.ts +24 -1
- package/dist/utils/workspace-trust.js +21 -17
- package/dist/workflows/auto-sprint.js +223 -43
- package/package.json +11 -8
- package/packages/apra-fleet-client/package.json +2 -2
- package/packages/apra-fleet-client/src/client/api.mjs +558 -27
- package/packages/apra-fleet-client/src/client/auto-start.mjs +434 -0
- package/packages/apra-fleet-client/src/client/client.mjs +9 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +23 -4
- package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +137 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
- package/packages/apra-fleet-client/src/client/transport.mjs +37 -3
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +75 -27
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +37 -22
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +39 -22
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +74 -40
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +49 -40
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +40 -23
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +28 -7
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +49 -24
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +66 -43
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +101 -78
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +117 -56
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +32 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +1 -5
- package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +41 -7
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +62 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +3 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +4 -2
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +29 -14
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +1 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +5 -5
- package/packages/apra-fleet-se/bin/cli.mjs +184 -54
- package/packages/apra-fleet-se/bin/serve.mjs +143 -10
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +56 -20
- package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +208 -53
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +576 -33
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +9 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +114 -7
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +154 -8
- package/packages/apra-fleet-se/fleet-sprint/ci-gate.mjs +353 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +12 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +60 -1
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +25 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-accounting.mjs +270 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +22 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +205 -16
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +52 -14
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +6 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +3 -3
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +339 -20
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +210 -11
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +4 -4
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +200 -9
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +57 -9
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +53 -4
- package/packages/apra-fleet-se/fleet-sprint/kb-hints.mjs +181 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-injection.mjs +64 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-maintainer.mjs +298 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +1257 -301
- package/packages/apra-fleet-se/fleet-sprint/lower-quality.mjs +39 -0
- package/packages/apra-fleet-se/fleet-sprint/member-align.mjs +391 -0
- package/packages/apra-fleet-se/fleet-sprint/member-call.mjs +374 -0
- package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +644 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +447 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +250 -29
- package/packages/apra-fleet-se/fleet-sprint/orphan-reclaim.mjs +153 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +82 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +97 -50
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +81 -18
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +43 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +6 -6
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +20 -15
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +60 -38
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +42 -10
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +16 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +36 -3
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +72 -12
- package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +259 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +83 -25
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +19 -1
- package/packages/apra-fleet-se/fleet-sprint/runner.js +834 -142
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +24 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +130 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +111 -0
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +44 -1
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +84 -30
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +138 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +111 -11
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +22 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +7 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +180 -14
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +134 -7
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +99 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +223 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +49 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +8 -4
- package/packages/apra-fleet-se/fleet-sprint/verify-block.mjs +152 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +235 -21
- package/packages/apra-fleet-se/package.json +2 -2
- package/packages/apra-fleet-se/src/supervisor/api.mjs +919 -0
- package/packages/apra-fleet-se/src/supervisor/backlog-member.mjs +332 -0
- package/packages/apra-fleet-se/src/supervisor/backlog.mjs +982 -0
- package/packages/apra-fleet-se/src/supervisor/beads-identity.mjs +246 -0
- package/packages/apra-fleet-se/src/supervisor/beads-view.mjs +438 -0
- package/packages/apra-fleet-se/src/supervisor/child-port.mjs +36 -0
- package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +1659 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +350 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
- package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +279 -0
- package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
- package/packages/apra-fleet-se/src/supervisor/history.mjs +328 -0
- package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +521 -0
- package/packages/apra-fleet-se/src/supervisor/launch-form.mjs +444 -0
- package/packages/apra-fleet-se/src/supervisor/ledger.mjs +629 -0
- package/packages/apra-fleet-se/src/supervisor/lib/exec-bd.mjs +303 -0
- package/packages/apra-fleet-se/src/supervisor/log-timestamp.mjs +51 -0
- package/packages/apra-fleet-se/src/supervisor/log-view.mjs +159 -0
- package/packages/apra-fleet-se/src/supervisor/proxy.mjs +474 -0
- package/packages/apra-fleet-se/src/supervisor/readopt.mjs +136 -0
- package/packages/apra-fleet-se/src/supervisor/reconcile.mjs +263 -0
- package/packages/apra-fleet-se/src/supervisor/rename-with-retry.mjs +87 -0
- package/packages/apra-fleet-se/src/supervisor/scope-overlap.mjs +327 -0
- package/packages/apra-fleet-se/src/supervisor/self-log.mjs +133 -0
- package/packages/apra-fleet-se/src/supervisor/server.mjs +399 -0
- package/packages/apra-fleet-se/src/supervisor/spawner.mjs +542 -0
- package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
- package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +987 -0
- package/packages/apra-fleet-workflow/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +64 -9
- package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +71 -5
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
- package/skills/fleet/permissions.md +9 -0
- package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
- package/version.json +1 -1
- package/dist/cli/agent-transform.d.ts.map +0 -1
- package/dist/cli/agent-transform.js.map +0 -1
- package/dist/cli/auth.d.ts.map +0 -1
- package/dist/cli/auth.js.map +0 -1
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/dolt-install.d.ts.map +0 -1
- package/dist/cli/dolt-install.js.map +0 -1
- package/dist/cli/install-guard.d.ts.map +0 -1
- package/dist/cli/install-guard.js.map +0 -1
- package/dist/cli/install.d.ts.map +0 -1
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/join.d.ts.map +0 -1
- package/dist/cli/join.js.map +0 -1
- package/dist/cli/kb-commit.d.ts.map +0 -1
- package/dist/cli/kb-commit.js.map +0 -1
- package/dist/cli/kb-directives.d.ts.map +0 -1
- package/dist/cli/kb-directives.js.map +0 -1
- package/dist/cli/kb-import.d.ts.map +0 -1
- package/dist/cli/kb-import.js.map +0 -1
- package/dist/cli/register-member.d.ts.map +0 -1
- package/dist/cli/register-member.js.map +0 -1
- package/dist/cli/restart.d.ts.map +0 -1
- package/dist/cli/restart.js.map +0 -1
- package/dist/cli/secret.d.ts.map +0 -1
- package/dist/cli/secret.js.map +0 -1
- package/dist/cli/spoke.d.ts.map +0 -1
- package/dist/cli/spoke.js.map +0 -1
- package/dist/cli/start.d.ts.map +0 -1
- package/dist/cli/start.js.map +0 -1
- package/dist/cli/status.d.ts.map +0 -1
- package/dist/cli/status.js.map +0 -1
- package/dist/cli/stop.d.ts.map +0 -1
- package/dist/cli/stop.js.map +0 -1
- package/dist/cli/uninstall.d.ts.map +0 -1
- package/dist/cli/uninstall.js.map +0 -1
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js.map +0 -1
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js.map +0 -1
- package/dist/cli/workflow-assets.d.ts.map +0 -1
- package/dist/cli/workflow-assets.js.map +0 -1
- package/dist/cli/workflow.d.ts.map +0 -1
- package/dist/cli/workflow.js.map +0 -1
- package/dist/commands/kb-server.d.ts.map +0 -1
- package/dist/commands/kb-server.js.map +0 -1
- package/dist/delivery-mode.d.ts.map +0 -1
- package/dist/delivery-mode.js.map +0 -1
- package/dist/hub-service/activity.d.ts.map +0 -1
- package/dist/hub-service/activity.js.map +0 -1
- package/dist/hub-service/audit-log.d.ts.map +0 -1
- package/dist/hub-service/audit-log.js.map +0 -1
- package/dist/hub-service/db/pool.d.ts.map +0 -1
- package/dist/hub-service/db/pool.js.map +0 -1
- package/dist/hub-service/enrollment.d.ts.map +0 -1
- package/dist/hub-service/enrollment.js.map +0 -1
- package/dist/hub-service/envelope-routes.d.ts.map +0 -1
- package/dist/hub-service/envelope-routes.js.map +0 -1
- package/dist/hub-service/handlers/installers.d.ts.map +0 -1
- package/dist/hub-service/handlers/installers.js.map +0 -1
- package/dist/hub-service/http-server.d.ts.map +0 -1
- package/dist/hub-service/http-server.js.map +0 -1
- package/dist/hub-service/hub-jwt.d.ts.map +0 -1
- package/dist/hub-service/hub-jwt.js.map +0 -1
- package/dist/hub-service/jwt-revocation.d.ts.map +0 -1
- package/dist/hub-service/jwt-revocation.js.map +0 -1
- package/dist/hub-service/machines.d.ts.map +0 -1
- package/dist/hub-service/machines.js.map +0 -1
- package/dist/hub-service/main.d.ts.map +0 -1
- package/dist/hub-service/main.js.map +0 -1
- package/dist/hub-service/member-tokens.d.ts.map +0 -1
- package/dist/hub-service/member-tokens.js.map +0 -1
- package/dist/hub-service/member-view.d.ts.map +0 -1
- package/dist/hub-service/member-view.js.map +0 -1
- package/dist/hub-service/members.d.ts.map +0 -1
- package/dist/hub-service/members.js.map +0 -1
- package/dist/hub-service/presence.d.ts.map +0 -1
- package/dist/hub-service/presence.js.map +0 -1
- package/dist/hub-service/project-view.d.ts.map +0 -1
- package/dist/hub-service/project-view.js.map +0 -1
- package/dist/hub-service/projects.d.ts.map +0 -1
- package/dist/hub-service/projects.js.map +0 -1
- package/dist/hub-service/relay-queue.d.ts.map +0 -1
- package/dist/hub-service/relay-queue.js.map +0 -1
- package/dist/hub-service/session-jwt.d.ts.map +0 -1
- package/dist/hub-service/session-jwt.js.map +0 -1
- package/dist/hub-service/usage.d.ts.map +0 -1
- package/dist/hub-service/usage.js.map +0 -1
- package/dist/hub-service/users.d.ts.map +0 -1
- package/dist/hub-service/users.js.map +0 -1
- package/dist/hub-service/workspaces.d.ts.map +0 -1
- package/dist/hub-service/workspaces.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/onboarding/text.d.ts.map +0 -1
- package/dist/onboarding/text.js.map +0 -1
- package/dist/os/git-bash-candidates.d.ts.map +0 -1
- package/dist/os/git-bash-candidates.js.map +0 -1
- package/dist/os/index.d.ts.map +0 -1
- package/dist/os/index.js.map +0 -1
- package/dist/os/linux.d.ts.map +0 -1
- package/dist/os/linux.js.map +0 -1
- package/dist/os/macos.d.ts.map +0 -1
- package/dist/os/macos.js.map +0 -1
- package/dist/os/os-commands.d.ts.map +0 -1
- package/dist/os/os-commands.js.map +0 -1
- package/dist/os/windows-gitbash.d.ts.map +0 -1
- package/dist/os/windows-gitbash.js.map +0 -1
- package/dist/os/windows-wrapper.d.ts.map +0 -1
- package/dist/os/windows-wrapper.js.map +0 -1
- package/dist/os/windows.d.ts.map +0 -1
- package/dist/os/windows.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/providers/agy.d.ts.map +0 -1
- package/dist/providers/agy.js.map +0 -1
- package/dist/providers/claude.d.ts.map +0 -1
- package/dist/providers/claude.js.map +0 -1
- package/dist/providers/codex.d.ts.map +0 -1
- package/dist/providers/codex.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/email/headers.d.ts.map +0 -1
- package/dist/providers/email/headers.js.map +0 -1
- package/dist/providers/email/index.d.ts.map +0 -1
- package/dist/providers/email/index.js.map +0 -1
- package/dist/providers/email/provider.d.ts.map +0 -1
- package/dist/providers/email/provider.js.map +0 -1
- package/dist/providers/email/sendgrid.d.ts.map +0 -1
- package/dist/providers/email/sendgrid.js.map +0 -1
- package/dist/providers/email/smtp.d.ts.map +0 -1
- package/dist/providers/email/smtp.js.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/none.d.ts.map +0 -1
- package/dist/providers/none.js.map +0 -1
- package/dist/providers/opencode.d.ts.map +0 -1
- package/dist/providers/opencode.js.map +0 -1
- package/dist/providers/provider.d.ts.map +0 -1
- package/dist/providers/provider.js.map +0 -1
- package/dist/services/agent-provisioner.d.ts.map +0 -1
- package/dist/services/agent-provisioner.js.map +0 -1
- package/dist/services/agy-project.d.ts.map +0 -1
- package/dist/services/agy-project.js.map +0 -1
- package/dist/services/auth-socket.d.ts.map +0 -1
- package/dist/services/auth-socket.js.map +0 -1
- package/dist/services/auth-web.d.ts.map +0 -1
- package/dist/services/auth-web.js.map +0 -1
- package/dist/services/budget-awareness.d.ts.map +0 -1
- package/dist/services/budget-awareness.js.map +0 -1
- package/dist/services/cloud/activity.d.ts.map +0 -1
- package/dist/services/cloud/activity.js.map +0 -1
- package/dist/services/cloud/aws.d.ts.map +0 -1
- package/dist/services/cloud/aws.js.map +0 -1
- package/dist/services/cloud/cost.d.ts.map +0 -1
- package/dist/services/cloud/cost.js.map +0 -1
- package/dist/services/cloud/idle-manager.d.ts.map +0 -1
- package/dist/services/cloud/idle-manager.js.map +0 -1
- package/dist/services/cloud/lifecycle.d.ts.map +0 -1
- package/dist/services/cloud/lifecycle.js.map +0 -1
- package/dist/services/cloud/task-wrapper.d.ts.map +0 -1
- package/dist/services/cloud/task-wrapper.js.map +0 -1
- package/dist/services/cloud/types.d.ts.map +0 -1
- package/dist/services/cloud/types.js.map +0 -1
- package/dist/services/cloud-sync.d.ts.map +0 -1
- package/dist/services/cloud-sync.js.map +0 -1
- package/dist/services/context-admission.d.ts.map +0 -1
- package/dist/services/context-admission.js.map +0 -1
- package/dist/services/credential-cleanup.d.ts.map +0 -1
- package/dist/services/credential-cleanup.js.map +0 -1
- package/dist/services/credential-store.d.ts.map +0 -1
- package/dist/services/credential-store.js.map +0 -1
- package/dist/services/event-bus.d.ts.map +0 -1
- package/dist/services/event-bus.js.map +0 -1
- package/dist/services/exit-drain.d.ts.map +0 -1
- package/dist/services/exit-drain.js.map +0 -1
- package/dist/services/file-chunker.d.ts.map +0 -1
- package/dist/services/file-chunker.js.map +0 -1
- package/dist/services/file-transfer-relay.d.ts.map +0 -1
- package/dist/services/file-transfer-relay.js.map +0 -1
- package/dist/services/file-transfer.d.ts.map +0 -1
- package/dist/services/file-transfer.js.map +0 -1
- package/dist/services/git-config.d.ts.map +0 -1
- package/dist/services/git-config.js.map +0 -1
- package/dist/services/github-app.d.ts.map +0 -1
- package/dist/services/github-app.js.map +0 -1
- package/dist/services/http-transport.d.ts.map +0 -1
- package/dist/services/http-transport.js.map +0 -1
- package/dist/services/hub-client.d.ts.map +0 -1
- package/dist/services/hub-client.js.map +0 -1
- package/dist/services/icons.d.ts.map +0 -1
- package/dist/services/icons.js.map +0 -1
- package/dist/services/jwt.d.ts.map +0 -1
- package/dist/services/jwt.js.map +0 -1
- package/dist/services/knowledge/audn.d.ts.map +0 -1
- package/dist/services/knowledge/audn.js.map +0 -1
- package/dist/services/knowledge/file-hash.d.ts.map +0 -1
- package/dist/services/knowledge/file-hash.js.map +0 -1
- package/dist/services/knowledge/http-provider.d.ts.map +0 -1
- package/dist/services/knowledge/http-provider.js.map +0 -1
- package/dist/services/knowledge/kb-config.d.ts.map +0 -1
- package/dist/services/knowledge/kb-config.js.map +0 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +0 -1
- package/dist/services/knowledge/kb-providers.js.map +0 -1
- package/dist/services/knowledge/kb-scope-input.d.ts +0 -5
- package/dist/services/knowledge/kb-scope-input.d.ts.map +0 -1
- package/dist/services/knowledge/kb-scope-input.js +0 -11
- package/dist/services/knowledge/kb-scope-input.js.map +0 -1
- package/dist/services/knowledge/kb-service.d.ts.map +0 -1
- package/dist/services/knowledge/kb-service.js.map +0 -1
- package/dist/services/knowledge/path-validation.d.ts.map +0 -1
- package/dist/services/knowledge/path-validation.js.map +0 -1
- package/dist/services/knowledge/pre-init.d.ts.map +0 -1
- package/dist/services/knowledge/pre-init.js.map +0 -1
- package/dist/services/knowledge/project-slug.d.ts.map +0 -1
- package/dist/services/knowledge/project-slug.js.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.js.map +0 -1
- package/dist/services/knowledge/sqlite-provider.d.ts.map +0 -1
- package/dist/services/knowledge/sqlite-provider.js.map +0 -1
- package/dist/services/knowledge/types.d.ts.map +0 -1
- package/dist/services/knowledge/types.js.map +0 -1
- package/dist/services/known-hosts.d.ts.map +0 -1
- package/dist/services/known-hosts.js.map +0 -1
- package/dist/services/known-sessions.d.ts.map +0 -1
- package/dist/services/known-sessions.js.map +0 -1
- package/dist/services/member-home.d.ts.map +0 -1
- package/dist/services/member-home.js.map +0 -1
- package/dist/services/member-remote-url.d.ts.map +0 -1
- package/dist/services/member-remote-url.js.map +0 -1
- package/dist/services/model-pricing.d.ts.map +0 -1
- package/dist/services/model-pricing.js.map +0 -1
- package/dist/services/onboarding.d.ts.map +0 -1
- package/dist/services/onboarding.js.map +0 -1
- package/dist/services/orphan-recovery.d.ts.map +0 -1
- package/dist/services/orphan-recovery.js.map +0 -1
- package/dist/services/pending-responses.d.ts.map +0 -1
- package/dist/services/pending-responses.js.map +0 -1
- package/dist/services/preflight-check.d.ts.map +0 -1
- package/dist/services/preflight-check.js.map +0 -1
- package/dist/services/registry.d.ts.map +0 -1
- package/dist/services/registry.js.map +0 -1
- package/dist/services/relay-context.d.ts.map +0 -1
- package/dist/services/relay-context.js.map +0 -1
- package/dist/services/relay-executor.d.ts.map +0 -1
- package/dist/services/relay-executor.js.map +0 -1
- package/dist/services/relay-request.d.ts.map +0 -1
- package/dist/services/relay-request.js.map +0 -1
- package/dist/services/relay-strategy.d.ts.map +0 -1
- package/dist/services/relay-strategy.js.map +0 -1
- package/dist/services/secret-token.d.ts.map +0 -1
- package/dist/services/secret-token.js.map +0 -1
- package/dist/services/service-manager/index.d.ts.map +0 -1
- package/dist/services/service-manager/index.js.map +0 -1
- package/dist/services/service-manager/linux.d.ts.map +0 -1
- package/dist/services/service-manager/linux.js.map +0 -1
- package/dist/services/service-manager/macos.d.ts.map +0 -1
- package/dist/services/service-manager/macos.js.map +0 -1
- package/dist/services/service-manager/types.d.ts.map +0 -1
- package/dist/services/service-manager/types.js.map +0 -1
- package/dist/services/service-manager/windows.d.ts.map +0 -1
- package/dist/services/service-manager/windows.js.map +0 -1
- package/dist/services/session-registry.d.ts.map +0 -1
- package/dist/services/session-registry.js.map +0 -1
- package/dist/services/sftp.d.ts.map +0 -1
- package/dist/services/sftp.js.map +0 -1
- package/dist/services/shell-probe.d.ts.map +0 -1
- package/dist/services/shell-probe.js.map +0 -1
- package/dist/services/singleton.d.ts.map +0 -1
- package/dist/services/singleton.js.map +0 -1
- package/dist/services/sprint-coordination.d.ts.map +0 -1
- package/dist/services/sprint-coordination.js.map +0 -1
- package/dist/services/ssh.d.ts.map +0 -1
- package/dist/services/ssh.js.map +0 -1
- package/dist/services/stall/find-log-file.d.ts.map +0 -1
- package/dist/services/stall/find-log-file.js.map +0 -1
- package/dist/services/stall/index.d.ts.map +0 -1
- package/dist/services/stall/index.js.map +0 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +0 -1
- package/dist/services/stall/log-path-resolver.js.map +0 -1
- package/dist/services/stall/read-log-tail.d.ts.map +0 -1
- package/dist/services/stall/read-log-tail.js.map +0 -1
- package/dist/services/stall/stall-detector.d.ts.map +0 -1
- package/dist/services/stall/stall-detector.js.map +0 -1
- package/dist/services/stall/stall-poller.d.ts.map +0 -1
- package/dist/services/stall/stall-poller.js.map +0 -1
- package/dist/services/stall/time-utils.d.ts.map +0 -1
- package/dist/services/stall/time-utils.js.map +0 -1
- package/dist/services/statusline.d.ts.map +0 -1
- package/dist/services/statusline.js.map +0 -1
- package/dist/services/strategy.d.ts.map +0 -1
- package/dist/services/strategy.js.map +0 -1
- package/dist/services/substitution-engine.d.ts.map +0 -1
- package/dist/services/substitution-engine.js.map +0 -1
- package/dist/services/task-cleanup.d.ts.map +0 -1
- package/dist/services/task-cleanup.js.map +0 -1
- package/dist/services/token-issuer.d.ts.map +0 -1
- package/dist/services/token-issuer.js.map +0 -1
- package/dist/services/tool-registry.d.ts.map +0 -1
- package/dist/services/tool-registry.js.map +0 -1
- package/dist/services/update-check.d.ts.map +0 -1
- package/dist/services/update-check.js.map +0 -1
- package/dist/services/user-config.d.ts.map +0 -1
- package/dist/services/user-config.js.map +0 -1
- package/dist/services/vcs/azure-devops.d.ts.map +0 -1
- package/dist/services/vcs/azure-devops.js.map +0 -1
- package/dist/services/vcs/bitbucket.d.ts.map +0 -1
- package/dist/services/vcs/bitbucket.js.map +0 -1
- package/dist/services/vcs/constants.d.ts.map +0 -1
- package/dist/services/vcs/constants.js.map +0 -1
- package/dist/services/vcs/github.d.ts.map +0 -1
- package/dist/services/vcs/github.js.map +0 -1
- package/dist/services/vcs/types.d.ts.map +0 -1
- package/dist/services/vcs/types.js.map +0 -1
- package/dist/services/version-check.d.ts.map +0 -1
- package/dist/services/version-check.js.map +0 -1
- package/dist/services/watch/fleet-log.d.ts.map +0 -1
- package/dist/services/watch/fleet-log.js.map +0 -1
- package/dist/services/watch/project-resolver.d.ts.map +0 -1
- package/dist/services/watch/project-resolver.js.map +0 -1
- package/dist/services/watch/transcript-formatter.d.ts.map +0 -1
- package/dist/services/watch/transcript-formatter.js.map +0 -1
- package/dist/smoke-test.d.ts.map +0 -1
- package/dist/smoke-test.js.map +0 -1
- package/dist/tools/check-status.d.ts.map +0 -1
- package/dist/tools/check-status.js.map +0 -1
- package/dist/tools/child-id-allocator.d.ts.map +0 -1
- package/dist/tools/child-id-allocator.js.map +0 -1
- package/dist/tools/cloud-control.d.ts.map +0 -1
- package/dist/tools/cloud-control.js.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.d.ts.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.js.map +0 -1
- package/dist/tools/code-intelligence-freshness.d.ts.map +0 -1
- package/dist/tools/code-intelligence-freshness.js.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.js.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.d.ts.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.js.map +0 -1
- package/dist/tools/code-intelligence-reindex.d.ts.map +0 -1
- package/dist/tools/code-intelligence-reindex.js.map +0 -1
- package/dist/tools/code-intelligence-telemetry.d.ts.map +0 -1
- package/dist/tools/code-intelligence-telemetry.js.map +0 -1
- package/dist/tools/code-intelligence-tests.d.ts.map +0 -1
- package/dist/tools/code-intelligence-tests.js.map +0 -1
- package/dist/tools/code-intelligence.d.ts.map +0 -1
- package/dist/tools/code-intelligence.js.map +0 -1
- package/dist/tools/compose-permissions.d.ts.map +0 -1
- package/dist/tools/compose-permissions.js.map +0 -1
- package/dist/tools/credential-store-delete.d.ts.map +0 -1
- package/dist/tools/credential-store-delete.js.map +0 -1
- package/dist/tools/credential-store-list.d.ts.map +0 -1
- package/dist/tools/credential-store-list.js.map +0 -1
- package/dist/tools/credential-store-set.d.ts.map +0 -1
- package/dist/tools/credential-store-set.js.map +0 -1
- package/dist/tools/credential-store-update.d.ts.map +0 -1
- package/dist/tools/credential-store-update.js.map +0 -1
- package/dist/tools/dolt-push-mutex.d.ts.map +0 -1
- package/dist/tools/dolt-push-mutex.js.map +0 -1
- package/dist/tools/execute-command.d.ts.map +0 -1
- package/dist/tools/execute-command.js.map +0 -1
- package/dist/tools/execute-prompt.d.ts.map +0 -1
- package/dist/tools/execute-prompt.js.map +0 -1
- package/dist/tools/get-member-model-pricing.d.ts.map +0 -1
- package/dist/tools/get-member-model-pricing.js.map +0 -1
- package/dist/tools/kb-capture.d.ts.map +0 -1
- package/dist/tools/kb-capture.js.map +0 -1
- package/dist/tools/kb-context.d.ts.map +0 -1
- package/dist/tools/kb-context.js.map +0 -1
- package/dist/tools/kb-export.d.ts.map +0 -1
- package/dist/tools/kb-export.js.map +0 -1
- package/dist/tools/kb-feedback.d.ts.map +0 -1
- package/dist/tools/kb-feedback.js.map +0 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +0 -1
- package/dist/tools/kb-freshness-sweep.js.map +0 -1
- package/dist/tools/kb-harvest.d.ts.map +0 -1
- package/dist/tools/kb-harvest.js.map +0 -1
- package/dist/tools/kb-import.d.ts.map +0 -1
- package/dist/tools/kb-import.js.map +0 -1
- package/dist/tools/kb-invalidate.d.ts.map +0 -1
- package/dist/tools/kb-invalidate.js.map +0 -1
- package/dist/tools/kb-list.d.ts.map +0 -1
- package/dist/tools/kb-list.js.map +0 -1
- package/dist/tools/kb-promote.d.ts.map +0 -1
- package/dist/tools/kb-promote.js.map +0 -1
- package/dist/tools/kb-query.d.ts.map +0 -1
- package/dist/tools/kb-query.js.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +0 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +0 -1
- package/dist/tools/kb-resolve-contradiction.js.map +0 -1
- package/dist/tools/kb-session-prime.d.ts.map +0 -1
- package/dist/tools/kb-session-prime.js.map +0 -1
- package/dist/tools/kb-setup.d.ts.map +0 -1
- package/dist/tools/kb-setup.js.map +0 -1
- package/dist/tools/kb-stats.d.ts.map +0 -1
- package/dist/tools/kb-stats.js.map +0 -1
- package/dist/tools/list-members.d.ts.map +0 -1
- package/dist/tools/list-members.js.map +0 -1
- package/dist/tools/member-detail.d.ts.map +0 -1
- package/dist/tools/member-detail.js.map +0 -1
- package/dist/tools/member-reservation.d.ts.map +0 -1
- package/dist/tools/member-reservation.js.map +0 -1
- package/dist/tools/monitor-task.d.ts.map +0 -1
- package/dist/tools/monitor-task.js.map +0 -1
- package/dist/tools/provision-auth.d.ts.map +0 -1
- package/dist/tools/provision-auth.js.map +0 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +0 -1
- package/dist/tools/provision-vcs-auth.js.map +0 -1
- package/dist/tools/receive-files.d.ts.map +0 -1
- package/dist/tools/receive-files.js.map +0 -1
- package/dist/tools/register-member.d.ts.map +0 -1
- package/dist/tools/register-member.js.map +0 -1
- package/dist/tools/remove-member.d.ts.map +0 -1
- package/dist/tools/remove-member.js.map +0 -1
- package/dist/tools/report-status.d.ts.map +0 -1
- package/dist/tools/report-status.js.map +0 -1
- package/dist/tools/respond-to-message.d.ts.map +0 -1
- package/dist/tools/respond-to-message.js.map +0 -1
- package/dist/tools/revoke-vcs-auth.d.ts.map +0 -1
- package/dist/tools/revoke-vcs-auth.js.map +0 -1
- package/dist/tools/send-email.d.ts.map +0 -1
- package/dist/tools/send-email.js.map +0 -1
- package/dist/tools/send-files.d.ts.map +0 -1
- package/dist/tools/send-files.js.map +0 -1
- package/dist/tools/send-message.d.ts.map +0 -1
- package/dist/tools/send-message.js.map +0 -1
- package/dist/tools/setup-git-app.d.ts.map +0 -1
- package/dist/tools/setup-git-app.js.map +0 -1
- package/dist/tools/setup-ssh-key.d.ts.map +0 -1
- package/dist/tools/setup-ssh-key.js.map +0 -1
- package/dist/tools/shutdown-server.d.ts.map +0 -1
- package/dist/tools/shutdown-server.js.map +0 -1
- package/dist/tools/stop-prompt.d.ts.map +0 -1
- package/dist/tools/stop-prompt.js.map +0 -1
- package/dist/tools/update-agent-cli.d.ts.map +0 -1
- package/dist/tools/update-agent-cli.js.map +0 -1
- package/dist/tools/update-member.d.ts.map +0 -1
- package/dist/tools/update-member.js.map +0 -1
- package/dist/tools/vcs-credential-exec.d.ts.map +0 -1
- package/dist/tools/vcs-credential-exec.js.map +0 -1
- package/dist/tools/version.d.ts.map +0 -1
- package/dist/tools/version.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/agent-helpers.d.ts.map +0 -1
- package/dist/utils/agent-helpers.js.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/auth-env.d.ts.map +0 -1
- package/dist/utils/auth-env.js.map +0 -1
- package/dist/utils/collect-secret.d.ts.map +0 -1
- package/dist/utils/collect-secret.js.map +0 -1
- package/dist/utils/credential-validation.d.ts.map +0 -1
- package/dist/utils/credential-validation.js.map +0 -1
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js.map +0 -1
- package/dist/utils/deep-merge.d.ts.map +0 -1
- package/dist/utils/deep-merge.js.map +0 -1
- package/dist/utils/file-permissions.d.ts.map +0 -1
- package/dist/utils/file-permissions.js.map +0 -1
- package/dist/utils/gpu-parser.d.ts.map +0 -1
- package/dist/utils/gpu-parser.js.map +0 -1
- package/dist/utils/log-helpers.d.ts.map +0 -1
- package/dist/utils/log-helpers.js.map +0 -1
- package/dist/utils/oob-timeout.d.ts.map +0 -1
- package/dist/utils/oob-timeout.js.map +0 -1
- package/dist/utils/opencode-model-validation.d.ts.map +0 -1
- package/dist/utils/opencode-model-validation.js.map +0 -1
- package/dist/utils/pid-helpers.d.ts.map +0 -1
- package/dist/utils/pid-helpers.js.map +0 -1
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/process-utils.d.ts.map +0 -1
- package/dist/utils/process-utils.js.map +0 -1
- package/dist/utils/prompt-errors.d.ts.map +0 -1
- package/dist/utils/prompt-errors.js.map +0 -1
- package/dist/utils/resolve-member.d.ts.map +0 -1
- package/dist/utils/resolve-member.js.map +0 -1
- package/dist/utils/secure-input.d.ts.map +0 -1
- package/dist/utils/secure-input.js.map +0 -1
- package/dist/utils/session-caller.d.ts.map +0 -1
- package/dist/utils/session-caller.js.map +0 -1
- package/dist/utils/shell-escape.d.ts.map +0 -1
- package/dist/utils/shell-escape.js.map +0 -1
- package/dist/utils/skill-matrix.d.ts.map +0 -1
- package/dist/utils/skill-matrix.js.map +0 -1
- package/dist/utils/ssh-error-messages.d.ts.map +0 -1
- package/dist/utils/ssh-error-messages.js.map +0 -1
- package/dist/utils/vcs-provider-detect.d.ts.map +0 -1
- package/dist/utils/vcs-provider-detect.js.map +0 -1
- package/dist/utils/work-folder-validation.d.ts.map +0 -1
- package/dist/utils/work-folder-validation.js.map +0 -1
- package/dist/utils/workspace-trust.d.ts.map +0 -1
- package/dist/utils/workspace-trust.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
|
@@ -56,6 +56,10 @@ import {
|
|
|
56
56
|
import { getSeCommands } from './se-os-commands.mjs';
|
|
57
57
|
import { resultText, toolErrorText } from './mcp-result.mjs';
|
|
58
58
|
import { resolveMemberTarget, resolveMemberOs, clearMemberOsCache } from './member-target.mjs';
|
|
59
|
+
import { createMemberCall, buildRemoteCallCommand, MemberCallError, MEMBER_CALL_ARGS_DIR } from './member-call.mjs';
|
|
60
|
+
import { createDispatchAccounting } from './dispatch-accounting.mjs';
|
|
61
|
+
import { lowerQuality, logLowerQualityWarn } from './lower-quality.mjs';
|
|
62
|
+
import { createMemberInitProbe, createMemberVerifiedLookup, MEMBER_INIT_LOG_PREFIX, MEMBER_INIT_STATE_NAMESPACE } from './member-init-probe.mjs';
|
|
59
63
|
import { createSprintState, sprintScopedFleetApi, resolveSettleShellWith } from './sprint-state.mjs';
|
|
60
64
|
// apra-fleet-3swo.6.10: the per-member git/dolt sync brackets, moved verbatim
|
|
61
65
|
// out of this file into ./member-sync.mjs (see that module's header for the
|
|
@@ -81,6 +85,8 @@ import {
|
|
|
81
85
|
import {
|
|
82
86
|
createMemberSessionGuard, createUnattendedAutoProvisioner,
|
|
83
87
|
createDeployPermissionsProvisioner, stageCommandBodyMemberSide,
|
|
88
|
+
createPermissionConfigPreflight,
|
|
89
|
+
createPermissionDenialHeal, permissionLedgerFolder,
|
|
84
90
|
} from './member-provisioning.mjs';
|
|
85
91
|
import {
|
|
86
92
|
parseOwnerRepoFromRemoteUrl, parseRepoScopeFromRemoteUrl, vcsCredentialLabelForProvider,
|
|
@@ -93,8 +99,11 @@ import {
|
|
|
93
99
|
createWorkflowsPermissionPreflightCallback,
|
|
94
100
|
createLlmAuthSelfHealCallback,
|
|
95
101
|
} from './vcs-auth.mjs';
|
|
96
|
-
import { validateIssueId, validateBranchName, validateArgs } from './sprint-args.mjs';
|
|
97
|
-
import { verifyBeadsIdentity } from './beads-identity-check.mjs';
|
|
102
|
+
import { validateIssueId, validateBranchName, validateBranchPair, validateArgs } from './sprint-args.mjs';
|
|
103
|
+
import { verifyBeadsIdentity, createBeadsIdentityProber, BEADS_READING_ROLES } from './beads-identity-check.mjs';
|
|
104
|
+
import { ROLE_BACKLOG, selectBacklogMember, formatBacklogSelection } from './backlog-role.mjs';
|
|
105
|
+
import { createKbMaintainerSelector, createMemberDetailResolver, ROLE_KB_MAINTAINER } from './kb-maintainer.mjs';
|
|
106
|
+
import { sweepTokenMemories } from './beads-memory-hygiene.mjs';
|
|
98
107
|
import {
|
|
99
108
|
buildPlannerPrompt, buildPlanReviewerPrompt, buildStreakAssignmentPrompt, buildDoerPrompt,
|
|
100
109
|
buildReviewerPrompt, buildFinalVerdictPrompt, buildHarvesterPrompt,
|
|
@@ -125,7 +134,7 @@ import { dispatchRole, TURN_BASES } from './dispatch-role.mjs';
|
|
|
125
134
|
// log line, the bound the row itself sets -- never to re-implement a ladder.
|
|
126
135
|
// USAGE_LIMIT_BUDGET_DEFAULTS is the usage-limit controller's budget row,
|
|
127
136
|
// recorded as data in the same table (apra-fleet-hzeb.4.1/.4.2).
|
|
128
|
-
import { policyFor, USAGE_LIMIT_BUDGET_DEFAULTS } from './role-policies.mjs';
|
|
137
|
+
import { policyFor, USAGE_LIMIT_BUDGET_DEFAULTS, agentTypeAppliesKbCaptures } from './role-policies.mjs';
|
|
129
138
|
// apra-fleet-hzeb.4.2: the usage-limit pause/resume/re-probe controller wired
|
|
130
139
|
// into the dispatchRole engine as ctx.onUsageLimit below.
|
|
131
140
|
import { createUsageLimitPauseController } from './usage-limit-controller.mjs';
|
|
@@ -153,7 +162,7 @@ import { runDevelopPhase } from './phases/develop.mjs';
|
|
|
153
162
|
// around Deploy, and the dashboard/still-open loop control after Review,
|
|
154
163
|
// stayed here.
|
|
155
164
|
import { runReviewPhase } from './phases/review.mjs';
|
|
156
|
-
import { runDeployPhase } from './phases/deploy.mjs';
|
|
165
|
+
import { runDeployPhase, latestDeployFailure, formatDeployFailureReason, DEPLOY_RETRY_CYCLE_LIMIT } from './phases/deploy.mjs';
|
|
157
166
|
// apra-fleet-3swo.6.8: the next two phase() boundaries -- the per-cycle Integ
|
|
158
167
|
// Test and the Re-Review that Cycle Evaluation dispatches when the goal-
|
|
159
168
|
// priority count already reads 0 but no review ran this cycle. Integ Test is
|
|
@@ -188,7 +197,7 @@ import { runRegressionTestPhase } from './phases/regression-test.mjs';
|
|
|
188
197
|
// return value is its own contract, and group('Finalization')/endGroup() wrap
|
|
189
198
|
// all four Finalization phases rather than either of these two). Their ORDER
|
|
190
199
|
// is load-bearing: the harvester is a code-writing role whose
|
|
191
|
-
// docs/
|
|
200
|
+
// docs/sprint-analysis commits must be G-pushed by its own policy
|
|
192
201
|
// bracket before Publish PR pushes the branch and raises the PR a human reads.
|
|
193
202
|
// See each module's header for where its boundary is drawn.
|
|
194
203
|
import { runHarvestPhase } from './phases/harvest.mjs';
|
|
@@ -201,8 +210,7 @@ import {
|
|
|
201
210
|
createMcpDoltPushMutexClient, createMcpChildIdAllocatorClient,
|
|
202
211
|
createMemberReservationClient,
|
|
203
212
|
} from './coordination.mjs';
|
|
204
|
-
// The KB work concern: the
|
|
205
|
-
// kb_query read, kb_captures/kb_promotions vetting and forwarding, and the
|
|
213
|
+
// The KB work concern: the per-dispatch kb_query read, kb_captures/kb_promotions vetting and forwarding, and the
|
|
206
214
|
// canonical-bible publish. Moved verbatim out of runner.js
|
|
207
215
|
// (apra-fleet-3swo.4.4). KB_MAX_KNOWLEDGE_ENTRIES is imported back here so it
|
|
208
216
|
// can be re-exported below for existing importers of runner.js.
|
|
@@ -215,13 +223,15 @@ import {
|
|
|
215
223
|
// check, the per-dispatch kb_query FTS terms, and the two "KNOWLEDGE BANK"
|
|
216
224
|
// prompt blocks). Moved verbatim out of runner.js into the existing
|
|
217
225
|
// kb.mjs (apra-fleet-3swo.6.11) -- kb.mjs already owned the rest of the KB
|
|
218
|
-
// surface (createKbWorkClient,
|
|
226
|
+
// surface (createKbWorkClient, vetKbWork, the KB_* limit
|
|
219
227
|
// constants), so these five join that single home rather than starting a
|
|
220
228
|
// second one.
|
|
221
229
|
import {
|
|
222
230
|
createKbPrimingClient, KB_SELF_INJECTING_ROLES, kbQueryTerms,
|
|
223
231
|
kbKnowledgeBlock, kbPromotionBlock,
|
|
224
232
|
} from './kb.mjs';
|
|
233
|
+
import { createKbInjection } from './kb-injection.mjs';
|
|
234
|
+
import { pathsFromText, isPriorityTierToken } from './kb-hints.mjs';
|
|
225
235
|
// Beads scope discovery + the shared full-DB snapshot: the single in-memory
|
|
226
236
|
// BFS scope rule (now shared by bdListScoped and classifyVerifySet instead of
|
|
227
237
|
// duplicated), the `bd list --all --limit 0 --json` snapshot, and the
|
|
@@ -234,6 +244,9 @@ import {
|
|
|
234
244
|
// moved here from runner.js; imported back and re-exported (facade region
|
|
235
245
|
// below) so no importer of runner.js is edited by the move.
|
|
236
246
|
parseBdJson, goalPriorityMax, partitionByGoalMembership,
|
|
247
|
+
// Develop-dispatch goal filter: below-goal ready leaves are excluded
|
|
248
|
+
// unless they block in-goal work or the sprint already worked on them.
|
|
249
|
+
partitionReadyByGoal, formatBelowGoalExclusionLog,
|
|
237
250
|
// apra-fleet-rp7a.1: the deferred split the Cycle Evaluation completion
|
|
238
251
|
// math and phases/final-review.mjs's closing count BOTH apply, so the two
|
|
239
252
|
// cannot drift apart. See its own doc comment for why 'deferred' -- and
|
|
@@ -297,6 +310,15 @@ import {
|
|
|
297
310
|
// (apra-fleet-3swo.6.15); imported only to be re-exported below, unchanged, so
|
|
298
311
|
// no importer of runner.js is edited by the move.
|
|
299
312
|
import { DEFAULT_CONTEXT_CEILING, createRoundSessionRegistry } from './round-session.mjs';
|
|
313
|
+
// GitHub #715: run-scoped bookkeeping of beads THIS sprint's doers were
|
|
314
|
+
// dispatched on, so a claim a failed doer of this run left in_progress is
|
|
315
|
+
// re-laned in the same sprint (see reclaimInRunOrphanedClaims below).
|
|
316
|
+
import { createOrphanClaimTracker } from './orphan-reclaim.mjs';
|
|
317
|
+
// GitHub #717: the verify-block deadlock diagnosis -- a bead blocked only by
|
|
318
|
+
// verify-routed beads while the Integration Test phase cannot run.
|
|
319
|
+
import {
|
|
320
|
+
integCanRun, integBlockCause, findVerifyBlockedBeads, partitionByGoal, buildVerifyBlockDiagnosis,
|
|
321
|
+
} from './verify-block.mjs';
|
|
300
322
|
// The dispatch-outcome classification surface: isTerminalSprintFailure,
|
|
301
323
|
// isNoMutationDispatchFailure and withDispatchWatchdog. Extracted out of
|
|
302
324
|
// runner.js (apra-fleet-3swo.6.15); imported only to be re-exported below,
|
|
@@ -338,7 +360,7 @@ export {
|
|
|
338
360
|
// Re-exported so importers of the CLI arg-contract validators from runner.js
|
|
339
361
|
// keep working (notably bin/cli.mjs); sprint-args.mjs is the single source of
|
|
340
362
|
// truth for their implementation (apra-fleet-3swo.3.3).
|
|
341
|
-
export { validateIssueId, validateBranchName, validateArgs };
|
|
363
|
+
export { validateIssueId, validateBranchName, validateBranchPair, validateArgs };
|
|
342
364
|
// Re-exported so importers of the five previously-exported prompt builders
|
|
343
365
|
// from runner.js keep working; prompts.mjs is the single source of truth for
|
|
344
366
|
// their implementation (apra-fleet-3swo.3.4). buildPlanReviewerPrompt and
|
|
@@ -376,8 +398,8 @@ export {
|
|
|
376
398
|
createMcpDoltPushMutexClient, createMcpChildIdAllocatorClient,
|
|
377
399
|
createMemberReservationClient,
|
|
378
400
|
};
|
|
379
|
-
// Re-exported so importers of the KB work helpers (
|
|
380
|
-
// kb_capture/kb_promote vetting+forwarding,
|
|
401
|
+
// Re-exported so importers of the KB work helpers (kb_query,
|
|
402
|
+
// kb_capture/kb_promote vetting+forwarding, the bible commit) from runner.js keep
|
|
381
403
|
// working; kb.mjs is the single source of truth for their implementation
|
|
382
404
|
// (apra-fleet-3swo.4.4).
|
|
383
405
|
export {
|
|
@@ -392,6 +414,10 @@ export {
|
|
|
392
414
|
createKbPrimingClient, KB_SELF_INJECTING_ROLES, kbQueryTerms,
|
|
393
415
|
kbKnowledgeBlock, kbPromotionBlock,
|
|
394
416
|
};
|
|
417
|
+
// member-call.mjs is the single owner of memberCall/listTools (a MEMBER-scoped
|
|
418
|
+
// tool call: local in-process session, or remote/relay via send_files +
|
|
419
|
+
// execute_command of `apra-fleet call`). Re-exported on the runner facade.
|
|
420
|
+
export { createMemberCall, buildRemoteCallCommand, MemberCallError, MEMBER_CALL_ARGS_DIR };
|
|
395
421
|
// Re-exported so importers of the verify-set classifier from runner.js keep
|
|
396
422
|
// working; beads-scope.mjs is the single source of truth for its
|
|
397
423
|
// implementation, and for the BFS scope-discovery rule it now shares with
|
|
@@ -493,6 +519,39 @@ function resolveDispatchInactivityTimeoutS(dispatchTimeoutS) {
|
|
|
493
519
|
}
|
|
494
520
|
export { resolveDispatchInactivityTimeoutS };
|
|
495
521
|
|
|
522
|
+
// The members the sprint-branch ensure (and every per-cycle re-ensure) runs
|
|
523
|
+
// on: every member of a dispatched git-touching role, plus every selected
|
|
524
|
+
// kb_maintainer -- it G-pulls, bible-commits and G-pushes the sprint branch
|
|
525
|
+
// even when it holds no dispatched role (selection prefers such a member).
|
|
526
|
+
// De-duplicated, roles first. A selector without maintainers() (an injected
|
|
527
|
+
// stub) or a repository with no selected maintainer contributes nothing.
|
|
528
|
+
// Exported so tests drive the production list, not a re-derivation of it.
|
|
529
|
+
// backlogMembers (the backlog role, roleMap.backlog -- formerly the
|
|
530
|
+
// orchestrator alias, see backlog-role.mjs): such a member is never added
|
|
531
|
+
// through the maintainer path (defence in depth); a dispatch role still
|
|
532
|
+
// includes it.
|
|
533
|
+
function computeBranchEnsureMembers(getMembersForRole, kbMaintainers, backlogMembers) {
|
|
534
|
+
const backlogSet = new Set(backlogMembers || []);
|
|
535
|
+
const maintainerMembers = [];
|
|
536
|
+
if (kbMaintainers && typeof kbMaintainers.maintainers === 'function') {
|
|
537
|
+
for (const sel of kbMaintainers.maintainers().values()) {
|
|
538
|
+
if (sel && typeof sel.member === 'string' && sel.member && !backlogSet.has(sel.member)) maintainerMembers.push(sel.member);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return [...new Set([
|
|
542
|
+
...getMembersForRole(ROLE_DOER),
|
|
543
|
+
...getMembersForRole(ROLE_REVIEWER),
|
|
544
|
+
...getMembersForRole('planner'),
|
|
545
|
+
...getMembersForRole('plan-reviewer'),
|
|
546
|
+
...getMembersForRole('deployer'),
|
|
547
|
+
...getMembersForRole('integ-test-runner'),
|
|
548
|
+
...getMembersForRole('regression-test-runner'),
|
|
549
|
+
...getMembersForRole('harvester'),
|
|
550
|
+
...maintainerMembers,
|
|
551
|
+
])];
|
|
552
|
+
}
|
|
553
|
+
export { computeBranchEnsureMembers };
|
|
554
|
+
|
|
496
555
|
// ---------------------------------------------------------------------------
|
|
497
556
|
// Canonical role-name constants for the Develop/Review loop
|
|
498
557
|
// ---------------------------------------------------------------------------
|
|
@@ -511,10 +570,10 @@ const ROLE_DOER = roleConst('doer');
|
|
|
511
570
|
const ROLE_REVIEWER = roleConst('reviewer');
|
|
512
571
|
|
|
513
572
|
// ---------------------------------------------------------------------------
|
|
514
|
-
// '
|
|
573
|
+
// 'backlog' pseudo-role
|
|
515
574
|
// ---------------------------------------------------------------------------
|
|
516
575
|
//
|
|
517
|
-
// 'orchestrator' is deliberately NOT a member of `contracts.ROLES` and must
|
|
576
|
+
// 'backlog' (formerly 'orchestrator', see backlog-role.mjs) is deliberately NOT a member of `contracts.ROLES` and must
|
|
518
577
|
// never be added to it: that enum is vendored (it mirrors the `name:`
|
|
519
578
|
// frontmatter of packages/apra-fleet-se/apra-pm/agents/*.md 1:1) and this repo
|
|
520
579
|
// must not diverge from it. 'orchestrator' has no agent definition, no
|
|
@@ -527,7 +586,6 @@ const ROLE_REVIEWER = roleConst('reviewer');
|
|
|
527
586
|
// a `bd show`-derived model-metadata lookup or any vendored schema table.
|
|
528
587
|
// Always reference it via this constant (the canonical lowercase form) rather
|
|
529
588
|
// than a literal, so a roleMap author's lowercase key is always honored.
|
|
530
|
-
const ROLE_ORCHESTRATOR = 'orchestrator';
|
|
531
589
|
|
|
532
590
|
// ---------------------------------------------------------------------------
|
|
533
591
|
// Fixed-role tier defaults
|
|
@@ -546,7 +604,7 @@ const ROLE_ORCHESTRATOR = 'orchestrator';
|
|
|
546
604
|
// deployer -> 'standard' (mostly mechanical: follow deploy.md)
|
|
547
605
|
// integ-test-runner -> 'standard' (mostly mechanical: follow integ-test-playbook.md)
|
|
548
606
|
// regression-test-runner -> 'standard' (mostly mechanical: follow regression-test-playbook.md)
|
|
549
|
-
// harvester -> 'standard' (docs
|
|
607
|
+
// harvester -> 'standard' (docs synthesis, not code-critical)
|
|
550
608
|
// These tier keywords ('cheap' | 'standard' | 'premium') are resolved to a
|
|
551
609
|
// concrete model PER MEMBER, server-side, by execute-prompt.ts's
|
|
552
610
|
// resolveModelForTier() (via each member's registered model_tiers). That is
|
|
@@ -857,11 +915,11 @@ async function runSprintCycle(context) {
|
|
|
857
915
|
targetIssues: validated.targetIssues,
|
|
858
916
|
assignee: validated.assignee,
|
|
859
917
|
parseBdJson,
|
|
860
|
-
// A getter, not a value: `
|
|
918
|
+
// A getter, not a value: `backlogMember` is resolved from the
|
|
861
919
|
// role->member mapping further down this function, but this client
|
|
862
920
|
// has to exist BEFORE `command` does. No beads read can happen in
|
|
863
921
|
// between, so the getter is always called on a resolved value.
|
|
864
|
-
|
|
922
|
+
getBacklogMember: () => backlogMember,
|
|
865
923
|
});
|
|
866
924
|
const { invalidateAllBeadsCache, fetchAllBeadsShared, bdListScoped } = beadsScope;
|
|
867
925
|
const command = beadsScope.wrapCommand(rawCommand, {
|
|
@@ -925,18 +983,69 @@ async function runSprintCycle(context) {
|
|
|
925
983
|
// in withGitSync (which awaits this promise before syncing) on success
|
|
926
984
|
// AND on failure, and covers the dispatches outside withGitSync too
|
|
927
985
|
// (Streak Assignment).
|
|
986
|
+
// Assigned once kbPriming exists (below); until then (no dispatch can run
|
|
987
|
+
// before it) a pass-through.
|
|
988
|
+
let dispatchAccounting = { around: (_info, fn) => fn() };
|
|
989
|
+
// KNOWLEDGE BANK injection (kb-injection.mjs), bound once kbWork exists
|
|
990
|
+
// below; sprint-level hint sources the dispatch wrapper falls back to.
|
|
991
|
+
let kbInjection = null;
|
|
992
|
+
const kbSprintContext = { goals: [], beadTitles: [], closedBeadTitles: [], beadIds: [], testFiles: [] };
|
|
993
|
+
// bead id -> bead, refreshed with the sprint tree; the reviewer's hint
|
|
994
|
+
// sources (titles of the beads under review) are read from it.
|
|
995
|
+
let kbBeadIndex = new Map();
|
|
996
|
+
const kbBeadTitles = (ids) => (Array.isArray(ids) ? ids : []).map((id) => kbBeadIndex.get(id)?.title).filter((t) => typeof t === 'string' && t);
|
|
928
997
|
const agent = async (prompt, opts = {}) => {
|
|
929
998
|
let finalPrompt = prompt;
|
|
930
999
|
if (opts.agentType && !KB_SELF_INJECTING_ROLES.has(opts.agentType) && opts.member_name) {
|
|
931
|
-
|
|
1000
|
+
// Only promise the kb_captures channel to a persona whose returned
|
|
1001
|
+
// captures the engine actually applies (e.g. harvester); planner,
|
|
1002
|
+
// plan-reviewer, deployer and the test runners have none.
|
|
1003
|
+
// A member whose own fleet MCP was verified at sprint init reads
|
|
1004
|
+
// the KB itself and gets no block; every other member gets one,
|
|
1005
|
+
// fetched from the repository's kb_maintainer (kb-injection.mjs).
|
|
1006
|
+
const captureChannel = agentTypeAppliesKbCaptures(opts.agentType);
|
|
1007
|
+
const [block] = kbInjection
|
|
1008
|
+
? await kbInjection.blockFor({
|
|
1009
|
+
role: opts.agentType,
|
|
1010
|
+
member: opts.member_name,
|
|
1011
|
+
context: { ...kbSprintContext, ...(opts.kbContext || {}) },
|
|
1012
|
+
captureChannel,
|
|
1013
|
+
})
|
|
1014
|
+
: kbKnowledgeBlock(kbPriming.knowledgeOf(opts.member_name), { captureChannel });
|
|
932
1015
|
if (block) finalPrompt = prompt + '\n\n' + block;
|
|
933
1016
|
}
|
|
1017
|
+
return withKbDispatchLifecycle(opts.member_name, async () => {
|
|
1018
|
+
try {
|
|
1019
|
+
// Per-dispatch kb_* and code_* counts: session_stats snapshots of the
|
|
1020
|
+
// dispatched member immediately before and after (best-effort;
|
|
1021
|
+
// an unreadable count is recorded as unknown, never 0).
|
|
1022
|
+
return await dispatchAccounting.around(
|
|
1023
|
+
{ memberName: opts.member_name, role: opts.agentType, label: opts.label },
|
|
1024
|
+
() => agentRaw(finalPrompt, { sprint_id: sprintMutexId, ...opts }),
|
|
1025
|
+
);
|
|
1026
|
+
} finally {
|
|
1027
|
+
if (opts.member_name) DoltSync.noteMemberDispatchCompleted(opts.member_name);
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
// KB write queue dispatch lifecycle (kb.mjs createKbWorkClient): bound
|
|
1033
|
+
// once kbWork exists below. A member is BUSY for the whole of every
|
|
1034
|
+
// dispatch -- the agent() call here and, through the withGitSync alias,
|
|
1035
|
+
// its entire sync bracket -- so a KB write for a repository it maintains
|
|
1036
|
+
// is never applied during one; the end of its last open dispatch applies
|
|
1037
|
+
// what queued up behind it. The hooks never throw (kbWork logs and keeps
|
|
1038
|
+
// writes queued instead), so they cannot replace a dispatch's own result.
|
|
1039
|
+
let kbDispatchHooks = null;
|
|
1040
|
+
async function withKbDispatchLifecycle(memberName, fn) {
|
|
1041
|
+
const hooks = memberName ? kbDispatchHooks : null;
|
|
1042
|
+
if (hooks) await hooks.started(memberName);
|
|
934
1043
|
try {
|
|
935
|
-
return await
|
|
1044
|
+
return await fn();
|
|
936
1045
|
} finally {
|
|
937
|
-
if (
|
|
1046
|
+
if (hooks) await hooks.ended(memberName);
|
|
938
1047
|
}
|
|
939
|
-
}
|
|
1048
|
+
}
|
|
940
1049
|
|
|
941
1050
|
// The global dolt push mutex client. Every D-push below serializes through
|
|
942
1051
|
// it so two sprints never push at the same time. Four sources, in
|
|
@@ -1111,7 +1220,9 @@ async function runSprintCycle(context) {
|
|
|
1111
1220
|
const ensureVcsAuthFresh = context.ensureVcsAuthFresh ?? (
|
|
1112
1221
|
(args && typeof args.callTool === 'function')
|
|
1113
1222
|
? createVcsAuthPreflightCallback({ callTool: args.callTool, command, log, azdevopsPatSecretName: validated.azdevopsPatSecretName })
|
|
1114
|
-
: async () => {
|
|
1223
|
+
: async (member) => {
|
|
1224
|
+
log(`[Sync] preflight: provision_vcs_auth skipped for member '${member}': no callTool wired -- no proactive preflight (the reactive self-heal is the only auth recovery).`);
|
|
1225
|
+
}
|
|
1115
1226
|
);
|
|
1116
1227
|
|
|
1117
1228
|
// Sync-step "does this push touch .github/workflows without the
|
|
@@ -1260,31 +1371,213 @@ async function runSprintCycle(context) {
|
|
|
1260
1371
|
// the Step 0 Knowledge Bank block in every role contract has something warm
|
|
1261
1372
|
// to read. This engine had no KB priming at all -- it lived only in the
|
|
1262
1373
|
// Claude workflow copy. Best-effort: a cold KB never fails a sprint.
|
|
1374
|
+
//
|
|
1375
|
+
// Every member-targeted kb_* call runs AS that member (memberCall: a
|
|
1376
|
+
// member-scoped session, so the KB resolves the member's own work folder;
|
|
1377
|
+
// no kb_* tool takes a repo/scope argument). The orchestrator's callTool
|
|
1378
|
+
// is only used for member_detail. context.memberCall is a test seam.
|
|
1379
|
+
// Built lazily, on the first kb call, so a sprint that never reaches one
|
|
1380
|
+
// constructs nothing extra.
|
|
1381
|
+
let memberCaller = context.memberCall ?? null;
|
|
1382
|
+
const canMemberCall = !!memberCaller || !!(args && typeof args.callTool === 'function');
|
|
1383
|
+
const kbMemberCall = canMemberCall
|
|
1384
|
+
? (member, tool, toolArgs, callOpts) => {
|
|
1385
|
+
memberCaller ??= createMemberCall({ fleetApi: sprintScopedFleetApi({ callTool: args.callTool, log }), log });
|
|
1386
|
+
// callOpts carries the kb_maintainer grant (kb.mjs passes it only
|
|
1387
|
+
// when calling as a repository's kb_maintainer).
|
|
1388
|
+
return callOpts === undefined
|
|
1389
|
+
? memberCaller.memberCall(member, tool, toolArgs)
|
|
1390
|
+
: memberCaller.memberCall(member, tool, toolArgs, callOpts);
|
|
1391
|
+
}
|
|
1392
|
+
: undefined;
|
|
1393
|
+
// One beads-identity prober per run, shared by kb_maintainer selection
|
|
1394
|
+
// (which reads each member's origin remote from it) and the beads identity
|
|
1395
|
+
// precondition below: each member's probes run once, never twice.
|
|
1396
|
+
const beadsIdentityProber = createBeadsIdentityProber({ command });
|
|
1397
|
+
|
|
1398
|
+
// kb_maintainer selection: one member per repository receives every KB
|
|
1399
|
+
// write for that repository (kb-maintainer.mjs). Computed once here --
|
|
1400
|
+
// after members are resolved, before any KB priming -- logged one line
|
|
1401
|
+
// per repository, and stored on the sprint context (context.kbMaintainers,
|
|
1402
|
+
// also the test seam) for the write-routing step and later phases. Only
|
|
1403
|
+
// members member_detail resolves to an id are probed, so a sprint without
|
|
1404
|
+
// member access issues no extra command.
|
|
1405
|
+
const kbMaintainers = context.kbMaintainers ?? createKbMaintainerSelector({
|
|
1406
|
+
members: physicalMembers,
|
|
1407
|
+
roleMap: validated.roleMap,
|
|
1408
|
+
resolveMember: (kbMemberCall && args && typeof args.callTool === 'function') ? createMemberDetailResolver(args.callTool) : undefined,
|
|
1409
|
+
probeOrigin: async (member) => (await beadsIdentityProber.probe(member)).identity.repoRemote,
|
|
1410
|
+
probeMember: kbMemberCall ? (record) => kbMemberCall(record, 'kb_stats', {}) : undefined,
|
|
1411
|
+
log,
|
|
1412
|
+
});
|
|
1413
|
+
await kbMaintainers.selectAll();
|
|
1414
|
+
context.kbMaintainers = kbMaintainers;
|
|
1415
|
+
|
|
1416
|
+
// Per-member sprint-init probe (member-init-probe.mjs): once per member,
|
|
1417
|
+
// after kb_maintainer selection and before KB priming and the first
|
|
1418
|
+
// dispatch -- start-if-down (remote), the MEMBER tools/list check plus a
|
|
1419
|
+
// recorded fleetMcp refresh, the CONFIRMED count and the code index first
|
|
1420
|
+
// tick. Every kb_*/code_* call goes through the same memberCall the KB work
|
|
1421
|
+
// uses; the orchestrator callTool only reads member_detail. Never blocks:
|
|
1422
|
+
// a probe that throws leaves every member unverified and the sprint goes
|
|
1423
|
+
// on. Records land in sprint state (sprintState.memberInit), on the
|
|
1424
|
+
// context (context.memberInit + context.isMemberVerified, read by the
|
|
1425
|
+
// KNOWLEDGE BANK injection) and in the published viewer state.
|
|
1426
|
+
// context.memberInitProbe is the test seam.
|
|
1427
|
+
const kbListTools = canMemberCall
|
|
1428
|
+
? (member) => {
|
|
1429
|
+
memberCaller ??= createMemberCall({ fleetApi: sprintScopedFleetApi({ callTool: args.callTool, log }), log });
|
|
1430
|
+
if (typeof memberCaller.listTools !== 'function') throw new Error('member session channel has no listTools');
|
|
1431
|
+
return memberCaller.listTools(member);
|
|
1432
|
+
}
|
|
1433
|
+
: undefined;
|
|
1434
|
+
// The member-call --kb-maintainer capability verdict (cached per member on
|
|
1435
|
+
// the same memberCaller the KB writes use): member-init warns about a
|
|
1436
|
+
// remote kb_maintainer whose install cannot open the grant.
|
|
1437
|
+
const kbMaintainerCapability = canMemberCall
|
|
1438
|
+
? (member) => {
|
|
1439
|
+
memberCaller ??= createMemberCall({ fleetApi: sprintScopedFleetApi({ callTool: args.callTool, log }), log });
|
|
1440
|
+
return typeof memberCaller.kbMaintainerCapability === 'function' ? memberCaller.kbMaintainerCapability(member) : 'inconclusive';
|
|
1441
|
+
}
|
|
1442
|
+
: undefined;
|
|
1443
|
+
const memberInitProbe = context.memberInitProbe ?? createMemberInitProbe({
|
|
1444
|
+
members: physicalMembers,
|
|
1445
|
+
roleMap: validated.roleMap,
|
|
1446
|
+
callTool: (args && typeof args.callTool === 'function') ? args.callTool : undefined,
|
|
1447
|
+
memberCall: kbMemberCall,
|
|
1448
|
+
listTools: kbListTools,
|
|
1449
|
+
fleetApi: sprintState.fleetApi,
|
|
1450
|
+
kbMaintainers: () => context.kbMaintainers,
|
|
1451
|
+
kbMaintainerCapability,
|
|
1452
|
+
log,
|
|
1453
|
+
});
|
|
1454
|
+
let memberInitRecords = [];
|
|
1455
|
+
try {
|
|
1456
|
+
const probed = await memberInitProbe.probeAll();
|
|
1457
|
+
memberInitRecords = Array.isArray(probed) ? probed : [];
|
|
1458
|
+
} catch (err) {
|
|
1459
|
+
log(`${MEMBER_INIT_LOG_PREFIX} WARN probe failed (non-fatal; every member is treated as unverified): ${err && err.message ? err.message : err}`);
|
|
1460
|
+
}
|
|
1461
|
+
sprintState.memberInit.splice(0, sprintState.memberInit.length, ...memberInitRecords);
|
|
1462
|
+
context.memberInit = sprintState.memberInit;
|
|
1463
|
+
context.isMemberVerified = createMemberVerifiedLookup(() => sprintState.memberInit);
|
|
1464
|
+
// Banner WARN at init (the per-member WARN lines come from the probe).
|
|
1465
|
+
logLowerQualityWarn(log, MEMBER_INIT_LOG_PREFIX, sprintState.memberInit, 'init');
|
|
1466
|
+
if (typeof publishState === 'function') {
|
|
1467
|
+
try {
|
|
1468
|
+
publishState(MEMBER_INIT_STATE_NAMESPACE, { members: sprintState.memberInit.slice(), banner: lowerQuality(sprintState.memberInit).banner });
|
|
1469
|
+
} catch (err) {
|
|
1470
|
+
log(`${MEMBER_INIT_LOG_PREFIX} could not publish the init records (non-fatal): ${err && err.message ? err.message : err}`);
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1263
1474
|
const kbPriming = context.kbPriming ?? createKbPrimingClient({
|
|
1264
1475
|
callTool: (args && typeof args.callTool === 'function') ? args.callTool : undefined,
|
|
1476
|
+
memberCall: kbMemberCall,
|
|
1265
1477
|
members: physicalMembers,
|
|
1478
|
+
// Knowledge is primed from each repository's kb_maintainer (selected
|
|
1479
|
+
// above); its bible import reads the base branch's committed bible.
|
|
1480
|
+
maintainers: () => context.kbMaintainers,
|
|
1481
|
+
baseBranch: validated.baseBranch,
|
|
1482
|
+
// A remote maintainer's kb_import must advertise `ref` (version gate).
|
|
1483
|
+
listTools: kbListTools,
|
|
1266
1484
|
log,
|
|
1267
1485
|
});
|
|
1268
1486
|
await kbPriming.primeAll();
|
|
1269
1487
|
|
|
1488
|
+
// Per-dispatch kb_* and code_* call accounting (dispatch-accounting.mjs),
|
|
1489
|
+
// used by the agent() wrapper above. Reads session_stats AS the member
|
|
1490
|
+
// through the same memberCall the kb work uses (engine-origin, so the
|
|
1491
|
+
// reads themselves are not counted); records land in sprint state and
|
|
1492
|
+
// are published to the viewer. context.dispatchAccounting is a test seam.
|
|
1493
|
+
dispatchAccounting = context.dispatchAccounting ?? createDispatchAccounting({
|
|
1494
|
+
memberCall: kbMemberCall,
|
|
1495
|
+
memberOf: (name) => (typeof kbPriming.memberOf === 'function' ? kbPriming.memberOf(name) : null),
|
|
1496
|
+
getMemberInit: (name) => sprintState.memberInit.find((r) => r && r.member === name) || null,
|
|
1497
|
+
store: sprintState.dispatchToolCalls,
|
|
1498
|
+
publishState,
|
|
1499
|
+
log,
|
|
1500
|
+
});
|
|
1501
|
+
|
|
1270
1502
|
// The role output schemas are shared with apra-pm, so every role dispatched
|
|
1271
1503
|
// below is now asked for kb_captures (and the reviewer for kb_promotions).
|
|
1272
1504
|
// This is the consumer: without it those fields would be gathered and
|
|
1273
|
-
// silently dropped. Unlike apra-pm's workflow script, this engine
|
|
1274
|
-
//
|
|
1505
|
+
// silently dropped. Unlike apra-pm's workflow script, this engine can call
|
|
1506
|
+
// tools itself, so the kb_capture/kb_promote calls are made directly.
|
|
1507
|
+
//
|
|
1508
|
+
// Every KB WRITE is routed through the producing member's repository
|
|
1509
|
+
// kb_maintainer (kbMaintainers above), never the producing member itself
|
|
1510
|
+
// and never the orchestrator's own session: queued per repository, G-pulled
|
|
1511
|
+
// on the maintainer before each batch (gitSync.pullGitBefore -- the same
|
|
1512
|
+
// syncMemberBefore every dispatch bracket opens with), and held while the
|
|
1513
|
+
// maintainer is mid-dispatch (dispatchStarted/dispatchEnded below).
|
|
1514
|
+
// gitSync is bound further down; the G-pull closure resolves it lazily,
|
|
1515
|
+
// and no KB write can be applied before the first dispatch completes.
|
|
1275
1516
|
const kbWork = context.kbWork ?? createKbWorkClient({
|
|
1276
|
-
|
|
1517
|
+
memberCall: kbMemberCall,
|
|
1518
|
+
maintainers: () => context.kbMaintainers,
|
|
1519
|
+
gPull: (maintainerName, options) => gitSync.pullGitBefore(maintainerName, options),
|
|
1520
|
+
// The review-round bible commit (kbWork.commitRound): G-push, the
|
|
1521
|
+
// retry's rebase --abort, and the base branch/commit recorded as the
|
|
1522
|
+
// bible's provenance -- all on the maintainer, all bracketed.
|
|
1523
|
+
gPush: (maintainerName) => gitSync.pushBibleCommit(maintainerName),
|
|
1524
|
+
abortRebase: (maintainerName) => gitSync.abortRebase(maintainerName),
|
|
1525
|
+
bibleBase: (maintainerName) => gitSync.resolveBibleBase(maintainerName),
|
|
1526
|
+
canResetCheckout: (maintainerName, bibleFile) => gitSync.canResetBibleCheckout(maintainerName, bibleFile),
|
|
1527
|
+
// The bible-commit branch guard: no G-pull, reset, commit or push on a
|
|
1528
|
+
// maintainer whose checkout is not the sprint branch.
|
|
1529
|
+
checkedOutBranch: (maintainerName) => gitSync.checkedOutBranch(maintainerName),
|
|
1530
|
+
// A bible push must publish only bible commit(s), never a doer's
|
|
1531
|
+
// unpushed commit underneath them.
|
|
1532
|
+
unpushedOnlyBible: (maintainerName, bibleFile) => gitSync.unpushedOnlyBible(maintainerName, bibleFile),
|
|
1533
|
+
// After a kb_bible_commit that committed nothing: does origin hold the
|
|
1534
|
+
// bible, or is an earlier round's bible commit still unpushed?
|
|
1535
|
+
bibleUnpushed: (maintainerName, bibleFile) => gitSync.bibleUnpushed(maintainerName, bibleFile),
|
|
1536
|
+
// Promotion candidates are limited to entries created since the
|
|
1537
|
+
// sprint started -- the sprint state's one start stamp.
|
|
1538
|
+
sprintStartMs: () => sprintState.startedAtMs,
|
|
1277
1539
|
log,
|
|
1278
|
-
// Scope every kb_* call below to the member's OWN project KB. The repo
|
|
1279
|
-
// path each call site already threads is a path on the MEMBER's host,
|
|
1280
|
-
// so the server cannot derive a slug from it -- without this lookup a
|
|
1281
|
-
// remote member's reads and writes all land in the shared 'default' KB
|
|
1282
|
-
// (apra-fleet-b4g.15). Resolved through the path rather than passed
|
|
1283
|
-
// per call site so no site can thread the path and forget the scope.
|
|
1284
|
-
// context.kbPriming above is an injection seam; a stub that predates
|
|
1285
|
-
// remoteUrlForPath degrades to no scope rather than crashing a sprint.
|
|
1286
|
-
remoteUrlFor: (repoPath) => (typeof kbPriming.remoteUrlForPath === 'function' ? kbPriming.remoteUrlForPath(repoPath) : null),
|
|
1287
1540
|
});
|
|
1541
|
+
// Stored on the sprint context (like kbMaintainers) so the terminal-abort
|
|
1542
|
+
// handler can seal the bible commit: an aborted sprint commits nothing
|
|
1543
|
+
// further to the bible.
|
|
1544
|
+
context.kbWork = kbWork;
|
|
1545
|
+
// Engine-side KNOWLEDGE BANK injection: skipped for a member whose own
|
|
1546
|
+
// fleet MCP was verified at sprint init (context.isMemberVerified, set by
|
|
1547
|
+
// the init probe above), applied to every other member.
|
|
1548
|
+
if (typeof validated.goal === 'string' && validated.goal.trim() && !isPriorityTierToken(validated.goal.trim())) {
|
|
1549
|
+
kbSprintContext.goals = [validated.goal.trim()];
|
|
1550
|
+
}
|
|
1551
|
+
kbInjection = context.kbInjection ?? createKbInjection({
|
|
1552
|
+
kbWork,
|
|
1553
|
+
isMemberVerified: (name) => (typeof context.isMemberVerified === 'function' ? context.isMemberVerified(name) : false),
|
|
1554
|
+
// Deploy targets: the file paths named in the runbook the role follows
|
|
1555
|
+
// (deploy.md for the deployer, the playbooks for the test runners).
|
|
1556
|
+
deployTargets: async (memberName, role) => {
|
|
1557
|
+
const file = role === 'deployer' ? 'deploy.md'
|
|
1558
|
+
: role === 'integ-test-runner' ? 'integ-test-playbook.md' : 'regression-test-playbook.md';
|
|
1559
|
+
const res = await command(
|
|
1560
|
+
`node -e "try{console.log(require('fs').readFileSync('${file}','utf8').slice(0,20000))}catch(e){}"`,
|
|
1561
|
+
{ member_name: memberName, silent: true, failSoft: true, label: `Read '${file}' for KB hints` },
|
|
1562
|
+
);
|
|
1563
|
+
if (!res || !res.ok) return [];
|
|
1564
|
+
return pathsFromText([String(res.output || '')]);
|
|
1565
|
+
},
|
|
1566
|
+
diffFiles: async (memberName) => {
|
|
1567
|
+
const res = await command(`git diff --name-only origin/${validated.baseBranch}...${validated.branch}`, { member_name: memberName, silent: true, failSoft: true });
|
|
1568
|
+
if (!res || !res.ok) return [];
|
|
1569
|
+
return String(res.output || '').split('\n').map((l) => l.trim()).filter(Boolean);
|
|
1570
|
+
},
|
|
1571
|
+
log,
|
|
1572
|
+
});
|
|
1573
|
+
// Dispatch lifecycle for the KB write queue: a member is busy from the
|
|
1574
|
+
// moment its dispatch bracket opens until it closes, and writes queued for
|
|
1575
|
+
// a repository it maintains are applied when it goes idle. Both hooks are
|
|
1576
|
+
// optional on an injected kbWork stub.
|
|
1577
|
+
kbDispatchHooks = {
|
|
1578
|
+
started: (memberName) => (typeof kbWork.dispatchStarted === 'function' ? kbWork.dispatchStarted(memberName) : undefined),
|
|
1579
|
+
ended: (memberName) => (typeof kbWork.dispatchEnded === 'function' ? kbWork.dispatchEnded(memberName) : undefined),
|
|
1580
|
+
};
|
|
1288
1581
|
// A member named in ANY roleMap value is a "specialist" for whatever
|
|
1289
1582
|
// role(s) named it -- e.g. a member pinned to roleMap.reviewer has been
|
|
1290
1583
|
// deliberately reserved for review. Without this, a role the caller left
|
|
@@ -1301,11 +1594,15 @@ async function runSprintCycle(context) {
|
|
|
1301
1594
|
// whenever roleMap is absent entirely (every member is a generalist).
|
|
1302
1595
|
const roleMapSpecialists = new Set();
|
|
1303
1596
|
if (validated.roleMap) {
|
|
1304
|
-
for (const list of Object.
|
|
1597
|
+
for (const [role, list] of Object.entries(validated.roleMap)) {
|
|
1598
|
+
// kb_maintainer is not a dispatched role: naming a member as its
|
|
1599
|
+
// repository's KB maintainer must not take it out of the
|
|
1600
|
+
// generalist pool for unmapped roles.
|
|
1601
|
+
if (role === ROLE_KB_MAINTAINER) continue;
|
|
1305
1602
|
if (Array.isArray(list)) for (const m of list) roleMapSpecialists.add(m);
|
|
1306
1603
|
}
|
|
1307
1604
|
}
|
|
1308
|
-
// apra-fleet: roleMap.
|
|
1605
|
+
// apra-fleet: roleMap.backlog members are excluded from BOTH the
|
|
1309
1606
|
// generalist pool and its degenerate physicalMembers fallback -- not just
|
|
1310
1607
|
// from the generalist filter -- because the orchestrator role may be a
|
|
1311
1608
|
// shared/unreservable, git-less member (docs/design-orchestrator-
|
|
@@ -1315,13 +1612,13 @@ async function runSprintCycle(context) {
|
|
|
1315
1612
|
// removal and every probeFileExists/publishGitMember fix elsewhere in this
|
|
1316
1613
|
// file: those call getMemberForRole()/getMembersForRole() for roles that
|
|
1317
1614
|
// still expect a real git checkout.
|
|
1318
|
-
const
|
|
1319
|
-
(validated.roleMap && Array.isArray(validated.roleMap[
|
|
1320
|
-
? validated.roleMap[
|
|
1615
|
+
const backlogRoleMapMembers = new Set(
|
|
1616
|
+
(validated.roleMap && Array.isArray(validated.roleMap[ROLE_BACKLOG]))
|
|
1617
|
+
? validated.roleMap[ROLE_BACKLOG]
|
|
1321
1618
|
: []
|
|
1322
1619
|
);
|
|
1323
1620
|
const unmappedRoleFallbackPool = (() => {
|
|
1324
|
-
const eligible = physicalMembers.filter((m) => !
|
|
1621
|
+
const eligible = physicalMembers.filter((m) => !backlogRoleMapMembers.has(m));
|
|
1325
1622
|
const generalists = eligible.filter((m) => !roleMapSpecialists.has(m));
|
|
1326
1623
|
if (generalists.length > 0) return generalists;
|
|
1327
1624
|
if (eligible.length > 0) return eligible;
|
|
@@ -1353,21 +1650,21 @@ async function runSprintCycle(context) {
|
|
|
1353
1650
|
return [unmappedRoleFallbackPool[0]];
|
|
1354
1651
|
};
|
|
1355
1652
|
|
|
1356
|
-
// Uses the canonical
|
|
1653
|
+
// Uses the canonical ROLE_BACKLOG constant, not a literal -- see its
|
|
1357
1654
|
// doc comment for why 'orchestrator' is an application-level pseudo-role
|
|
1358
1655
|
// deliberately outside contracts.ROLES.
|
|
1359
1656
|
//
|
|
1360
|
-
//
|
|
1361
|
-
//
|
|
1362
|
-
//
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
//
|
|
1369
|
-
//
|
|
1370
|
-
const
|
|
1657
|
+
// An unmapped backlog does NOT fail the launch: the shared selector
|
|
1658
|
+
// (backlog-role.mjs, also used by bin/cli.mjs) auto-selects a member and
|
|
1659
|
+
// the choice is reported loudly below.
|
|
1660
|
+
const backlogSelection = selectBacklogMember({ roleMap: validated.roleMap, members: physicalMembers });
|
|
1661
|
+
const backlogMember = backlogSelection.member;
|
|
1662
|
+
const backlogSelectionLine = formatBacklogSelection(backlogSelection);
|
|
1663
|
+
if (backlogSelectionLine) log(backlogSelectionLine);
|
|
1664
|
+
|
|
1665
|
+
// Deprecated-alias warnings (deprecated orchestrator key -> backlog),
|
|
1666
|
+
// collected by validateArgs() and/or forwarded by bin/cli.mjs.
|
|
1667
|
+
for (const w of (validated.roleMapWarnings || [])) log(`[role-map] WARNING: ${w}`);
|
|
1371
1668
|
|
|
1372
1669
|
// Beads identity precondition: prove which .beads every member's bd
|
|
1373
1670
|
// resolves to BEFORE the first mutating bd command (the earliest bd
|
|
@@ -1377,21 +1674,101 @@ async function runSprintCycle(context) {
|
|
|
1377
1674
|
// absent that, the orchestrator's own identity). A probe that fails or
|
|
1378
1675
|
// resolves nothing is a logged `[beads-identity] WARNING:` (with the
|
|
1379
1676
|
// fix) and that field is left out of the comparison -- only a proven
|
|
1380
|
-
// mismatch is fatal.
|
|
1677
|
+
// mismatch, or bd itself missing on a member, is fatal.
|
|
1381
1678
|
// Sits here rather than next to wrapCommand() above because the
|
|
1382
|
-
//
|
|
1679
|
+
// backlog member is only resolved at this point; nothing between
|
|
1383
1680
|
// the two spots issues a command(). `context.verifyBeadsIdentity` is the
|
|
1384
1681
|
// test-harness seam (same shape as the other injected preconditions);
|
|
1385
1682
|
// there is deliberately no CLI flag to skip it.
|
|
1683
|
+
//
|
|
1684
|
+
// A member that a beads-reading role is dispatched to and that has no
|
|
1685
|
+
// beads database (or no sync.remote while the expectation names one) is
|
|
1686
|
+
// set up HERE, before any dispatch, from the expected beads remote -- its
|
|
1687
|
+
// VCS credential ensured first -- and re-verified; failing that, the
|
|
1688
|
+
// sprint stops with BEADS_SETUP_FAILED. The set-up commands go through
|
|
1689
|
+
// command() above, so noteMemberCommand() sees them.
|
|
1690
|
+
// Member-bound SE command builder per member OS/shell, shared by the two
|
|
1691
|
+
// member preflights below.
|
|
1692
|
+
const memberSeCommands = async (member) => getSeCommands(await resolveMemberTarget({
|
|
1693
|
+
fleetApi: (args && typeof args.callTool === 'function') ? sprintScopedFleetApi({ callTool: args.callTool, log }) : undefined,
|
|
1694
|
+
member,
|
|
1695
|
+
log,
|
|
1696
|
+
}));
|
|
1697
|
+
const beadsSetupMembers = [...new Set([
|
|
1698
|
+
backlogMember,
|
|
1699
|
+
...BEADS_READING_ROLES.flatMap((role) => getMembersForRole(role) || []),
|
|
1700
|
+
])];
|
|
1386
1701
|
await (context.verifyBeadsIdentity ?? verifyBeadsIdentity)({
|
|
1387
1702
|
command,
|
|
1388
1703
|
log,
|
|
1389
1704
|
publishState,
|
|
1390
|
-
|
|
1705
|
+
backlogMember,
|
|
1391
1706
|
members: physicalMembers,
|
|
1392
1707
|
expected: validated.expectBeads ?? null,
|
|
1708
|
+
prober: beadsIdentityProber,
|
|
1709
|
+
setupMembers: beadsSetupMembers,
|
|
1710
|
+
ensureVcsAuth: ensureVcsAuthFresh,
|
|
1711
|
+
// The set-up's beads pull goes through DoltSync with the same
|
|
1712
|
+
// reactive VCS-auth self-heal every D-pull bracket gets.
|
|
1713
|
+
onAuthFailure,
|
|
1714
|
+
// Built per member OS/shell (member_detail via resolveMemberTarget,
|
|
1715
|
+
// which degrades to POSIX and logs when the member cannot be resolved).
|
|
1716
|
+
memberShell: memberSeCommands,
|
|
1393
1717
|
});
|
|
1394
1718
|
|
|
1719
|
+
// Member permission-config preflight: every dispatch member's composed
|
|
1720
|
+
// per-folder config (its provider's permissionConfigPaths, reported by
|
|
1721
|
+
// member_detail) must be in its work folder before any dispatch. A
|
|
1722
|
+
// re-clone / `git clean -xdf` / fresh worktree drops it while member init
|
|
1723
|
+
// still reports OK, and the role's tool calls (bd included) are then
|
|
1724
|
+
// refused as "requires approval". Missing -> one compose_permissions call
|
|
1725
|
+
// for the member's role and a re-probe; still missing or compose failing
|
|
1726
|
+
// -> MemberPermissionConfigError naming member, file and fix. Present
|
|
1727
|
+
// configs are untouched. Same three-way precedence as
|
|
1728
|
+
// ensureDeployPermissions below: an injected
|
|
1729
|
+
// `context.verifyPermissionConfigs` (tests), else the real
|
|
1730
|
+
// compose_permissions-backed check from `args.callTool`, else a no-op when
|
|
1731
|
+
// there is no fleet connection to compose through.
|
|
1732
|
+
const permissionConfigMembers = new Map();
|
|
1733
|
+
for (const role of ROLES) {
|
|
1734
|
+
for (const m of (getMembersForRole(role) || [])) {
|
|
1735
|
+
if (!m) continue;
|
|
1736
|
+
if (!permissionConfigMembers.has(m)) permissionConfigMembers.set(m, []);
|
|
1737
|
+
const roles = permissionConfigMembers.get(m);
|
|
1738
|
+
if (!roles.includes(role)) roles.push(role);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
// Per-member compose_permissions ledger folder (project_folder): grants
|
|
1742
|
+
// the permission heal adds are recorded there, and every proactive compose
|
|
1743
|
+
// of the member passes it, so the next sprint keeps them.
|
|
1744
|
+
const ledgerFolderFor = (m) => permissionLedgerFolder(m, args && args.permissionLedgerDir);
|
|
1745
|
+
const verifyPermissionConfigs = context.verifyPermissionConfigs ?? (
|
|
1746
|
+
(args && typeof args.callTool === 'function')
|
|
1747
|
+
? createPermissionConfigPreflight({ callTool: args.callTool, command, log, memberShell: memberSeCommands, ledgerFolderFor })
|
|
1748
|
+
: async () => ({ composed: [] })
|
|
1749
|
+
);
|
|
1750
|
+
await verifyPermissionConfigs(permissionConfigMembers);
|
|
1751
|
+
|
|
1752
|
+
// Mid-sprint counterpart of the preflight above: a dispatch whose member
|
|
1753
|
+
// CLI refused tool calls for lack of a grant (execute_prompt reason
|
|
1754
|
+
// 'permission_denied') is healed PROGRESSIVELY by the dispatch engine
|
|
1755
|
+
// through this hook -- each refusal gets the missing grant within the
|
|
1756
|
+
// member's composed policy and a retry, until no progress is possible;
|
|
1757
|
+
// see createPermissionDenialHeal. Same precedence: an injected
|
|
1758
|
+
// `context.onPermissionDenied` (tests), else the real compose_permissions
|
|
1759
|
+
// heal from `args.callTool`, else none (the engine then fails the sprint
|
|
1760
|
+
// on the first refusal, naming member, actions and fix).
|
|
1761
|
+
const onPermissionDenied = context.onPermissionDenied ?? (
|
|
1762
|
+
(args && typeof args.callTool === 'function')
|
|
1763
|
+
? createPermissionDenialHeal({
|
|
1764
|
+
callTool: args.callTool,
|
|
1765
|
+
log,
|
|
1766
|
+
memberRoles: (m) => permissionConfigMembers.get(m) || [],
|
|
1767
|
+
ledgerFolderFor,
|
|
1768
|
+
})
|
|
1769
|
+
: undefined
|
|
1770
|
+
);
|
|
1771
|
+
|
|
1395
1772
|
// Self-heals deploy.md's declared Permissions onto the deployer /
|
|
1396
1773
|
// integ-test-runner / regression-test-runner member before each of
|
|
1397
1774
|
// those dispatches -- see createDeployPermissionsProvisioner's doc
|
|
@@ -1427,7 +1804,12 @@ async function runSprintCycle(context) {
|
|
|
1427
1804
|
});
|
|
1428
1805
|
// Local alias so this file's dispatch brackets keep their existing shape:
|
|
1429
1806
|
// withGitSync member, pushCode, dispatch thunk, options.
|
|
1430
|
-
|
|
1807
|
+
// The KB write queue sees the whole bracket (G-pull, dispatch, G-push) as
|
|
1808
|
+
// the member being busy -- see kbDispatchHooks.
|
|
1809
|
+
const withGitSync = (member, pushCode, dispatchFn, options) => withKbDispatchLifecycle(
|
|
1810
|
+
member,
|
|
1811
|
+
() => gitSync.withGitSync(member, pushCode, dispatchFn, options),
|
|
1812
|
+
);
|
|
1431
1813
|
|
|
1432
1814
|
// --- usage-limit pause/resume controller (apra-fleet-hzeb.4.2) -----------
|
|
1433
1815
|
// The budgets the controller reads: role-policies.mjs's frozen defaults,
|
|
@@ -1476,6 +1858,8 @@ async function runSprintCycle(context) {
|
|
|
1476
1858
|
// apra-fleet-hzeb.4.2: the usage-limit pause/resume/re-probe hook the
|
|
1477
1859
|
// engine arms for a role whose retry.usageLimitPause is set.
|
|
1478
1860
|
onUsageLimit,
|
|
1861
|
+
// The one bounded heal for a 'permission_denied' dispatch.
|
|
1862
|
+
onPermissionDenied,
|
|
1479
1863
|
fixedRoleTier: FIXED_ROLE_TIER,
|
|
1480
1864
|
budgets: {
|
|
1481
1865
|
DISPATCH_TIMEOUT_S,
|
|
@@ -1508,7 +1892,10 @@ async function runSprintCycle(context) {
|
|
|
1508
1892
|
// one implementation serves the harvester, the doer, the per-round
|
|
1509
1893
|
// reviewer and the final review alike.
|
|
1510
1894
|
'kb-apply': async ({ policy, value, member }) => {
|
|
1511
|
-
|
|
1895
|
+
// `member` is the member the engine dispatched: it names the
|
|
1896
|
+
// repository the writes belong to, and kbWork routes them to
|
|
1897
|
+
// that repository's kb_maintainer.
|
|
1898
|
+
await kbWork.apply(policy.agentType, member, value);
|
|
1512
1899
|
},
|
|
1513
1900
|
// deploy.md's active-sprints gate stops for a FOREIGN reservation,
|
|
1514
1901
|
// so a deployer prompt that does not state this sprint's OWN
|
|
@@ -1631,10 +2018,10 @@ async function runSprintCycle(context) {
|
|
|
1631
2018
|
// just within one call.
|
|
1632
2019
|
const staleInProgressReclaimCounts = new Map();
|
|
1633
2020
|
const STALE_IN_PROGRESS_RECLAIM_LIMIT = 2;
|
|
1634
|
-
//
|
|
1635
|
-
//
|
|
1636
|
-
//
|
|
1637
|
-
//
|
|
2021
|
+
// Read once, on the FIRST call to reclaimStaleInProgress (the pre-sprint
|
|
2022
|
+
// one), from the sprint state's start stamp (createSprintState) -- the
|
|
2023
|
+
// same instant the KB promotion-candidate window starts at, so the sprint
|
|
2024
|
+
// has one start time, not two. Declared here (not at the capture site) so its
|
|
1638
2025
|
// TDZ covers every call to reclaimStaleInProgress, including the
|
|
1639
2026
|
// pre-sprint one.
|
|
1640
2027
|
let sprintLaunchTime = null;
|
|
@@ -1642,9 +2029,15 @@ async function runSprintCycle(context) {
|
|
|
1642
2029
|
/**
|
|
1643
2030
|
* Reclaims 'in_progress' beads that are safe to redispatch to 'open':
|
|
1644
2031
|
* no unmet `blocks` dependencies (nothing left to wait on) AND claimed
|
|
1645
|
-
* BEFORE this sprint incarnation's own launch time -- so
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
2032
|
+
* BEFORE this sprint incarnation's own launch time -- so this very
|
|
2033
|
+
* sprint's own in-flight work is never touched here (a claim a failed doer
|
|
2034
|
+
* of THIS run left behind is reclaimed separately, by
|
|
2035
|
+
* reclaimInRunOrphanedClaims). The pre-launch rule is NOT safe against
|
|
2036
|
+
* concurrency on its own: a claim an EARLIER-launched sprint that is
|
|
2037
|
+
* still running holds also predates this launch and would be reclaimed;
|
|
2038
|
+
* only the supervisor's issue-scope overlap guard (which refuses to launch
|
|
2039
|
+
* two sprints over overlapping scope) keeps such a claim out of this
|
|
2040
|
+
* sprint's scope. A bead with no
|
|
1648
2041
|
* parseable `started_at` is treated as predating this sprint (`bd
|
|
1649
2042
|
* update --claim` always stamps `started_at`, so a bead claimed by
|
|
1650
2043
|
* THIS sprint always has one -- an unparseable/absent value can only
|
|
@@ -1666,14 +2059,17 @@ async function runSprintCycle(context) {
|
|
|
1666
2059
|
* on relaunch) was invisible to every later cycle, so the sprint just
|
|
1667
2060
|
* spun Plan-finds-nothing -> Deploy forever until the stall detector
|
|
1668
2061
|
* eventually gave up, burning cycles/cost for zero progress. This is
|
|
1669
|
-
* now also called at the top of every cycle's readiness check
|
|
1670
|
-
* orphaned claim self-heals on the
|
|
1671
|
-
* persisting for the rest of the run.
|
|
2062
|
+
* now also called at the top of every cycle's readiness check (when the
|
|
2063
|
+
* ready set is empty), so a PRE-LAUNCH orphaned claim self-heals on the
|
|
2064
|
+
* very next cycle instead of silently persisting for the rest of the run.
|
|
2065
|
+
* It never reclaims a claim made after the launch -- including one a
|
|
2066
|
+
* crashed doer of THIS run left -- which is reclaimInRunOrphanedClaims'
|
|
2067
|
+
* job.
|
|
1672
2068
|
* @param {{ notDoneBeads: object[], reasonTag: string }} opts
|
|
1673
2069
|
* @returns {Promise<{ reclaimedIds: string[], cappedIds: string[] }>}
|
|
1674
2070
|
*/
|
|
1675
2071
|
async function reclaimStaleInProgress({ notDoneBeads, reasonTag }) {
|
|
1676
|
-
if (sprintLaunchTime === null) sprintLaunchTime =
|
|
2072
|
+
if (sprintLaunchTime === null) sprintLaunchTime = sprintState.startedAtMs;
|
|
1677
2073
|
const notDoneIds = new Set(notDoneBeads.map((b) => b.id));
|
|
1678
2074
|
const unmetBlockers = (bead) => (bead.dependencies || [])
|
|
1679
2075
|
.filter((d) => d.type === 'blocks' && notDoneIds.has(d.depends_on_id))
|
|
@@ -1696,7 +2092,7 @@ async function runSprintCycle(context) {
|
|
|
1696
2092
|
}
|
|
1697
2093
|
staleInProgressReclaimCounts.set(bead.id, priorAttempts + 1);
|
|
1698
2094
|
log(`${reasonTag}: ${bead.id} is stuck 'in_progress' (started_at=${bead.started_at || 'n/a'}) with no unmet blockers and predates this sprint's launch -- reclaiming to 'open' so the sprint can dispatch it (attempt ${priorAttempts + 1}/${STALE_IN_PROGRESS_RECLAIM_LIMIT}).`);
|
|
1699
|
-
await command(`bd update ${bead.id} --status open`, { member_name:
|
|
2095
|
+
await command(`bd update ${bead.id} --status open`, { member_name: backlogMember, silent: true });
|
|
1700
2096
|
reclaimedIds.push(bead.id);
|
|
1701
2097
|
}
|
|
1702
2098
|
if (cappedIds.length > 0) {
|
|
@@ -1705,6 +2101,105 @@ async function runSprintCycle(context) {
|
|
|
1705
2101
|
return { reclaimedIds, cappedIds };
|
|
1706
2102
|
}
|
|
1707
2103
|
|
|
2104
|
+
/**
|
|
2105
|
+
* GitHub #715: re-lanes beads a failed doer of THIS run left
|
|
2106
|
+
* 'in_progress'. reclaimStaleInProgress() above cannot: it only reclaims
|
|
2107
|
+
* claims older than the sprint launch, so a doer of this run that claimed
|
|
2108
|
+
* a bead and then died, exhausted its resumes or returned BLOCKED left the
|
|
2109
|
+
* bead -- and its whole `blocks` chain -- hidden from `bd ready` for the
|
|
2110
|
+
* rest of the sprint, which then ended FAIL through the stall net.
|
|
2111
|
+
*
|
|
2112
|
+
* Called at the top of every cycle, before Plan. Costs NOTHING on the
|
|
2113
|
+
* common path: with no failed doer dispatch on record it returns before
|
|
2114
|
+
* any bd call. Otherwise, per candidate (./orphan-reclaim.mjs decides who
|
|
2115
|
+
* is one, from each bead's latest streak outcome):
|
|
2116
|
+
*
|
|
2117
|
+
* 1. FRESH READ. The cached snapshot only pre-filters; it can lag a full
|
|
2118
|
+
* cycle (see beads-scope.mjs), so it never authorizes a write. The
|
|
2119
|
+
* orchestrator's beads clone is D-pulled (a remote doer closes in its
|
|
2120
|
+
* OWN clone) and the candidates are re-read with `bd show`. Only a
|
|
2121
|
+
* bead that is STILL in_progress proceeds; one found closed is
|
|
2122
|
+
* dropped from the record and never reopened.
|
|
2123
|
+
* 2. LIVENESS. A returned dispatch does not prove the doer session is
|
|
2124
|
+
* dead (a stalled-but-alive session can outlive its dispatch), so the
|
|
2125
|
+
* failed streak's doer session is STOPPED (memberSessionGuard
|
|
2126
|
+
* .killIfAlive) before its bead is re-laned. Chosen over skipping
|
|
2127
|
+
* reclaim for may-still-be-running failures: skipping would leave
|
|
2128
|
+
* exactly those beads stuck, which is the bug.
|
|
2129
|
+
* 3. GUARDED WRITE. `--if-status in_progress` makes the write itself
|
|
2130
|
+
* refuse a bead that closed after the fresh read (bd exits non-zero,
|
|
2131
|
+
* logged, nothing changes). The stale assignee is cleared because a
|
|
2132
|
+
* different doer's `bd update --claim` refuses a bead another actor
|
|
2133
|
+
* still holds; `--force` is bd's documented override for exactly this
|
|
2134
|
+
* abandoned-claim case.
|
|
2135
|
+
*
|
|
2136
|
+
* Claims another sprint holds are identified by the structured
|
|
2137
|
+
* all-beads-already-claimed failure reason on the streak outcome and are
|
|
2138
|
+
* never touched. A reclaimed id leaves the record and only returns when a
|
|
2139
|
+
* doer of this run is dispatched on it again, so a later claim of the same
|
|
2140
|
+
* bead by another actor is never reset. NOT a concurrency guarantee: with
|
|
2141
|
+
* no engine-side claim (no assignee configured) a concurrent sprint that
|
|
2142
|
+
* claimed the bead between this sprint's ready read and its own doer's
|
|
2143
|
+
* claim is indistinguishable from this run's doer here; as for the
|
|
2144
|
+
* pre-launch rule, only the supervisor's issue-scope overlap guard keeps
|
|
2145
|
+
* two sprints off the same beads. Each bead is re-laned at most
|
|
2146
|
+
* ORPHAN_RECLAIM_LIMIT times; a bead past the cap stays in_progress and is
|
|
2147
|
+
* named in the final sprint notes.
|
|
2148
|
+
*
|
|
2149
|
+
* Introduces no launch timestamp of its own: in-run orphans are found by
|
|
2150
|
+
* this run's own dispatch record, and the sprint keeps the single launch
|
|
2151
|
+
* time sprintState.startedAtMs (read only by reclaimStaleInProgress).
|
|
2152
|
+
* @param {{ reasonTag: string }} opts
|
|
2153
|
+
* @returns {Promise<string[]>} the reclaimed bead ids
|
|
2154
|
+
*/
|
|
2155
|
+
async function reclaimInRunOrphanedClaims({ reasonTag }) {
|
|
2156
|
+
if (!orphanClaims.hasFailed()) return [];
|
|
2157
|
+
const { candidates, newlyCappedIds } = orphanClaims.candidates(await fetchAllBeadsShared());
|
|
2158
|
+
if (newlyCappedIds.length > 0) {
|
|
2159
|
+
log(`${reasonTag}: ${newlyCappedIds.length} bead(s) a failed doer of this run left 'in_progress' already hit the re-dispatch cap (limit ${orphanClaims.limit}) and are left as they are -- needs human investigation: ${newlyCappedIds.join(', ')}.`);
|
|
2160
|
+
}
|
|
2161
|
+
if (candidates.length === 0) return [];
|
|
2162
|
+
|
|
2163
|
+
const settleShell = await resolveSettleShell({ args, member: backlogMember, log, sprintState });
|
|
2164
|
+
await gitSync.syncBeadsBefore(backlogMember, { fatal: true, settle: buildSettleCallback(backlogMember, { command, log, shell: settleShell }) });
|
|
2165
|
+
const ids = candidates.map((c) => c.id);
|
|
2166
|
+
const showLabel = `bd show ${ids.join(' ')} --json`;
|
|
2167
|
+
const fresh = parseBdJson(await command(showLabel, { member_name: backlogMember, silent: true }), showLabel);
|
|
2168
|
+
const freshStatusById = new Map((Array.isArray(fresh) ? fresh : []).map((b) => [b.id, b.status]));
|
|
2169
|
+
|
|
2170
|
+
const confirmed = [];
|
|
2171
|
+
for (const c of candidates) {
|
|
2172
|
+
const status = freshStatusById.get(c.id);
|
|
2173
|
+
if (status === 'in_progress') {
|
|
2174
|
+
confirmed.push(c);
|
|
2175
|
+
continue;
|
|
2176
|
+
}
|
|
2177
|
+
if (status === 'closed') orphanClaims.forget(c.id);
|
|
2178
|
+
log(`${reasonTag}: ${c.id} looked orphaned 'in_progress' in the cached snapshot but a fresh read shows '${status || 'unknown'}' -- not reclaiming it.`);
|
|
2179
|
+
}
|
|
2180
|
+
if (confirmed.length === 0) return [];
|
|
2181
|
+
|
|
2182
|
+
const doerMembers = [...new Set(confirmed.map((c) => c.doerMember).filter(Boolean))];
|
|
2183
|
+
for (const member of doerMembers) {
|
|
2184
|
+
log(`${reasonTag}: stopping any still-running session on doer member '${member}' before re-laning the bead(s) its failed streak left 'in_progress'.`);
|
|
2185
|
+
await memberSessionGuard.killIfAlive(member);
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
const reclaimedIds = [];
|
|
2189
|
+
for (const c of confirmed) {
|
|
2190
|
+
try {
|
|
2191
|
+
await command(`bd update ${c.id} --status open --assignee= --force --if-status in_progress`, { member_name: backlogMember, silent: true });
|
|
2192
|
+
} catch (err) {
|
|
2193
|
+
log(`${reasonTag}: re-laning ${c.id} was refused (${err.message}) -- leaving it as it is.`);
|
|
2194
|
+
continue;
|
|
2195
|
+
}
|
|
2196
|
+
const attempt = orphanClaims.markReclaimed(c.id);
|
|
2197
|
+
log(`${reasonTag}: ${c.id} was left 'in_progress' by a failed doer streak of this run (member '${c.doerMember || 'unknown'}') -- confirmed by a fresh read and reclaimed to 'open' so it is dispatched again this sprint (attempt ${attempt}/${orphanClaims.limit}).`);
|
|
2198
|
+
reclaimedIds.push(c.id);
|
|
2199
|
+
}
|
|
2200
|
+
return reclaimedIds;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
1708
2203
|
/**
|
|
1709
2204
|
* Dispatches one reviewer round and returns its schema-validated verdict.
|
|
1710
2205
|
* Shared by the per-round Develop/Review dispatch and the Cycle Evaluation
|
|
@@ -1723,21 +2218,23 @@ async function runSprintCycle(context) {
|
|
|
1723
2218
|
// and hand them to it in the prompt. The reviewer has no MCP kb_* tools
|
|
1724
2219
|
// of its own, so without this it can never name an entry id and
|
|
1725
2220
|
// `kb_promotions` comes back empty every round -- which is exactly why
|
|
1726
|
-
// kb_promote had never once fired.
|
|
1727
|
-
//
|
|
1728
|
-
//
|
|
1729
|
-
|
|
1730
|
-
const kbCandidates = await kbWork.promotionCandidates(
|
|
2221
|
+
// kb_promote had never once fired. Read from the reviewer's
|
|
2222
|
+
// repository kb_maintainer -- the session every KB write is routed to,
|
|
2223
|
+
// so the one holding this sprint's captures -- and best-effort: a
|
|
2224
|
+
// cold KB must not fail the review.
|
|
2225
|
+
const kbCandidates = await kbWork.promotionCandidates(reviewerPool[0]);
|
|
1731
2226
|
if (kbCandidates.length > 0) {
|
|
1732
2227
|
log(`[kb-work] offering ${kbCandidates.length} INFERRED entr(ies) to the reviewer for promotion.`);
|
|
1733
2228
|
}
|
|
1734
2229
|
// What the KB knows about the beads UNDER REVIEW, not just whatever the
|
|
1735
2230
|
// sprint-start prime happened to surface. Falls back to the primed set
|
|
1736
2231
|
// when the query returns nothing (a KB with no matching rows yet).
|
|
1737
|
-
const
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
:
|
|
2232
|
+
const reviewerKbBlock = await kbInjection.blockFor({
|
|
2233
|
+
role: ROLE_REVIEWER,
|
|
2234
|
+
member: reviewerPool[0],
|
|
2235
|
+
context: { ...kbSprintContext, beadIds, beadTitles: kbBeadTitles(beadIds) },
|
|
2236
|
+
captureChannel: true,
|
|
2237
|
+
});
|
|
1741
2238
|
// A full-cycle review can genuinely exhaust the fleet's default turn
|
|
1742
2239
|
// budget, and a fresh retry deterministically hits the same wall. Make
|
|
1743
2240
|
// the budget explicit and, on max_turns exhaustion, RESUME the same
|
|
@@ -1775,7 +2272,7 @@ async function runSprintCycle(context) {
|
|
|
1775
2272
|
branch: validated.branch,
|
|
1776
2273
|
goal: validated.goal,
|
|
1777
2274
|
kbCandidates,
|
|
1778
|
-
|
|
2275
|
+
kbBlock: reviewerKbBlock,
|
|
1779
2276
|
}),
|
|
1780
2277
|
// Restate the review scope: a resumed dispatch replaces the
|
|
1781
2278
|
// delivered prompt artifact, so the scope must be repeated inline.
|
|
@@ -1824,6 +2321,11 @@ async function runSprintCycle(context) {
|
|
|
1824
2321
|
// A degraded round counts toward the bounded stall-abort budget like
|
|
1825
2322
|
// every other role's dispatch failure -- it is NOT a reviewer contract
|
|
1826
2323
|
// violation, which is what the dispatchFailed marker records.
|
|
2324
|
+
// The round's confirmations go to the bible on each repository's
|
|
2325
|
+
// kb_maintainer: G-pull, kb_bible_commit, G-push. Covers both callers
|
|
2326
|
+
// (the per-round review and the scope-wide re-review); a round with
|
|
2327
|
+
// no confirmations makes no call. Never throws.
|
|
2328
|
+
if (typeof kbWork.commitRound === 'function') await kbWork.commitRound(`review C${cycle}`);
|
|
1827
2329
|
return reviewOutcome.value;
|
|
1828
2330
|
}
|
|
1829
2331
|
|
|
@@ -1853,30 +2355,21 @@ async function runSprintCycle(context) {
|
|
|
1853
2355
|
// silently absorbed the sprint branch's commits this way.
|
|
1854
2356
|
//
|
|
1855
2357
|
// SUPPORTED-TOPOLOGY NOTE: there is no cross-member bd/git sync layer here.
|
|
1856
|
-
// Every `bd` command below runs against the
|
|
2358
|
+
// Every `bd` command below runs against the backlog member's beads DB
|
|
1857
2359
|
// and a doer's own `bd close` runs against its member's DB, which only
|
|
1858
2360
|
// coheres when all members share one workspace/DB (or there is a single
|
|
1859
2361
|
// member). bin/cli.mjs enforces that via checkMemberTopology() before the
|
|
1860
2362
|
// sprint starts; this ensure-everywhere is the git half of the same "every
|
|
1861
2363
|
// member starts from the same state" guarantee. See docs/architecture.md
|
|
1862
2364
|
// "Multi-member topology (fleet-sprint)".
|
|
1863
|
-
// apra-fleet:
|
|
2365
|
+
// apra-fleet: backlogMember is deliberately NOT included here -- the
|
|
1864
2366
|
// orchestrator role issues only bd/Dolt commands (never git), and a
|
|
1865
|
-
// shared/unreservable
|
|
2367
|
+
// shared/unreservable backlog member used across concurrent sprints
|
|
1866
2368
|
// cannot be checked out onto N different branches at once. If an operator
|
|
1867
2369
|
// explicitly role-maps a dispatch member (doer/reviewer/planner/etc.) as
|
|
1868
2370
|
// orchestrator too, that member is still included below via its dispatch
|
|
1869
2371
|
// role, so the ensure-everywhere guarantee is unaffected for that case.
|
|
1870
|
-
const branchEnsureMembers =
|
|
1871
|
-
...getMembersForRole(ROLE_DOER),
|
|
1872
|
-
...getMembersForRole(ROLE_REVIEWER),
|
|
1873
|
-
...getMembersForRole('planner'),
|
|
1874
|
-
...getMembersForRole('plan-reviewer'),
|
|
1875
|
-
...getMembersForRole('deployer'),
|
|
1876
|
-
...getMembersForRole('integ-test-runner'),
|
|
1877
|
-
...getMembersForRole('regression-test-runner'),
|
|
1878
|
-
...getMembersForRole('harvester'),
|
|
1879
|
-
])];
|
|
2372
|
+
const branchEnsureMembers = computeBranchEnsureMembers(getMembersForRole, context.kbMaintainers, backlogRoleMapMembers);
|
|
1880
2373
|
|
|
1881
2374
|
// Read the requirementsFile (if any) once, up front, so its content can
|
|
1882
2375
|
// be threaded into every Plan-phase planner prompt.
|
|
@@ -1900,11 +2393,11 @@ async function runSprintCycle(context) {
|
|
|
1900
2393
|
// Routed through the single dolt-sync module (apra-fleet-417.2.1):
|
|
1901
2394
|
// readinessGate (apra-fleet-417.5 rename of healthGate) selects the
|
|
1902
2395
|
// pre-flight variant of the BEFORE bracket.
|
|
1903
|
-
// Thread the
|
|
2396
|
+
// Thread the backlog member's REGISTERED shell into dolt-settle,
|
|
1904
2397
|
// guarded on args.callTool the same way the pre-dispatch bracket is
|
|
1905
2398
|
// (apra-fleet-7dir.24).
|
|
1906
|
-
const preflightSettleShell = await resolveSettleShell({ args, member:
|
|
1907
|
-
await gitSync.syncBeadsBefore(
|
|
2399
|
+
const preflightSettleShell = await resolveSettleShell({ args, member: backlogMember, log, sprintState });
|
|
2400
|
+
await gitSync.syncBeadsBefore(backlogMember, { readinessGate: true, settle: buildSettleCallback(backlogMember, { command, log, shell: preflightSettleShell }) });
|
|
1908
2401
|
|
|
1909
2402
|
// =======================
|
|
1910
2403
|
// 0. Git Setup: ensure the sprint branch exists off base_branch
|
|
@@ -1952,6 +2445,10 @@ async function runSprintCycle(context) {
|
|
|
1952
2445
|
// round.
|
|
1953
2446
|
async function updateDashboard() {
|
|
1954
2447
|
let sprintTasks = [];
|
|
2448
|
+
// When the sprint-tree bd fetch completed -- carried in the beads
|
|
2449
|
+
// payload so the viewer's progress summary reports data age, not
|
|
2450
|
+
// render/publish time.
|
|
2451
|
+
let fetchedAt = null;
|
|
1955
2452
|
try {
|
|
1956
2453
|
// The no-args path is required here: any non-empty rest args route
|
|
1957
2454
|
// through a second `bd list` query, and plain `bd list` defaults to
|
|
@@ -1959,6 +2456,14 @@ async function runSprintCycle(context) {
|
|
|
1959
2456
|
// dashboard's sprint tree. No-args returns the shared `bd list
|
|
1960
2457
|
// --all` fetch filtered to scope -- every status, one query fewer.
|
|
1961
2458
|
sprintTasks = await bdListScoped('');
|
|
2459
|
+
fetchedAt = new Date().toISOString();
|
|
2460
|
+
// Sprint-level KB hint sources for the roles whose dispatch does
|
|
2461
|
+
// not name its own beads (planner, deployer, test runners, ...).
|
|
2462
|
+
kbSprintContext.beadTitles = sprintTasks.filter((t) => t && typeof t.title === 'string').map((t) => t.title);
|
|
2463
|
+
kbSprintContext.closedBeadTitles = sprintTasks.filter((t) => t && t.status === 'closed' && typeof t.title === 'string').map((t) => t.title);
|
|
2464
|
+
kbSprintContext.beadIds = sprintTasks.filter((t) => t && typeof t.id === 'string').map((t) => t.id);
|
|
2465
|
+
kbSprintContext.testFiles = pathsFromText(sprintTasks.map((t) => t && t.description)).filter((p) => /test|spec/i.test(p));
|
|
2466
|
+
kbBeadIndex = new Map(sprintTasks.filter((t) => t && t.id).map((t) => [t.id, t]));
|
|
1962
2467
|
// A bead whose stored `status` is 'open' but which is NOT in the
|
|
1963
2468
|
// scope's `--ready` set is blocked. The viewer only sees stored
|
|
1964
2469
|
// status, so without this flag a deadlocked bead renders
|
|
@@ -2010,6 +2515,7 @@ async function runSprintCycle(context) {
|
|
|
2010
2515
|
payload.decomposedParentIds = [...new Set(
|
|
2011
2516
|
sprintTasks.filter((b) => b && b.parent).map((b) => b.parent)
|
|
2012
2517
|
)];
|
|
2518
|
+
payload.fetchedAt = fetchedAt;
|
|
2013
2519
|
publishState('beads', payload);
|
|
2014
2520
|
}
|
|
2015
2521
|
}
|
|
@@ -2020,7 +2526,7 @@ async function runSprintCycle(context) {
|
|
|
2020
2526
|
// escaped-quote-inside-quote traps). failSoft, so a probe failure can never
|
|
2021
2527
|
// throw and kill the sprint -- it just means "skip the dependent phase".
|
|
2022
2528
|
// Runs on `member` -- the role member about to consume the probed file --
|
|
2023
|
-
// never on
|
|
2529
|
+
// never on backlogMember: a shared/unreservable backlog member
|
|
2024
2530
|
// carries no git checkout to probe.
|
|
2025
2531
|
async function probeFileExists(filename, member) {
|
|
2026
2532
|
const res = await command(
|
|
@@ -2039,11 +2545,22 @@ async function runSprintCycle(context) {
|
|
|
2039
2545
|
// doer's work, so pull again immediately before the verification read.
|
|
2040
2546
|
// DoltSync.syncBefore() is a benign no-op when the clone is current and
|
|
2041
2547
|
// when no dolt remote is configured at all.
|
|
2042
|
-
// Thread the
|
|
2548
|
+
// Thread the backlog member's REGISTERED shell into dolt-settle,
|
|
2043
2549
|
// guarded on args.callTool the same way the pre-dispatch bracket is
|
|
2044
2550
|
// (apra-fleet-7dir.24).
|
|
2045
|
-
const verifyReadSettleShell = await resolveSettleShell({ args, member:
|
|
2046
|
-
await gitSync.syncBeadsBefore(
|
|
2551
|
+
const verifyReadSettleShell = await resolveSettleShell({ args, member: backlogMember, log, sprintState });
|
|
2552
|
+
await gitSync.syncBeadsBefore(backlogMember, { fatal: true, settle: buildSettleCallback(backlogMember, { command, log, shell: verifyReadSettleShell }) });
|
|
2553
|
+
|
|
2554
|
+
// Beads memory hygiene: forget token-usage memories (and retired keys)
|
|
2555
|
+
// before any dispatch, so `bd prime` never injects them into a session.
|
|
2556
|
+
// Sprint start only; one non-fatal bracketed push when anything was
|
|
2557
|
+
// forgotten; never throws. `context.sweepTokenMemories` is the test seam.
|
|
2558
|
+
await (context.sweepTokenMemories ?? sweepTokenMemories)({
|
|
2559
|
+
command,
|
|
2560
|
+
log,
|
|
2561
|
+
member: backlogMember,
|
|
2562
|
+
pushBeads: () => gitSync.syncBeadsAfter(backlogMember, { pushBeads: true }),
|
|
2563
|
+
});
|
|
2047
2564
|
|
|
2048
2565
|
await updateDashboard();
|
|
2049
2566
|
|
|
@@ -2113,7 +2630,7 @@ async function runSprintCycle(context) {
|
|
|
2113
2630
|
if (invisibleTargets.length > 0) {
|
|
2114
2631
|
throw new PreSprintValidationError(
|
|
2115
2632
|
`Pre-sprint validation failed: ${invisibleTargets.length} of ${targetIssues.length} target issue id(s) ` +
|
|
2116
|
-
`are not visible to the
|
|
2633
|
+
`are not visible to the backlog member ('${backlogMember}')'s bd clone at all: ` +
|
|
2117
2634
|
`${invisibleTargets.join(', ')}. This is NOT the same as those beads being closed/done -- it usually ` +
|
|
2118
2635
|
`means they were created/updated on a different clone that was never synced to the shared Dolt remote ` +
|
|
2119
2636
|
`(dolt-push it there first) or this member's clone has not picked them up yet. Scope: '${sprintFilter}'.`,
|
|
@@ -2165,7 +2682,7 @@ async function runSprintCycle(context) {
|
|
|
2165
2682
|
// the throw; it is never silently swallowed.
|
|
2166
2683
|
try {
|
|
2167
2684
|
for (const pair of cyclePairs) {
|
|
2168
|
-
await command(`bd dep remove ${pair.blockedIssue} ${pair.blockedBy}`, { member_name:
|
|
2685
|
+
await command(`bd dep remove ${pair.blockedIssue} ${pair.blockedBy}`, { member_name: backlogMember, silent: true });
|
|
2169
2686
|
log(`Pre-sprint auto-repair: removed the 'blocks' edge between ${pair.blockedIssue} and ${pair.blockedBy} (parent-child + blocks cycle) -- auto-removed via bd dep remove.`);
|
|
2170
2687
|
}
|
|
2171
2688
|
} catch (repairErr) {
|
|
@@ -2208,6 +2725,43 @@ async function runSprintCycle(context) {
|
|
|
2208
2725
|
}
|
|
2209
2726
|
}
|
|
2210
2727
|
|
|
2728
|
+
// GitHub #717: a bead whose only unmet `blocks` dependencies are
|
|
2729
|
+
// verify-routed beads (all children closed; only the Integration Test
|
|
2730
|
+
// phase closes them) can never become ready while that phase cannot run
|
|
2731
|
+
// -- no integ-test-playbook.md or no deploy.md. Runs AFTER the pre-sprint
|
|
2732
|
+
// stale-claim reclaim above, from the shared snapshot those reads already
|
|
2733
|
+
// fetched (no extra bd call on the common path); the two runbook probes
|
|
2734
|
+
// run only when the shape exists. A goal-priority bead in that shape stops
|
|
2735
|
+
// the sprint here, before any cycle is paid for, with a diagnosis naming
|
|
2736
|
+
// the bead, its blockers and the exact fix; a below-goal one only warns.
|
|
2737
|
+
// Diagnose only: the DAG is never rewritten.
|
|
2738
|
+
{
|
|
2739
|
+
const allForVerifyBlock = await fetchAllBeadsShared();
|
|
2740
|
+
const { verifyIds: verifyIdsForBlockCheck } = classifyVerifySet(allForVerifyBlock, targetIssues);
|
|
2741
|
+
const blockedByVerify = findVerifyBlockedBeads(await bdListScoped(''), allForVerifyBlock, verifyIdsForBlockCheck);
|
|
2742
|
+
if (blockedByVerify.length > 0) {
|
|
2743
|
+
const hasDeployPreSprint = await probeFileExists('deploy.md', getMemberForRole('deployer'));
|
|
2744
|
+
const hasPlaybookPreSprint = await probeFileExists('integ-test-playbook.md', getMemberForRole('integ-test-runner'));
|
|
2745
|
+
const cause = integBlockCause({ hasPlaybook: hasPlaybookPreSprint, hasDeploy: hasDeployPreSprint });
|
|
2746
|
+
if (cause) {
|
|
2747
|
+
const { atGoal, belowGoal } = partitionByGoal(blockedByVerify, goalPriorityMax(validated.goal));
|
|
2748
|
+
if (belowGoal.length > 0) {
|
|
2749
|
+
log(`Pre-sprint validation: WARNING -- ${buildVerifyBlockDiagnosis({ blocked: belowGoal, cause })} These bead(s) are below goal priority ${validated.goal}, so the sprint is not stopped for them.`);
|
|
2750
|
+
}
|
|
2751
|
+
if (atGoal.length > 0) {
|
|
2752
|
+
throw new PreSprintValidationError(
|
|
2753
|
+
`Pre-sprint validation failed: ${buildVerifyBlockDiagnosis({ blocked: atGoal, cause })}`,
|
|
2754
|
+
{
|
|
2755
|
+
reason: PRE_SPRINT_REFUSAL_REASONS.VERIFY_BLOCKED,
|
|
2756
|
+
scope: sprintFilter,
|
|
2757
|
+
details: { cause, blocked: atGoal },
|
|
2758
|
+
}
|
|
2759
|
+
);
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2211
2765
|
// =======================
|
|
2212
2766
|
// Goal-priority exit condition + stall-abort bookkeeping
|
|
2213
2767
|
// =======================
|
|
@@ -2218,6 +2772,41 @@ async function runSprintCycle(context) {
|
|
|
2218
2772
|
// priority", NOT "bd list --ready returned []".
|
|
2219
2773
|
const goalMax = goalPriorityMax(validated.goal);
|
|
2220
2774
|
|
|
2775
|
+
// Every bead id this sprint has handed to a doer (dispatched; a doer's
|
|
2776
|
+
// close is a subset). The reviewer-reopen goal-scope guard never defers a
|
|
2777
|
+
// bead in this set -- the sprint's own commits for it are on the branch,
|
|
2778
|
+
// so a reopen of it is the sprint repairing its own work (see
|
|
2779
|
+
// isDeferredScopeReopen in beads-transitions.mjs). Passed explicitly to
|
|
2780
|
+
// every verdict site: Review, Re-Review and Final Review.
|
|
2781
|
+
const workedOnBeadIds = new Set();
|
|
2782
|
+
|
|
2783
|
+
// GitHub #715: the run-scoped "dispatched to a doer this run" record, by
|
|
2784
|
+
// each bead's LATEST streak outcome. See ./orphan-reclaim.mjs for the
|
|
2785
|
+
// rules and reclaimInRunOrphanedClaims() for the fresh-read/stop/write.
|
|
2786
|
+
const orphanClaims = createOrphanClaimTracker();
|
|
2787
|
+
|
|
2788
|
+
// The develop loop's ready set: readyLeafBeads() minus below-goal beads
|
|
2789
|
+
// that neither (transitively) block an open in-goal bead nor were already
|
|
2790
|
+
// dispatched by this sprint (see partitionReadyByGoal in beads-scope.mjs).
|
|
2791
|
+
// Used by every Develop/Review-loop readiness read -- the per-cycle seed,
|
|
2792
|
+
// the per-round streak input and the round-loop "still open" check -- so
|
|
2793
|
+
// an excluded bead can neither be dispatched nor keep the loop spinning.
|
|
2794
|
+
// The completion gate needs no change: it already counts only beads at or
|
|
2795
|
+
// above goal priority, so an excluded bead never holds the sprint open.
|
|
2796
|
+
// Pre-sprint validation keeps the unfiltered readyLeafBeads(): its
|
|
2797
|
+
// deadlock diagnosis is about the graph, not about goal membership.
|
|
2798
|
+
const loggedBelowGoalExclusions = new Set();
|
|
2799
|
+
async function dispatchableReadyLeafBeads() {
|
|
2800
|
+
const [ready, scopeAll] = await Promise.all([readyLeafBeads(), bdListScoped('')]);
|
|
2801
|
+
const { dispatchable, excluded } = partitionReadyByGoal(ready, scopeAll, validated.goal, { workedOnIds: workedOnBeadIds });
|
|
2802
|
+
const fresh = excluded.filter((e) => !loggedBelowGoalExclusions.has(e.id));
|
|
2803
|
+
if (fresh.length > 0) {
|
|
2804
|
+
for (const e of fresh) loggedBelowGoalExclusions.add(e.id);
|
|
2805
|
+
log(formatBelowGoalExclusionLog(fresh, validated.goal));
|
|
2806
|
+
}
|
|
2807
|
+
return dispatchable;
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2221
2810
|
// Stall detection: abort with a typed StalledSprintError after two
|
|
2222
2811
|
// consecutive cycles that made no forward progress, rather than burning
|
|
2223
2812
|
// every remaining cycle on a develop/review loop that keeps reopening and
|
|
@@ -2290,6 +2879,17 @@ async function runSprintCycle(context) {
|
|
|
2290
2879
|
// evidence-based prompt below -- never silently swallowed.
|
|
2291
2880
|
const deployFailures = [];
|
|
2292
2881
|
const integFailures = [];
|
|
2882
|
+
// apra-fleet-b4g.102.1: the LATEST cycle's deploy outcome ({cycle, notes}
|
|
2883
|
+
// when deploy.md exists and that cycle's deploy failed, else null), and
|
|
2884
|
+
// how many consecutive cycles ended otherwise-satisfied but deploy-blocked.
|
|
2885
|
+
// Cycle Evaluation never exits as satisfied while lastDeployFailure is
|
|
2886
|
+
// set, and Final Review forces FAIL if it is still set when the loop ends
|
|
2887
|
+
// (see the deploy-failure verdict gate in ./phases/deploy.mjs).
|
|
2888
|
+
let lastDeployFailure = null;
|
|
2889
|
+
let deployBlockedCycles = 0;
|
|
2890
|
+
// GitHub #717: set (to the named diagnosis) when the cycle loop exits on a
|
|
2891
|
+
// verify-block deadlock; Final Review then forces the verdict to FAIL.
|
|
2892
|
+
let verifyBlockDiagnosis = null;
|
|
2293
2893
|
|
|
2294
2894
|
// apra-fleet-nwh.1: integ-test-runner's own tracked spend, broken out of
|
|
2295
2895
|
// the harvester's cost block so it is never silently folded into
|
|
@@ -2365,6 +2965,12 @@ async function runSprintCycle(context) {
|
|
|
2365
2965
|
log(`Route C${cycle}: ${verifySetThisCycle.length} bead(s) implementation-complete, routed to verify (excluded from Plan/Develop): ${verifySetThisCycle.join(', ')}`);
|
|
2366
2966
|
}
|
|
2367
2967
|
|
|
2968
|
+
// GitHub #715: re-lane beads a failed doer of THIS run left
|
|
2969
|
+
// in_progress, before Plan and before readiness is computed, so they
|
|
2970
|
+
// (and the beads they block) are dispatchable again this cycle. No bd
|
|
2971
|
+
// call at all unless a doer streak of this run failed.
|
|
2972
|
+
await reclaimInRunOrphanedClaims({ reasonTag: `Cycle ${cycle} in-run reclaim` });
|
|
2973
|
+
|
|
2368
2974
|
// =======================
|
|
2369
2975
|
// 1. Planning Loop
|
|
2370
2976
|
// =======================
|
|
@@ -2377,7 +2983,7 @@ async function runSprintCycle(context) {
|
|
|
2377
2983
|
const planOutcome = await runPlanPhase({
|
|
2378
2984
|
phase, log, command, dispatchCtx,
|
|
2379
2985
|
cycle, validated, targetIssues, requirementsContent,
|
|
2380
|
-
|
|
2986
|
+
backlogMember, getMemberForRole,
|
|
2381
2987
|
sprintState, gitSync, args,
|
|
2382
2988
|
verifySetThisCycle, roundSessions, pendingRejectedNewTasks,
|
|
2383
2989
|
resolveSettleShell,
|
|
@@ -2418,7 +3024,7 @@ async function runSprintCycle(context) {
|
|
|
2418
3024
|
// filter exists to stop NON-target parents/bugs from wasting doer
|
|
2419
3025
|
// dispatches, never to make a sprint's own target unreachable.
|
|
2420
3026
|
const targetIssueSet = new Set(targetIssues);
|
|
2421
|
-
let readyBeads = (await
|
|
3027
|
+
let readyBeads = (await dispatchableReadyLeafBeads())
|
|
2422
3028
|
.filter((b) => targetIssueSet.has(b.id) || !b.issue_type || b.issue_type === 'task')
|
|
2423
3029
|
.slice().sort((a, b) => a.title.localeCompare(b.title) || a.id.localeCompare(b.id));
|
|
2424
3030
|
|
|
@@ -2439,7 +3045,7 @@ async function runSprintCycle(context) {
|
|
|
2439
3045
|
});
|
|
2440
3046
|
if (cycleReclaimedIds.length > 0) {
|
|
2441
3047
|
log(`Cycle ${cycle} self-heal: reclaimed ${cycleReclaimedIds.length} orphaned bead(s), re-checking readiness: ${cycleReclaimedIds.join(', ')}.`);
|
|
2442
|
-
readyBeads = (await
|
|
3048
|
+
readyBeads = (await dispatchableReadyLeafBeads())
|
|
2443
3049
|
.filter((b) => targetIssueSet.has(b.id) || !b.issue_type || b.issue_type === 'task')
|
|
2444
3050
|
.slice().sort((a, b) => a.title.localeCompare(b.title) || a.id.localeCompare(b.id));
|
|
2445
3051
|
}
|
|
@@ -2521,7 +3127,7 @@ async function runSprintCycle(context) {
|
|
|
2521
3127
|
// after the plan phase (a reviewer newTask, an out-of-band filing)
|
|
2522
3128
|
// would otherwise land in a doer streak and burn a dispatch on a
|
|
2523
3129
|
// contract-bound refusal. Same target-issue exemption as above.
|
|
2524
|
-
const currentReadyAll = (await
|
|
3130
|
+
const currentReadyAll = (await dispatchableReadyLeafBeads())
|
|
2525
3131
|
.filter((b) => targetIssueSet.has(b.id) || !b.issue_type || b.issue_type === 'task')
|
|
2526
3132
|
.slice().sort((a, b) => a.title.localeCompare(b.title) || a.id.localeCompare(b.id));
|
|
2527
3133
|
|
|
@@ -2557,10 +3163,10 @@ async function runSprintCycle(context) {
|
|
|
2557
3163
|
await runReplanPhase({
|
|
2558
3164
|
phase, log, dispatchCtx,
|
|
2559
3165
|
cycle, validated, targetIssues, requirementsContent,
|
|
2560
|
-
|
|
3166
|
+
backlogMember,
|
|
2561
3167
|
gitSync, updateDashboard,
|
|
2562
3168
|
verifySetThisCycle, pendingRejectedNewTasks,
|
|
2563
|
-
devRounds, eligibleReplan, replanIds, replannedThisCycle,
|
|
3169
|
+
devRounds, eligibleReplan, replanIds, replannedThisCycle, perBeadFeedback,
|
|
2564
3170
|
});
|
|
2565
3171
|
continue;
|
|
2566
3172
|
}
|
|
@@ -2608,15 +3214,19 @@ async function runSprintCycle(context) {
|
|
|
2608
3214
|
// reviewer prompt free of doer-completion-order drift.
|
|
2609
3215
|
const { streakOutcomes, readyTitleById } = await runDevelopPhase({
|
|
2610
3216
|
phase, log, command, parallel, dispatchCtx,
|
|
2611
|
-
cycle, validated, args,
|
|
3217
|
+
cycle, validated, args, backlogMember,
|
|
2612
3218
|
sprintState, gitSync, updateDashboard,
|
|
2613
|
-
kbPriming, kbWork,
|
|
3219
|
+
kbPriming, kbWork, kbInjection, kbSprintContext,
|
|
2614
3220
|
devRounds, currentReady, doerPool, perBeadFeedback,
|
|
2615
3221
|
claimBeadsBatched,
|
|
2616
3222
|
verifyDoerStreakClosed,
|
|
2617
3223
|
normalizeTierToken,
|
|
2618
3224
|
kbQueryTerms,
|
|
2619
3225
|
});
|
|
3226
|
+
for (const o of streakOutcomes) {
|
|
3227
|
+
for (const id of (o.beadIds || [])) workedOnBeadIds.add(id);
|
|
3228
|
+
}
|
|
3229
|
+
orphanClaims.recordOutcomes(streakOutcomes);
|
|
2620
3230
|
|
|
2621
3231
|
// --- Review: self-contained, schema-validated, orchestrator-applied ---
|
|
2622
3232
|
// The phase body lives in ./phases/review.mjs
|
|
@@ -2632,12 +3242,13 @@ async function runSprintCycle(context) {
|
|
|
2632
3242
|
// unchanged, which is why no `if` is needed here.
|
|
2633
3243
|
({ lastReviewVerdict, reviewedThisCycle, pendingRejectedNewTasks } = await runReviewPhase({
|
|
2634
3244
|
phase, log, command,
|
|
2635
|
-
cycle, validated, targetIssues,
|
|
3245
|
+
cycle, validated, targetIssues, backlogMember,
|
|
2636
3246
|
gitSync,
|
|
2637
3247
|
replanIds, replannedThisCycle, perBeadFeedback, rejectedNewTasks,
|
|
2638
3248
|
devRounds, streakOutcomes, readyTitleById,
|
|
2639
3249
|
lastReviewVerdict, reviewedThisCycle, pendingRejectedNewTasks,
|
|
2640
3250
|
dispatchReview, bdListScoped, goalMax, recordReopen,
|
|
3251
|
+
workedOnIds: workedOnBeadIds,
|
|
2641
3252
|
childIdAllocator, sprintMutexId,
|
|
2642
3253
|
computeChildFloor, createChildBeadWithAllocatedId,
|
|
2643
3254
|
trackRejectedNewTaskForResurfacing, clearResubmittedNewTask,
|
|
@@ -2652,7 +3263,7 @@ async function runSprintCycle(context) {
|
|
|
2652
3263
|
// must not read as "work still pending" here -- it is never a
|
|
2653
3264
|
// dispatchable leaf, so it must not keep this loop from
|
|
2654
3265
|
// organically completing (apra-fleet-66u.1/66u.2 rework).
|
|
2655
|
-
const stillOpen = await
|
|
3266
|
+
const stillOpen = await dispatchableReadyLeafBeads();
|
|
2656
3267
|
lastStillOpenCount = stillOpen.length; // Track for post-loop round-cap detection
|
|
2657
3268
|
|
|
2658
3269
|
if (stillOpen.length === 0) {
|
|
@@ -2702,6 +3313,8 @@ async function runSprintCycle(context) {
|
|
|
2702
3313
|
} else {
|
|
2703
3314
|
log('Skipping Deploy Phase (no deploy.md found, or the probe itself failed -- see prior log line)');
|
|
2704
3315
|
}
|
|
3316
|
+
lastDeployFailure = latestDeployFailure({ hasDeploy, deployedThisCycle, cycle, deployFailures });
|
|
3317
|
+
if (!lastDeployFailure) deployBlockedCycles = 0;
|
|
2705
3318
|
|
|
2706
3319
|
// apra-fleet-66u.2: declared here, OUTSIDE the `if (hasPlaybook &&
|
|
2707
3320
|
// deployedThisCycle)` block below, so Cycle Evaluation's
|
|
@@ -2726,7 +3339,7 @@ async function runSprintCycle(context) {
|
|
|
2726
3339
|
// the closure did; the three genuinely reassigned values come back.
|
|
2727
3340
|
({ verifySetForIntegTest, integTestRunnerDispatchCount, integTestRunnerSpend } = await runIntegTestPhase({
|
|
2728
3341
|
phase, log, command, dispatchCtx,
|
|
2729
|
-
cycle, targetIssues,
|
|
3342
|
+
cycle, targetIssues, backlogMember, sprintSelfIdLine,
|
|
2730
3343
|
budget,
|
|
2731
3344
|
integFailures, verifyEverIds, verifyGapCounts,
|
|
2732
3345
|
verifySetForIntegTest, integTestRunnerDispatchCount, integTestRunnerSpend,
|
|
@@ -2754,11 +3367,11 @@ async function runSprintCycle(context) {
|
|
|
2754
3367
|
// counts so the completion/stall math reads the current cross-member
|
|
2755
3368
|
// beads state (every member's D-pushed closes) rather than the
|
|
2756
3369
|
// orchestrator's stale local copy.
|
|
2757
|
-
// Thread the
|
|
3370
|
+
// Thread the backlog member's REGISTERED shell into dolt-settle,
|
|
2758
3371
|
// guarded on args.callTool the same way the pre-dispatch bracket is
|
|
2759
3372
|
// (apra-fleet-7dir.24).
|
|
2760
|
-
const cycleEvalSettleShell = await resolveSettleShell({ args, member:
|
|
2761
|
-
await gitSync.syncBeadsBefore(
|
|
3373
|
+
const cycleEvalSettleShell = await resolveSettleShell({ args, member: backlogMember, log, sprintState });
|
|
3374
|
+
await gitSync.syncBeadsBefore(backlogMember, { fatal: true, settle: buildSettleCallback(backlogMember, { command, log, shell: cycleEvalSettleShell }) });
|
|
2762
3375
|
// A decomposed parent (any bead that is itself someone's --parent,
|
|
2763
3376
|
// including a childful --issue target) is excluded here the same way
|
|
2764
3377
|
// readyLeafBeads() excludes it from dispatch: its own "done" status
|
|
@@ -2850,7 +3463,13 @@ async function runSprintCycle(context) {
|
|
|
2850
3463
|
staleCycles++;
|
|
2851
3464
|
}
|
|
2852
3465
|
|
|
2853
|
-
|
|
3466
|
+
// apra-fleet-b4g.102.1: a cycle spent re-attempting a failed deploy
|
|
3467
|
+
// after the work itself was already satisfied is not a stall -- it is
|
|
3468
|
+
// bounded separately (DEPLOY_RETRY_CYCLE_LIMIT and maxCycles) by the
|
|
3469
|
+
// deploy-blocked exit below, which ends the sprint with a FAIL naming
|
|
3470
|
+
// the deploy failure instead of a SPRINT_STALLED abort that would not.
|
|
3471
|
+
const waitingOnDeployRetry = deployBlockedCycles > 0 && lastDeployFailure !== null && openAtGoal.length === 0;
|
|
3472
|
+
if (staleCycles >= STALL_CYCLE_LIMIT && !waitingOnDeployRetry) {
|
|
2854
3473
|
const thrashIds = thrashingBeadIds();
|
|
2855
3474
|
// apra-fleet-mjo: counts alone ("history: [9, 14, 14, 14]") do not
|
|
2856
3475
|
// tell an operator WHAT is holding the sprint open, which is
|
|
@@ -2904,16 +3523,43 @@ async function runSprintCycle(context) {
|
|
|
2904
3523
|
}
|
|
2905
3524
|
|
|
2906
3525
|
// apra-fleet-jfo D5: if the ONLY open-at-goal beads remaining are
|
|
2907
|
-
// verify-routed and
|
|
2908
|
-
// cycle can make progress by construction -- exit to
|
|
2909
|
-
// directly rather than let the stall net eventually
|
|
2910
|
-
// "finished but unverifiable" into an ABORT.
|
|
2911
|
-
|
|
2912
|
-
|
|
3526
|
+
// verify-routed and the Integration Test phase cannot run to verify
|
|
3527
|
+
// them, no further cycle can make progress by construction -- exit to
|
|
3528
|
+
// Finalization directly rather than let the stall net eventually
|
|
3529
|
+
// convert "finished but unverifiable" into an ABORT. GitHub #717: keyed
|
|
3530
|
+
// on the one integCanRun predicate (playbook AND deploy.md AND the
|
|
3531
|
+
// deploy did not fail this cycle), not on the playbook alone.
|
|
3532
|
+
const integCanRunThisCycle = integCanRun({ hasPlaybook, hasDeploy, deployAttempted: hasDeploy, deployedThisCycle });
|
|
3533
|
+
if (!integCanRunThisCycle && openAtGoal.length > 0 && openAtGoal.every((b) => verifyEverIds.has(b.id))) {
|
|
3534
|
+
log(`Cycle ${cycle}: all ${openAtGoal.length} remaining open-at-goal bead(s) are verify-routed (${openAtGoal.map((b) => b.id).join(', ')}) and the Integration Test phase cannot run to verify them (it needs integ-test-playbook.md, deploy.md and a successful deploy) -- exiting cycle loop, cannot make further progress by construction.`);
|
|
2913
3535
|
endGroup();
|
|
2914
3536
|
break;
|
|
2915
3537
|
}
|
|
2916
3538
|
|
|
3539
|
+
// GitHub #717, mid-run: the same deadlock the pre-sprint check stops,
|
|
3540
|
+
// arising while the sprint runs (a blocker's last child closed, or the
|
|
3541
|
+
// deploy failed). When the Integration Test phase cannot run this cycle
|
|
3542
|
+
// and every remaining open-at-goal bead is verify-routed or blocked
|
|
3543
|
+
// ONLY by verify-routed beads, no cycle can progress: exit with the
|
|
3544
|
+
// named diagnosis, and Final Review forces the verdict to FAIL. Read
|
|
3545
|
+
// from this cycle's own fresh closed list and verify set -- no extra
|
|
3546
|
+
// bd call.
|
|
3547
|
+
if (!integCanRunThisCycle && openAtGoal.length > 0) {
|
|
3548
|
+
const knownClosed = [...closedIdsNow].map((id) => ({ id, status: 'closed' }));
|
|
3549
|
+
const blockedAtGoal = findVerifyBlockedBeads(openAtGoal, knownClosed, verifySetThisCycle);
|
|
3550
|
+
const blockedAtGoalIds = new Set(blockedAtGoal.map((b) => b.id));
|
|
3551
|
+
if (blockedAtGoal.length > 0 && openAtGoal.every((b) => verifyEverIds.has(b.id) || blockedAtGoalIds.has(b.id))) {
|
|
3552
|
+
verifyBlockDiagnosis = buildVerifyBlockDiagnosis({
|
|
3553
|
+
blocked: blockedAtGoal,
|
|
3554
|
+
cause: integBlockCause({ hasPlaybook, hasDeploy, deployAttempted: hasDeploy, deployedThisCycle }),
|
|
3555
|
+
deployNotes: lastDeployFailure && lastDeployFailure.notes ? lastDeployFailure.notes : null,
|
|
3556
|
+
});
|
|
3557
|
+
log(`Cycle ${cycle}: ${verifyBlockDiagnosis} Exiting cycle loop; the sprint verdict will be FAIL.`);
|
|
3558
|
+
endGroup();
|
|
3559
|
+
break;
|
|
3560
|
+
}
|
|
3561
|
+
}
|
|
3562
|
+
|
|
2917
3563
|
// The exit decision below must never rely on a verdict from an EARLIER
|
|
2918
3564
|
// cycle. `lastReviewVerdict` is reset to null at the top of every cycle
|
|
2919
3565
|
// and only set when a review genuinely ran THIS cycle
|
|
@@ -2934,11 +3580,12 @@ async function runSprintCycle(context) {
|
|
|
2934
3580
|
// reassigned values come back.
|
|
2935
3581
|
({ lastReviewVerdict, reviewedThisCycle, pendingRejectedNewTasks } = await runReReviewPhase({
|
|
2936
3582
|
phase, log, command,
|
|
2937
|
-
cycle, validated, targetIssues,
|
|
3583
|
+
cycle, validated, targetIssues, backlogMember,
|
|
2938
3584
|
gitSync,
|
|
2939
3585
|
rejectedNewTasks,
|
|
2940
3586
|
lastReviewVerdict, reviewedThisCycle, pendingRejectedNewTasks,
|
|
2941
3587
|
dispatchReview, bdListScoped, goalMax, recordReopen,
|
|
3588
|
+
workedOnIds: workedOnBeadIds,
|
|
2942
3589
|
childIdAllocator, sprintMutexId,
|
|
2943
3590
|
computeChildFloor, createChildBeadWithAllocatedId,
|
|
2944
3591
|
trackRejectedNewTaskForResurfacing, clearResubmittedNewTask,
|
|
@@ -2994,13 +3641,35 @@ async function runSprintCycle(context) {
|
|
|
2994
3641
|
// open/in_progress/blocked can never satisfy `.every()` here, so this
|
|
2995
3642
|
// never fires for that case and every gate above/below runs exactly
|
|
2996
3643
|
// as before.
|
|
2997
|
-
|
|
3644
|
+
// apra-fleet-b4g.102.1: neither "satisfied" exit below may fire while
|
|
3645
|
+
// the LATEST cycle's deploy failed (Integration Test was skipped, so
|
|
3646
|
+
// nothing verified the deployed build). Re-attempt the deploy in
|
|
3647
|
+
// another cycle while the budget allows; otherwise exit to the finish
|
|
3648
|
+
// phases, where Final Review forces a FAIL that names the failure. A
|
|
3649
|
+
// sprint with no deploy.md never sets lastDeployFailure.
|
|
3650
|
+
const rootsAllClosed = targetIssues.length > 0 && targetIssues.every((id) => closedIdsNow.has(id));
|
|
3651
|
+
const goalSatisfied = openAtGoal.length === 0 && lastReviewVerdict === 'APPROVED' && stillOpenVerifyIds.length === 0;
|
|
3652
|
+
if ((rootsAllClosed || goalSatisfied) && lastDeployFailure) {
|
|
3653
|
+
deployBlockedCycles++;
|
|
3654
|
+
const which = rootsAllClosed ? 'every configured sprint root/target bead is closed' : `goal priority ${validated.goal} (<=${goalMax}) is otherwise satisfied`;
|
|
3655
|
+
if (cycle < MAX_CYCLES && deployBlockedCycles < DEPLOY_RETRY_CYCLE_LIMIT) {
|
|
3656
|
+
log(`Cycle ${cycle}: ${which}, but NOT exiting as satisfied -- ${formatDeployFailureReason(lastDeployFailure)}. Re-attempting deploy next cycle (deploy-blocked cycle ${deployBlockedCycles} of at most ${DEPLOY_RETRY_CYCLE_LIMIT}).`);
|
|
3657
|
+
cycle++;
|
|
3658
|
+
endGroup();
|
|
3659
|
+
continue;
|
|
3660
|
+
}
|
|
3661
|
+
log(`Cycle ${cycle}: ${which}, but the deploy re-attempt budget is exhausted (${deployBlockedCycles} consecutive deploy-blocked cycle(s), maxCycles ${MAX_CYCLES}) -- ${formatDeployFailureReason(lastDeployFailure)}. Exiting cycle loop; the sprint verdict will be FAIL.`);
|
|
3662
|
+
endGroup();
|
|
3663
|
+
break;
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
if (rootsAllClosed) {
|
|
2998
3667
|
log(`Cycle ${cycle}: every configured sprint root/target bead is already closed (${targetIssues.join(', ')}) -- no further cycle can make progress. Exiting cycle loop straight into the finish phases.`);
|
|
2999
3668
|
endGroup();
|
|
3000
3669
|
break;
|
|
3001
3670
|
}
|
|
3002
3671
|
|
|
3003
|
-
if (
|
|
3672
|
+
if (goalSatisfied) {
|
|
3004
3673
|
// apra-fleet-rp7a.1: the deferred enumeration rides on the EXIT
|
|
3005
3674
|
// line specifically, because this is the line that says the sprint
|
|
3006
3675
|
// is finished -- a scope whose only remaining not-done beads were
|
|
@@ -3062,11 +3731,15 @@ async function runSprintCycle(context) {
|
|
|
3062
3731
|
// hold the line.
|
|
3063
3732
|
const { finalVerdictResult, finalClosedCount, finalOpenAtGoalCount, finalDeferredAtGoalIds } = await runFinalReviewPhase({
|
|
3064
3733
|
phase, log, command, dispatchCtx,
|
|
3065
|
-
args, validated, targetIssues,
|
|
3734
|
+
args, validated, targetIssues, backlogMember, finalCycleLabel, sprintState,
|
|
3066
3735
|
gitSync,
|
|
3067
3736
|
deployFailures, integFailures, rejectedNewTasks, verifyEverIds,
|
|
3737
|
+
lastDeployFailure,
|
|
3068
3738
|
bdListScoped, decomposedParentIds, goalMax, NOT_DONE_STATUSES,
|
|
3069
|
-
|
|
3739
|
+
reclaimCappedIds: orphanClaims.cappedIds(),
|
|
3740
|
+
verifyBlockDiagnosis,
|
|
3741
|
+
workedOnIds: workedOnBeadIds,
|
|
3742
|
+
kbPriming, kbWork, kbInjection, kbSprintContext, getMemberForRole,
|
|
3070
3743
|
childIdAllocator, sprintMutexId, resolveSettleShell,
|
|
3071
3744
|
computeChildFloor, createChildBeadWithAllocatedId, sanitizePrText,
|
|
3072
3745
|
});
|
|
@@ -3101,8 +3774,17 @@ async function runSprintCycle(context) {
|
|
|
3101
3774
|
// part 2 provisions its own fresh sandbox install, so neither depends on
|
|
3102
3775
|
// the per-cycle Deploy target.
|
|
3103
3776
|
let regressionResult = null;
|
|
3104
|
-
|
|
3105
|
-
|
|
3777
|
+
// An explicit launch option (skip_regression) skips the pass outright --
|
|
3778
|
+
// checked BEFORE the playbook probe so a deliberate skip is never reported
|
|
3779
|
+
// as "no playbook found". The skip is carried to the sprint report and the
|
|
3780
|
+
// PR body (regressionSkippedBy) so it can never read as a pass.
|
|
3781
|
+
const regressionSkippedBy = validated.skipRegression ? 'launch option' : null;
|
|
3782
|
+
const hasRegressionPlaybook = regressionSkippedBy
|
|
3783
|
+
? false
|
|
3784
|
+
: await probeFileExists('regression-test-playbook.md', getMemberForRole('regression-test-runner'));
|
|
3785
|
+
if (regressionSkippedBy) {
|
|
3786
|
+
log(`Skipping Regression Test Phase: skipped by ${regressionSkippedBy} (skip_regression).`);
|
|
3787
|
+
} else if (hasRegressionPlaybook) {
|
|
3106
3788
|
// The phase body lives in ./phases/regression-test.mjs
|
|
3107
3789
|
// (apra-fleet-3swo.6.6). The probeFileExists call that produces
|
|
3108
3790
|
// hasRegressionPlaybook, the `let regressionResult = null` default and
|
|
@@ -3121,21 +3803,23 @@ async function runSprintCycle(context) {
|
|
|
3121
3803
|
log('Skipping Regression Test Phase (no regression-test-playbook.md found, or the probe itself failed -- see prior log line)');
|
|
3122
3804
|
}
|
|
3123
3805
|
|
|
3124
|
-
// The phase body lives in ./phases/harvest.mjs (apra-fleet-3swo.6.9).
|
|
3125
|
-
//
|
|
3126
|
-
//
|
|
3127
|
-
//
|
|
3128
|
-
//
|
|
3806
|
+
// The phase body lives in ./phases/harvest.mjs (apra-fleet-3swo.6.9). The
|
|
3807
|
+
// sprint-analysis document, the docs commits and the issue deferrals are
|
|
3808
|
+
// all written by the DISPATCHED harvester in its own repo, and the
|
|
3809
|
+
// 'harvester' policy row's pushCode/pushBeads bracket publishes them. The
|
|
3810
|
+
// only value it returns is the cost block Publish PR renders. It must
|
|
3129
3811
|
// nonetheless run HERE, after Regression Test (whose summary it folds into
|
|
3130
3812
|
// the analysis document) and before Publish PR (which pushes the branch the
|
|
3131
3813
|
// harvester just committed to).
|
|
3132
|
-
await runHarvestPhase({
|
|
3814
|
+
const { costAnalysis } = await runHarvestPhase({
|
|
3133
3815
|
phase, log, dispatchCtx,
|
|
3134
3816
|
validated, targetIssues, finalCycleLabel, budget,
|
|
3135
3817
|
closedCountHistory, highWaterClosedCount,
|
|
3136
3818
|
deployFailures, integFailures, rejectedNewTasks,
|
|
3137
3819
|
integTestRunnerSpend, integTestRunnerDispatchCount,
|
|
3138
|
-
finalVerdictResult, finalClosedCount, finalOpenAtGoalCount, finalDeferredAtGoalIds, regressionResult,
|
|
3820
|
+
finalVerdictResult, finalClosedCount, finalOpenAtGoalCount, finalDeferredAtGoalIds, regressionResult, regressionSkippedBy,
|
|
3821
|
+
dispatchToolCalls: sprintState.dispatchToolCalls,
|
|
3822
|
+
kbWork,
|
|
3139
3823
|
computeBranchSlug, buildAnalysisText, buildCostAnalysis,
|
|
3140
3824
|
});
|
|
3141
3825
|
|
|
@@ -3154,12 +3838,14 @@ async function runSprintCycle(context) {
|
|
|
3154
3838
|
// unpushed branch) while PRESERVING the sprint's own computed verdict; a
|
|
3155
3839
|
// genuine PR-creation failure still throws a typed CommandError out of the
|
|
3156
3840
|
// phase, before the endGroup() below, exactly as the inline version did.
|
|
3841
|
+
// Sprint-summary WARN: repeat the lower-quality banner once at the end.
|
|
3842
|
+
const lowerQualityBanner = logLowerQualityWarn(log, MEMBER_INIT_LOG_PREFIX, sprintState.memberInit, 'summary');
|
|
3157
3843
|
const { pushed } = await runPublishPrPhase({
|
|
3844
|
+
lowerQualityBanner,
|
|
3158
3845
|
phase, log, command,
|
|
3159
|
-
args, validated, targetIssues,
|
|
3846
|
+
args, validated, targetIssues, backlogMember, finalCycleLabel,
|
|
3160
3847
|
gitSync, getMemberForRole,
|
|
3161
|
-
finalVerdictResult,
|
|
3162
|
-
sanitizePrText,
|
|
3848
|
+
finalVerdictResult, costAnalysis,
|
|
3163
3849
|
});
|
|
3164
3850
|
|
|
3165
3851
|
endGroup();
|
|
@@ -3252,6 +3938,11 @@ export async function main(context) {
|
|
|
3252
3938
|
try {
|
|
3253
3939
|
return await runSprintCycle(runContext);
|
|
3254
3940
|
} catch (err) {
|
|
3941
|
+
// An aborted sprint commits nothing further to the KB bible: its
|
|
3942
|
+
// queued confirmations are not flushed.
|
|
3943
|
+
if (runContext.kbWork && typeof runContext.kbWork.seal === 'function') {
|
|
3944
|
+
runContext.kbWork.seal(`sprint aborted: ${err && err.message ? err.message : String(err)}`);
|
|
3945
|
+
}
|
|
3255
3946
|
if (!isTerminalSprintFailure(err)) {
|
|
3256
3947
|
throw err;
|
|
3257
3948
|
}
|
|
@@ -3274,20 +3965,20 @@ export async function main(context) {
|
|
|
3274
3965
|
if (isTypedAbortError(err)) {
|
|
3275
3966
|
try {
|
|
3276
3967
|
// apra-fleet: finalizeAbort() runs `git fetch`/`git push` against
|
|
3277
|
-
// this member's LOCAL checkout, which the
|
|
3968
|
+
// this member's LOCAL checkout, which the backlog role no
|
|
3278
3969
|
// longer has (it may be a shared/unreservable, git-less member --
|
|
3279
3970
|
// see docs/design-orchestrator-worktree-model-v2.md section 4.5).
|
|
3280
3971
|
// Resolve a git-capable DISPATCH member instead: the harvester's
|
|
3281
3972
|
// member (the last code-writing role, so its clone pushed most
|
|
3282
3973
|
// recently), falling back to the first doer, never
|
|
3283
|
-
// roleMap.
|
|
3974
|
+
// roleMap.backlog and never a bare validatedForLock.members[0]
|
|
3284
3975
|
// pick (that silent pick is the original bug this closes).
|
|
3285
3976
|
const roleMap = validatedForLock.roleMap;
|
|
3286
3977
|
const harvesterMembers = (roleMap && Array.isArray(roleMap['harvester'])) ? roleMap['harvester'] : [];
|
|
3287
3978
|
const doerMembers = (roleMap && Array.isArray(roleMap[ROLE_DOER])) ? roleMap[ROLE_DOER] : [];
|
|
3288
3979
|
const member = harvesterMembers[0]
|
|
3289
3980
|
?? doerMembers[0]
|
|
3290
|
-
?? validatedForLock.members.find((m) => !roleMap || !roleMap[
|
|
3981
|
+
?? validatedForLock.members.find((m) => !roleMap || !roleMap[ROLE_BACKLOG] || !roleMap[ROLE_BACKLOG].includes(m));
|
|
3291
3982
|
if (!member) {
|
|
3292
3983
|
log('[Terminal History] finalizeAbort() skipped: no harvester/doer/dispatch member could be resolved to push the aborted branch.');
|
|
3293
3984
|
throw new Error('no git-capable member resolved for finalizeAbort');
|
|
@@ -3301,6 +3992,7 @@ export async function main(context) {
|
|
|
3301
3992
|
log,
|
|
3302
3993
|
onAuthFailure: abortOnAuthFailure,
|
|
3303
3994
|
callTool: (args && typeof args.callTool === 'function') ? args.callTool : undefined,
|
|
3995
|
+
runId: (args && typeof args.run_id === 'string') ? args.run_id : undefined,
|
|
3304
3996
|
});
|
|
3305
3997
|
} catch (finalizeErr) {
|
|
3306
3998
|
log(
|