@apralabs/apra-fleet 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -5
- package/dist/agents/backlog-groomer.md +25 -0
- package/dist/agents/ci-watcher.md +11 -0
- package/dist/agents/deployer.md +37 -2
- package/dist/agents/doer.md +36 -12
- package/dist/agents/harvester.md +11 -0
- package/dist/agents/integ-test-runner.md +11 -0
- package/dist/agents/kb-reconciler.md +9 -0
- package/dist/agents/plan-reviewer.md +110 -22
- package/dist/agents/planner.md +125 -37
- package/dist/agents/regression-test-runner.md +11 -0
- package/dist/agents/reviewer.md +13 -2
- package/dist/agents/schemas/plan-reviewer-output.json +37 -0
- package/dist/cli/agent-transform.d.ts +83 -2
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +266 -21
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +28 -9
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +7 -5
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +44 -34
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/install.d.ts +33 -0
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +290 -23
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/kb-directives.d.ts.map +1 -1
- package/dist/cli/kb-directives.js +2 -1
- package/dist/cli/kb-directives.js.map +1 -1
- package/dist/cli/register-member.d.ts.map +1 -1
- package/dist/cli/register-member.js +6 -2
- package/dist/cli/register-member.js.map +1 -1
- package/dist/commands/kb-server.d.ts +3 -0
- package/dist/commands/kb-server.d.ts.map +1 -1
- package/dist/commands/kb-server.js +43 -3
- package/dist/commands/kb-server.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/os/linux.d.ts +6 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +35 -2
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +61 -2
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows-gitbash.d.ts +5 -0
- package/dist/os/windows-gitbash.d.ts.map +1 -1
- package/dist/os/windows-gitbash.js +15 -0
- package/dist/os/windows-gitbash.js.map +1 -1
- package/dist/os/windows.d.ts +6 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +46 -3
- package/dist/os/windows.js.map +1 -1
- package/dist/providers/agy.d.ts +115 -6
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +569 -53
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +81 -3
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +344 -10
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +4 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +19 -2
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +4 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +20 -2
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/none.d.ts +4 -2
- package/dist/providers/none.d.ts.map +1 -1
- package/dist/providers/none.js +17 -2
- package/dist/providers/none.js.map +1 -1
- package/dist/providers/opencode.d.ts +3 -1
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +22 -2
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +201 -6
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +56 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agy-project.d.ts +102 -0
- package/dist/services/agy-project.d.ts.map +1 -0
- package/dist/services/agy-project.js +356 -0
- package/dist/services/agy-project.js.map +1 -0
- package/dist/services/auth-socket.js +4 -4
- package/dist/services/auth-web.js +1 -1
- package/dist/services/cloud/lifecycle.d.ts.map +1 -1
- package/dist/services/cloud/lifecycle.js +33 -4
- package/dist/services/cloud/lifecycle.js.map +1 -1
- package/dist/services/credential-cleanup.d.ts.map +1 -1
- package/dist/services/credential-cleanup.js +35 -17
- package/dist/services/credential-cleanup.js.map +1 -1
- package/dist/services/exit-drain.d.ts +44 -0
- package/dist/services/exit-drain.d.ts.map +1 -0
- package/dist/services/exit-drain.js +52 -0
- package/dist/services/exit-drain.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +32 -4
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +1 -0
- package/dist/services/http-transport.d.ts.map +1 -1
- package/dist/services/http-transport.js +48 -1
- package/dist/services/http-transport.js.map +1 -1
- package/dist/services/knowledge/kb-config.d.ts +42 -0
- package/dist/services/knowledge/kb-config.d.ts.map +1 -0
- package/dist/services/knowledge/kb-config.js +54 -0
- package/dist/services/knowledge/kb-config.js.map +1 -0
- package/dist/services/knowledge/kb-providers.d.ts +7 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
- package/dist/services/knowledge/kb-providers.js +191 -17
- package/dist/services/knowledge/kb-providers.js.map +1 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
- package/dist/services/knowledge/require-sqlite-project.js +38 -0
- package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
- package/dist/services/model-pricing.d.ts.map +1 -1
- package/dist/services/model-pricing.js +7 -3
- package/dist/services/model-pricing.js.map +1 -1
- package/dist/services/secret-token.d.ts +38 -0
- package/dist/services/secret-token.d.ts.map +1 -0
- package/dist/services/secret-token.js +51 -0
- package/dist/services/secret-token.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +3 -1
- package/dist/services/service-manager/types.d.ts.map +1 -1
- package/dist/services/service-manager/windows.d.ts +14 -2
- package/dist/services/service-manager/windows.d.ts.map +1 -1
- package/dist/services/service-manager/windows.js +65 -7
- package/dist/services/service-manager/windows.js.map +1 -1
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +58 -2
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/read-log-tail.d.ts.map +1 -1
- package/dist/services/stall/read-log-tail.js +20 -10
- package/dist/services/stall/read-log-tail.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts +53 -4
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +212 -34
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +79 -2
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.js +2 -2
- package/dist/services/substitution-engine.js.map +1 -1
- package/dist/services/tool-registry.d.ts.map +1 -1
- package/dist/services/tool-registry.js +5 -3
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/vcs/azure-devops.d.ts +66 -1
- package/dist/services/vcs/azure-devops.d.ts.map +1 -1
- package/dist/services/vcs/azure-devops.js +192 -21
- package/dist/services/vcs/azure-devops.js.map +1 -1
- package/dist/services/vcs/types.d.ts +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +18 -0
- package/dist/skills/pm/SKILL.md +1 -1
- package/dist/skills/pm/cost.md +0 -3
- package/dist/skills/pm/fleet-addendum.md +2 -2
- package/dist/tools/check-status.d.ts +7 -4
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +2 -0
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/compose-permissions.d.ts +6 -0
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +182 -34
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/credential-store-set.js +1 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +31 -20
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +15 -2
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +1196 -892
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/kb-capture.d.ts +2 -2
- package/dist/tools/kb-capture.d.ts.map +1 -1
- package/dist/tools/kb-capture.js +29 -5
- package/dist/tools/kb-capture.js.map +1 -1
- package/dist/tools/kb-export.d.ts +2 -2
- package/dist/tools/kb-export.d.ts.map +1 -1
- package/dist/tools/kb-export.js +3 -28
- package/dist/tools/kb-export.js.map +1 -1
- package/dist/tools/kb-feedback.d.ts.map +1 -1
- package/dist/tools/kb-feedback.js +3 -1
- package/dist/tools/kb-feedback.js.map +1 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
- package/dist/tools/kb-freshness-sweep.js +3 -1
- package/dist/tools/kb-freshness-sweep.js.map +1 -1
- package/dist/tools/kb-import.d.ts.map +1 -1
- package/dist/tools/kb-import.js +2 -1
- package/dist/tools/kb-import.js.map +1 -1
- package/dist/tools/kb-list.d.ts.map +1 -1
- package/dist/tools/kb-list.js +3 -1
- package/dist/tools/kb-list.js.map +1 -1
- package/dist/tools/kb-query.d.ts +2 -2
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
- package/dist/tools/kb-reconcile-prefilter.js +3 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
- package/dist/tools/kb-resolve-contradiction.js +3 -1
- package/dist/tools/kb-resolve-contradiction.js.map +1 -1
- package/dist/tools/kb-setup.d.ts.map +1 -1
- package/dist/tools/kb-setup.js +125 -20
- package/dist/tools/kb-setup.js.map +1 -1
- package/dist/tools/kb-stats.d.ts.map +1 -1
- package/dist/tools/kb-stats.js +64 -43
- package/dist/tools/kb-stats.js.map +1 -1
- package/dist/tools/list-members.d.ts +2 -2
- package/dist/tools/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +1 -0
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +2 -2
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +17 -0
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +58 -1
- package/dist/tools/member-reservation.d.ts.map +1 -1
- package/dist/tools/member-reservation.js +61 -20
- package/dist/tools/member-reservation.js.map +1 -1
- package/dist/tools/provision-auth.d.ts +80 -1
- package/dist/tools/provision-auth.d.ts.map +1 -1
- package/dist/tools/provision-auth.js +142 -54
- package/dist/tools/provision-auth.js.map +1 -1
- package/dist/tools/provision-vcs-auth.d.ts +91 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
- package/dist/tools/provision-vcs-auth.js +209 -49
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +12 -9
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +99 -12
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts.map +1 -1
- package/dist/tools/remove-member.js +27 -2
- package/dist/tools/remove-member.js.map +1 -1
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/setup-git-app.d.ts.map +1 -1
- package/dist/tools/setup-git-app.js +11 -7
- package/dist/tools/setup-git-app.js.map +1 -1
- package/dist/tools/shutdown-server.d.ts +2 -0
- package/dist/tools/shutdown-server.d.ts.map +1 -1
- package/dist/tools/shutdown-server.js +23 -1
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/update-member.d.ts +12 -9
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +43 -11
- package/dist/tools/update-member.js.map +1 -1
- package/dist/tools/vcs-credential-exec.d.ts +127 -0
- package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
- package/dist/tools/vcs-credential-exec.js +197 -0
- package/dist/tools/vcs-credential-exec.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/log-helpers.d.ts.map +1 -1
- package/dist/utils/log-helpers.js +2 -2
- package/dist/utils/log-helpers.js.map +1 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +7 -1
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/shell-escape.d.ts +16 -0
- package/dist/utils/shell-escape.d.ts.map +1 -1
- package/dist/utils/shell-escape.js +22 -2
- package/dist/utils/shell-escape.js.map +1 -1
- package/dist/utils/vcs-provider-detect.d.ts +65 -0
- package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
- package/dist/utils/vcs-provider-detect.js +109 -0
- package/dist/utils/vcs-provider-detect.js.map +1 -0
- package/dist/utils/workspace-trust.d.ts +20 -17
- package/dist/utils/workspace-trust.d.ts.map +1 -1
- package/dist/utils/workspace-trust.js +87 -1
- package/dist/utils/workspace-trust.js.map +1 -1
- package/dist/workflows/auto-sprint.js +176 -15
- package/package.json +6 -4
- package/packages/apra-fleet-client/src/client/api.mjs +319 -17
- package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
- package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +37 -2
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +36 -12
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +9 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +110 -22
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +125 -37
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +13 -2
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -1
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
- package/packages/apra-fleet-se/bin/cli.mjs +149 -1
- package/packages/apra-fleet-se/bin/serve.mjs +78 -4
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
- package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +61 -14
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +276 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +996 -32
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +267 -0
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
- package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
- package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
- package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
- package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
- package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
- package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +1467 -9798
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +17 -12
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +18 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
- package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +153 -19
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +71 -21
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +131 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +140 -16
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +77 -2
- package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
- package/packages/apra-fleet-se/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +17 -6
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +49 -7
- package/skills/fleet/SKILL.md +8 -8
- package/skills/fleet/auth-azdevops.md +14 -3
- package/skills/fleet/auth-bitbucket.md +2 -2
- package/skills/fleet/auth-github.md +5 -4
- package/skills/fleet/onboarding.md +3 -3
- package/skills/fleet/permissions.md +5 -1
- package/skills/fleet/profiles/node.json +1 -1
- package/skills/fleet/troubleshooting.md +3 -3
- package/version.json +1 -1
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// PHASE MODULE: Final Review (apra-fleet-3swo.6.6).
|
|
3
|
+
//
|
|
4
|
+
// The NINTH of runSprintCycle's twelve phase() boundaries -- the sprint's
|
|
5
|
+
// closing, evidence-based verdict. It D-pulls the orchestrator's beads clone so
|
|
6
|
+
// the closing counts reflect every member's pushed state, dispatches the
|
|
7
|
+
// REVIEWER persona over the whole sprint, and then has the ORCHESTRATOR -- never
|
|
8
|
+
// the LLM -- apply every structured transition that verdict asks for (validated
|
|
9
|
+
// newTask creation, guarded reopens) before D-pushing the beads it just mutated.
|
|
10
|
+
// Moved verbatim out of runner.js: every prompt, log line, dispatch option,
|
|
11
|
+
// validation branch and sync call is byte-identical to the inline version, so
|
|
12
|
+
// the golden transcript is unchanged. Move-only, no behaviour change.
|
|
13
|
+
//
|
|
14
|
+
// WHERE THIS PHASE STARTS AND STOPS. It runs from its own phase() call to the
|
|
15
|
+
// findings D-push that closes it. The `group('Finalization')` banner above the
|
|
16
|
+
// call site stays in runner.js -- it wraps Finalization as a WHOLE (this phase,
|
|
17
|
+
// Regression Test, Harvest and Publish PR), not this phase alone -- and
|
|
18
|
+
// everything after the findings D-push belongs to the phases that follow.
|
|
19
|
+
//
|
|
20
|
+
// WHAT COMES BACK, AND WHY IT MATTERS THAT IT DOES. `finalVerdictResult` IS the
|
|
21
|
+
// sprint's outcome: Publish PR reads its verdict and notes, and the analysis doc
|
|
22
|
+
// the harvester writes renders it alongside `finalClosedCount` /
|
|
23
|
+
// `finalOpenAtGoalCount`. Those three are the phase's return value rather than
|
|
24
|
+
// closure writes. The ORDER this creates is load-bearing and is not merely
|
|
25
|
+
// cosmetic: the once-per-sprint Regression Test phase runs AFTER this one
|
|
26
|
+
// precisely so `finalVerdictResult` is already computed by the time it runs, so
|
|
27
|
+
// a regression failure structurally CANNOT perturb the sprint verdict. See the
|
|
28
|
+
// "6b. Regression Test" banner at its call site in runner.js for the full
|
|
29
|
+
// statement of that guarantee, and ./regression-test.mjs's header for the other
|
|
30
|
+
// half of it. `rejectedNewTasks` and `deployFailures`/`integFailures` are arrays
|
|
31
|
+
// this phase pushes to or reads, so passing the arrays themselves is exactly
|
|
32
|
+
// equivalent to the closure they replace.
|
|
33
|
+
//
|
|
34
|
+
// THE FINDINGS PUSH MUST STAY BRACKETED. The D-push at the end of this phase
|
|
35
|
+
// used to be a BARE doltPushAfter() outside every bracket, so the clean-state
|
|
36
|
+
// pause guard reported "safe to pause" while the Final Review findings were
|
|
37
|
+
// mid-push (apra-fleet-3swo.4.1). It moved here as gitSync.pushBeadsAfter(),
|
|
38
|
+
// the bracketed entry point, and must stay that way -- there is no unbracketed
|
|
39
|
+
// way to reach doltPushAfter() from this module, and unbracketed-push-guard.mjs
|
|
40
|
+
// enforces that now this file is registered in ../guarded-modules.mjs.
|
|
41
|
+
//
|
|
42
|
+
// THE GUARDED VERDICT PATH IS NOT OPTIONAL. This is one of the three verdict
|
|
43
|
+
// sites that apply reopens, and all three go through the SHARED
|
|
44
|
+
// applyGuardedReopens() helper in ../beads-transitions.mjs so a below-goal
|
|
45
|
+
// bead named by a reviewer is never pulled back into a scope this sprint no
|
|
46
|
+
// longer targets. That import moved here INTACT: this module must never grow a
|
|
47
|
+
// private reopen loop or a private allowlist of its own (pinned by
|
|
48
|
+
// test/beads-transitions-extraction.test.mjs, which scans phases/review.mjs,
|
|
49
|
+
// phases/re-review.mjs and this file as separate sources and asserts which one
|
|
50
|
+
// owns which of the three sites -- runner.js itself now owns none).
|
|
51
|
+
//
|
|
52
|
+
// WHY SOME HELPERS ARE INJECTED RATHER THAN IMPORTED. dispatchCtx, gitSync,
|
|
53
|
+
// bdListScoped, decomposedParentIds, goalMax, kbPriming, kbWork,
|
|
54
|
+
// getMemberForRole, childIdAllocator, sprintMutexId and args are
|
|
55
|
+
// runSprintCycle-scoped locals, and NOT_DONE_STATUSES and resolveSettleShell
|
|
56
|
+
// are runner-module-private, so there is nothing to import. computeChildFloor,
|
|
57
|
+
// createChildBeadWithAllocatedId and sanitizePrText are exported BY runner.js;
|
|
58
|
+
// importing them here would make phases/final-review.mjs <-> runner.js a
|
|
59
|
+
// circular pair for the sake of three helpers, so they come through the state
|
|
60
|
+
// argument instead -- the same rule ./review.mjs's and ./re-review.mjs's
|
|
61
|
+
// headers state. The dependencies that live in real sibling modules
|
|
62
|
+
// (dispatchRole/TURN_BASES, buildFinalVerdictPrompt, applyGuardedReopens/
|
|
63
|
+
// parseIdWithReasonEntry, the abort.mjs newTask helpers, buildSettleCallback)
|
|
64
|
+
// are imported directly.
|
|
65
|
+
//
|
|
66
|
+
// GUARD COVERAGE: registered as 'phases/final-review.mjs' in
|
|
67
|
+
// ../guarded-modules.mjs. It took NO member_name-bearing command() call site
|
|
68
|
+
// out of runner.js -- its bead reads go through the injected bdListScoped and
|
|
69
|
+
// its writes through applyGuardedReopens and computeChildFloor/
|
|
70
|
+
// createChildBeadWithAllocatedId, whose command() sites live in the modules
|
|
71
|
+
// that already own them -- but it took ONE dispatchRole() site (the
|
|
72
|
+
// final-review ladder), which is exactly what dispatch-safety-guard and the
|
|
73
|
+
// phase 3 dispatch census read. It also owns a real gitSync bracket at each
|
|
74
|
+
// end. Both the zero command() baseline and the one dispatch site are pinned
|
|
75
|
+
// rather than assumed, so a future edit that reaches for a raw command() here
|
|
76
|
+
// turns red instead of landing on an unguarded site.
|
|
77
|
+
// =============================================================================
|
|
78
|
+
|
|
79
|
+
import { dispatchRole, TURN_BASES } from '../dispatch-role.mjs';
|
|
80
|
+
import { buildFinalVerdictPrompt } from '../prompts.mjs';
|
|
81
|
+
import { applyGuardedReopens, parseIdWithReasonEntry } from '../beads-transitions.mjs';
|
|
82
|
+
import {
|
|
83
|
+
validateNewTask, appendRejectedFindingToParentNotes, persistNewTaskBestEffort,
|
|
84
|
+
} from '../abort.mjs';
|
|
85
|
+
import { buildSettleCallback } from '../dolt-settle.mjs';
|
|
86
|
+
// apra-fleet-rp7a.1: the SAME deferred split Cycle Evaluation applies. Shared
|
|
87
|
+
// rather than re-implemented here, because the two counts disagreeing is
|
|
88
|
+
// exactly the bug: the cycle loop would exit "satisfied" while this phase
|
|
89
|
+
// reported the deferred bead as still open, and the evidence-based final
|
|
90
|
+
// verdict would then FAIL a sprint the loop had just declared complete.
|
|
91
|
+
import { partitionDeferredBeads } from '../beads-scope.mjs';
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Runs the Final Review phase: the sprint's closing evidence-based verdict,
|
|
95
|
+
* plus the orchestrator-applied transitions that verdict asks for.
|
|
96
|
+
*
|
|
97
|
+
* @param {object} state Explicit phase state; see this file's header.
|
|
98
|
+
* @returns {Promise<{
|
|
99
|
+
* finalVerdictResult: object,
|
|
100
|
+
* finalClosedCount: number,
|
|
101
|
+
* finalOpenAtGoalCount: number,
|
|
102
|
+
* finalDeferredAtGoalIds: string[],
|
|
103
|
+
* }>} The sprint verdict, the two closing counts the analysis doc renders, and
|
|
104
|
+
* (apra-fleet-rp7a.1) the ids excluded from `finalOpenAtGoalCount` because
|
|
105
|
+
* they are deferred -- carried out so the analysis doc can name what was
|
|
106
|
+
* skipped rather than leaving it invisible behind a count of zero.
|
|
107
|
+
* Every other output of this phase is an in-place mutation of an array the
|
|
108
|
+
* caller still holds, or a bead/KB write already performed.
|
|
109
|
+
*/
|
|
110
|
+
export async function runFinalReviewPhase({
|
|
111
|
+
// Presentation + dispatch seams.
|
|
112
|
+
phase,
|
|
113
|
+
log,
|
|
114
|
+
command,
|
|
115
|
+
dispatchCtx,
|
|
116
|
+
// Sprint identity/config.
|
|
117
|
+
args,
|
|
118
|
+
validated,
|
|
119
|
+
targetIssues,
|
|
120
|
+
orchestratorMember,
|
|
121
|
+
finalCycleLabel,
|
|
122
|
+
sprintState,
|
|
123
|
+
// The git/beads sync brackets this phase's pre-read D-pull and its
|
|
124
|
+
// post-mutation findings D-push go through.
|
|
125
|
+
gitSync,
|
|
126
|
+
// Evidence this phase reads (deployFailures/integFailures) or pushes to
|
|
127
|
+
// (rejectedNewTasks); never reassigned by this phase (see header).
|
|
128
|
+
deployFailures,
|
|
129
|
+
integFailures,
|
|
130
|
+
rejectedNewTasks,
|
|
131
|
+
verifyEverIds,
|
|
132
|
+
// runSprintCycle-scoped locals and runner-module-private values, injected
|
|
133
|
+
// rather than imported (see header).
|
|
134
|
+
bdListScoped,
|
|
135
|
+
decomposedParentIds,
|
|
136
|
+
goalMax,
|
|
137
|
+
NOT_DONE_STATUSES,
|
|
138
|
+
kbPriming,
|
|
139
|
+
kbWork,
|
|
140
|
+
getMemberForRole,
|
|
141
|
+
childIdAllocator,
|
|
142
|
+
sprintMutexId,
|
|
143
|
+
resolveSettleShell,
|
|
144
|
+
// Exported BY runner.js; injected to avoid a circular import (see header).
|
|
145
|
+
computeChildFloor,
|
|
146
|
+
createChildBeadWithAllocatedId,
|
|
147
|
+
sanitizePrText,
|
|
148
|
+
}) {
|
|
149
|
+
phase(`Final Review C${finalCycleLabel}`);
|
|
150
|
+
|
|
151
|
+
// D-pull the orchestrator's beads clone BEFORE the final-review counts so
|
|
152
|
+
// the sprint's closing evidence (finalOpenAtGoal / finalClosedCount)
|
|
153
|
+
// reflects every member's D-pushed beads state, not the orchestrator's
|
|
154
|
+
// stale local copy.
|
|
155
|
+
// Thread the orchestrator member's REGISTERED shell into dolt-settle,
|
|
156
|
+
// guarded on args.callTool the same way the pre-dispatch bracket is
|
|
157
|
+
// (apra-fleet-7dir.24).
|
|
158
|
+
const finalReviewSettleShell = await resolveSettleShell({ args, member: orchestratorMember, log, sprintState });
|
|
159
|
+
await gitSync.syncBeadsBefore(orchestratorMember, { fatal: true, settle: buildSettleCallback(orchestratorMember, { command, log, shell: finalReviewSettleShell }) });
|
|
160
|
+
const [finalOpenAtGoalRaw, finalOpenAtGoalParentIds, finalClosedBeads] = await Promise.all([
|
|
161
|
+
bdListScoped(`--status=${NOT_DONE_STATUSES} --priority-max=${goalMax} --json`),
|
|
162
|
+
decomposedParentIds(),
|
|
163
|
+
bdListScoped('--status=closed --json'),
|
|
164
|
+
]);
|
|
165
|
+
// apra-fleet-rp7a.1: deferred beads are dropped from the closing count for
|
|
166
|
+
// the same reason Cycle Evaluation drops them -- the dispatcher never
|
|
167
|
+
// offers a deferred bead, so it is not work this sprint left undone. Their
|
|
168
|
+
// ids are kept and surfaced as their own evidence line (below) rather than
|
|
169
|
+
// silently folded away, so the final reviewer judges "finished with N
|
|
170
|
+
// beads deliberately deferred", not "finished with N beads still open".
|
|
171
|
+
const { active: finalOpenAtGoal, deferredIds: finalDeferredAtGoalIds } =
|
|
172
|
+
partitionDeferredBeads(finalOpenAtGoalRaw.filter((b) => !finalOpenAtGoalParentIds.has(b.id)));
|
|
173
|
+
const finalClosedCount = finalClosedBeads.length;
|
|
174
|
+
// apra-fleet-jfo.2: same structural blind spot as the per-cycle exit
|
|
175
|
+
// check -- verify-routed beads are decomposed parents, so they never
|
|
176
|
+
// appear in finalOpenAtGoal (post-filtered via decomposedParentIds()),
|
|
177
|
+
// so a sprint that exhausted MAX_CYCLES with Deploy failing every time
|
|
178
|
+
// could otherwise reach Final Review reporting "0 open bead(s)" while
|
|
179
|
+
// the verify-routed targets were never actually re-verified. Surface it
|
|
180
|
+
// as explicit evidence rather than leaving the Final Review to
|
|
181
|
+
// rubber-stamp PASS on an incomplete count. Guarded on
|
|
182
|
+
// `verifyEverIds.size > 0` -- see the per-cycle check above for why.
|
|
183
|
+
// Uses the same fresh finalClosedBeads read as finalClosedCount above,
|
|
184
|
+
// not fetchAllBeadsShared()'s cache (apra-fleet-66u.2).
|
|
185
|
+
let finalUnclosedVerifyIds = [];
|
|
186
|
+
if (verifyEverIds.size > 0) {
|
|
187
|
+
const finalClosedIds = new Set(finalClosedBeads.map((b) => b.id));
|
|
188
|
+
finalUnclosedVerifyIds = [...verifyEverIds].filter((id) => !finalClosedIds.has(id));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let finalVerdictResult;
|
|
192
|
+
// The Final Review covers an entire epic's worth of work, categorically
|
|
193
|
+
// LARGER than a per-round review, so it gets an explicit budget plus the
|
|
194
|
+
// same same-session resume-and-continue treatment as the doer and per-round
|
|
195
|
+
// reviewer. Without it a large sprint's final review dies at the default
|
|
196
|
+
// turn limit and flips the whole sprint to a FAIL whose notes carry no
|
|
197
|
+
// findings at all.
|
|
198
|
+
// apra-fleet-nx7: offer the final reviewer the same INFERRED candidates a
|
|
199
|
+
// per-round reviewer gets. Fetched once, before the dispatch, so the retry
|
|
200
|
+
// and resume paths reuse the identical block rather than re-querying a
|
|
201
|
+
// KB that its own earlier promotions may have already changed.
|
|
202
|
+
const finalReviewRepoPath = kbPriming.folderOf(getMemberForRole('reviewer'));
|
|
203
|
+
const finalKbCandidates = await kbWork.promotionCandidates(finalReviewRepoPath);
|
|
204
|
+
if (finalKbCandidates.length > 0) {
|
|
205
|
+
log(`[kb-work] offering ${finalKbCandidates.length} INFERRED entr(ies) to the final reviewer for promotion.`);
|
|
206
|
+
}
|
|
207
|
+
// apra-fleet-3swo.5.7: the final-review ladder -- its dispatch, its
|
|
208
|
+
// read-side git-sync bracket, its max_turns-exhaustion resume at doubled
|
|
209
|
+
// turns, its retry-once wrapper, its auth self-heal and its FAIL degrade --
|
|
210
|
+
// is now the 'final-review' row of fleet-sprint/role-policies.mjs.
|
|
211
|
+
//
|
|
212
|
+
// WHY THE HEAL SHORT-CIRCUIT IS POLICY DATA. Final Review is the LAST and
|
|
213
|
+
// most expensive dispatch of the sprint, and its verdict IS the sprint's
|
|
214
|
+
// outcome. An auth/trust failure is deterministic, so the generic
|
|
215
|
+
// retry-once ladder would only reproduce it -- but an LLM-auth failure gets
|
|
216
|
+
// exactly ONE self-heal, and on success the healed verdict is
|
|
217
|
+
// authoritative and MUST end the ladder: falling through to the generic
|
|
218
|
+
// retry as well would fire a SECOND full Final Review, silently discard the
|
|
219
|
+
// healed verdict (a PASS could become a FAIL) and double the cost. That is
|
|
220
|
+
// retry.authSelfHealShortCircuits. A heal that does NOT succeed leaves the
|
|
221
|
+
// channel walled off with no judgement to fabricate, so
|
|
222
|
+
// retry.rethrowsUnhealedNonRetryable propagates it rather than degrading to
|
|
223
|
+
// a FAIL nobody decided.
|
|
224
|
+
//
|
|
225
|
+
// Note Final Review has no role member of its own: it is the REVIEWER role,
|
|
226
|
+
// dispatching the reviewer persona over the whole sprint -- so its policy
|
|
227
|
+
// routes to getMemberForRole('reviewer'), unlike the per-round reviewer
|
|
228
|
+
// which takes the pool head.
|
|
229
|
+
const finalReviewOutcome = await dispatchRole(dispatchCtx, 'final-review', {
|
|
230
|
+
prompt: buildFinalVerdictPrompt({
|
|
231
|
+
targetIssues,
|
|
232
|
+
branch: validated.branch,
|
|
233
|
+
baseBranch: validated.baseBranch,
|
|
234
|
+
goal: validated.goal,
|
|
235
|
+
cyclesRun: finalCycleLabel,
|
|
236
|
+
closedCount: finalClosedCount,
|
|
237
|
+
openAtGoalCount: finalOpenAtGoal.length,
|
|
238
|
+
deployFailures,
|
|
239
|
+
integFailures,
|
|
240
|
+
rejectedNewTasks,
|
|
241
|
+
unclosedVerifyIds: finalUnclosedVerifyIds,
|
|
242
|
+
deferredAtGoalIds: finalDeferredAtGoalIds,
|
|
243
|
+
kbCandidates: finalKbCandidates,
|
|
244
|
+
kbKnowledge: kbPriming.knowledgeOf(getMemberForRole('reviewer')),
|
|
245
|
+
}),
|
|
246
|
+
resumePrompt: 'Continue your final review exactly where you left off in this same session -- do not restart or re-read the diff from scratch. Weigh the remaining evidence and return your final PASS/FAIL verdict now (with newTasks findings if FAIL).',
|
|
247
|
+
roleLabel: 'Final Review',
|
|
248
|
+
label: 'Final Review',
|
|
249
|
+
resumeLabel: `Final Review (resume, max_turns=${TURN_BASES.FINAL_REVIEW_MAX_TURNS * 2})`,
|
|
250
|
+
});
|
|
251
|
+
finalVerdictResult = finalReviewOutcome.value;
|
|
252
|
+
// No duplicate log() dump -- see dispatchReview() for why.
|
|
253
|
+
// `finalVerdictResult.verdict` also surfaces via the generic,
|
|
254
|
+
// workflow-agnostic Result strip in the dashboard header (state.result --
|
|
255
|
+
// see src/viewer/index.mjs), a second independent reason a raw JSON
|
|
256
|
+
// re-print here would be redundant.
|
|
257
|
+
|
|
258
|
+
// apra-fleet-nx7: the final reviewer's KB decisions are executed through
|
|
259
|
+
// the same path every per-round review uses -- now as the 'final-review'
|
|
260
|
+
// row's 'kb-apply' postResult step (apra-fleet-3swo.5.7), which the engine
|
|
261
|
+
// runs immediately after a successful dispatch. Deliberately NOT gated on
|
|
262
|
+
// the VERDICT -- a fact can be verified even when the sprint as a whole
|
|
263
|
+
// fails, and the reviewer contract already says as much ("Not tied to the
|
|
264
|
+
// verdict"). It is gated on there BEING a verdict: a degraded FAIL is
|
|
265
|
+
// fabricated by the engine and carries no KB fields at all, so there is
|
|
266
|
+
// nothing to apply.
|
|
267
|
+
|
|
268
|
+
// Publish what this sprint confirmed. Immediately after the LAST promotion
|
|
269
|
+
// of the run, so the bible carries every CONFIRMED entry including the ones
|
|
270
|
+
// minted a line above. Without this the sprint's knowledge never left the
|
|
271
|
+
// member's local sqlite store -- see createKbWorkClient.exportBible.
|
|
272
|
+
await kbWork.exportBible(finalReviewRepoPath);
|
|
273
|
+
|
|
274
|
+
// Persist the Final Review's actionable findings to BEADS -- the only
|
|
275
|
+
// artifact the next sprint's planner reads (notes reach only the PR body
|
|
276
|
+
// and the analysis doc). NOT gated to FAIL: a PASS can still surface real
|
|
277
|
+
// secondary findings (defects that don't block this epic's own
|
|
278
|
+
// acceptance criteria) that would otherwise be lost prose with no
|
|
279
|
+
// follow-up mechanism. Same orchestrator-applies contract, allowlist
|
|
280
|
+
// validation, and id-allocator path as the per-round reviewer's
|
|
281
|
+
// newTasks; a rejected finding is logged and recorded, never sprint-fatal.
|
|
282
|
+
const finalNewTasks = Array.isArray(finalVerdictResult.newTasks) ? finalVerdictResult.newTasks : [];
|
|
283
|
+
let dPushNeededAfterFinalFindings = false;
|
|
284
|
+
if (finalNewTasks.length > 0) {
|
|
285
|
+
const createdIds = [];
|
|
286
|
+
let createdCountUnknownId = 0;
|
|
287
|
+
for (const newTask of finalNewTasks) {
|
|
288
|
+
const validation = validateNewTask(newTask);
|
|
289
|
+
if (!validation.ok) {
|
|
290
|
+
log(`Final Review newTasks: REJECTED (not sent to bd create) -- ${validation.reason}`);
|
|
291
|
+
rejectedNewTasks.push({ cycle: finalCycleLabel, reason: validation.reason, raw: newTask });
|
|
292
|
+
// Never let a rejected finding vanish -- persist it verbatim to
|
|
293
|
+
// the parent bead's notes as a fallback. This is the
|
|
294
|
+
// highest-stakes site of the three: Final Review's findings
|
|
295
|
+
// are the handoff to the next sprint's planner. Non-fatal;
|
|
296
|
+
// degrades to the run log.
|
|
297
|
+
try {
|
|
298
|
+
await appendRejectedFindingToParentNotes({
|
|
299
|
+
command, member: orchestratorMember, parentId: targetIssues[0],
|
|
300
|
+
newTask, reason: validation.reason, cycle: finalCycleLabel, log,
|
|
301
|
+
});
|
|
302
|
+
} catch (noteErr) {
|
|
303
|
+
log(`[fleet-sprint] rejected-finding notes fallback FAILED (non-fatal): ${noteErr.message}; finding preserved VERBATIM in this run log: ${JSON.stringify(newTask)}`);
|
|
304
|
+
}
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const { title, description, priority } = validation;
|
|
308
|
+
const created = await persistNewTaskBestEffort({
|
|
309
|
+
command, member: orchestratorMember, parentId: targetIssues[0],
|
|
310
|
+
newTask, cycle: finalCycleLabel, log, stage: 'final-review',
|
|
311
|
+
createFn: async () => {
|
|
312
|
+
const floor = await computeChildFloor({ command, member: orchestratorMember, parentId: targetIssues[0], log });
|
|
313
|
+
return createChildBeadWithAllocatedId({
|
|
314
|
+
command, allocator: childIdAllocator, member: orchestratorMember,
|
|
315
|
+
title, description, priority, parentId: targetIssues[0],
|
|
316
|
+
sprintId: sprintMutexId, floor, log,
|
|
317
|
+
label: `Create follow-up task from Final Review findings: ${title}`,
|
|
318
|
+
});
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
if (created) {
|
|
322
|
+
dPushNeededAfterFinalFindings = true;
|
|
323
|
+
if (created.childId) {
|
|
324
|
+
createdIds.push(created.childId);
|
|
325
|
+
log(`Final Review newTasks: created ${created.childId} ("${title}") under ${targetIssues[0]}.`);
|
|
326
|
+
} else {
|
|
327
|
+
createdCountUnknownId += 1;
|
|
328
|
+
log(`Final Review newTasks: created a follow-up task ("${title}") under ${targetIssues[0]} (bd-derived id, not tracked by the allocator).`);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (createdIds.length > 0 || createdCountUnknownId > 0) {
|
|
333
|
+
log(`Final Review: persisted ${createdIds.length + createdCountUnknownId} finding(s) to beads as follow-up task(s) under ${targetIssues[0]}${createdIds.length > 0 ? `: ${createdIds.join(', ')}` : ''}.`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Beads the Final Review flagged for reopening -- each with its OWN
|
|
338
|
+
// reason (unlike the per-round reviewer's reopenIds, which shares one
|
|
339
|
+
// blanket `notes` string across every id this round). Same goal-scope
|
|
340
|
+
// guard as the per-round reviewer: never reopen a below-goal-priority
|
|
341
|
+
// bead into scope this sprint no longer targets. Reason is appended
|
|
342
|
+
// (never overwritten) via --append-notes so it never clobbers the
|
|
343
|
+
// bead's existing notes.
|
|
344
|
+
const finalReopenIds = Array.isArray(finalVerdictResult.reopenIds) ? finalVerdictResult.reopenIds : [];
|
|
345
|
+
if (finalReopenIds.length > 0) {
|
|
346
|
+
// Same guard, same fail-open, same skip log as the other two verdict
|
|
347
|
+
// sites -- only the entry shape ({id, reason}, both required) and the
|
|
348
|
+
// --append-notes command text are this site's own.
|
|
349
|
+
const reopenedIds = await applyGuardedReopens({
|
|
350
|
+
entries: finalReopenIds,
|
|
351
|
+
bdListScoped, goalMax, goal: validated.goal, log, command,
|
|
352
|
+
member: orchestratorMember,
|
|
353
|
+
logPrefix: 'Final Review reopenIds',
|
|
354
|
+
parseEntry: parseIdWithReasonEntry,
|
|
355
|
+
buildReopenCommand: ({ id, reason }) => {
|
|
356
|
+
// bd update has no --append-notes-file / --stdin equivalent for
|
|
357
|
+
// notes (only --body-file/--stdin, and only for description) --
|
|
358
|
+
// --append-notes only accepts an inline string. reason is
|
|
359
|
+
// LLM-authored free text, so it must go through the same
|
|
360
|
+
// flatten-to-single-line, shell-injection-safe sanitizer used
|
|
361
|
+
// for the PR body's notes, never interpolated raw.
|
|
362
|
+
const safeReason = sanitizePrText(reason);
|
|
363
|
+
if (!safeReason) {
|
|
364
|
+
log(`Final Review reopenIds: SKIPPED '${id}' (reason sanitized to empty -- nothing safe to record).`);
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
cmd: `bd update ${id} --status=open --append-notes "[Final Review C${finalCycleLabel}] Reopened -- ${safeReason}"`,
|
|
369
|
+
label: `Reopen ${id} per Final Review verdict`,
|
|
370
|
+
};
|
|
371
|
+
},
|
|
372
|
+
onReopened: ({ id, reason }) => {
|
|
373
|
+
dPushNeededAfterFinalFindings = true;
|
|
374
|
+
log(`Final Review reopenIds: reopened ${id} -- ${sanitizePrText(reason)}`);
|
|
375
|
+
},
|
|
376
|
+
// A single bead's reopen failing must never abort Final Review;
|
|
377
|
+
// the reason is preserved verbatim in the run log instead.
|
|
378
|
+
onEntryError: ({ id, reason }, reopenErr) => {
|
|
379
|
+
log(`[fleet-sprint] Final Review reopen FAILED (non-fatal) for '${id}': ${reopenErr.message} -- reason preserved verbatim in this run log: ${reason}`);
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
if (reopenedIds.length > 0) {
|
|
383
|
+
log(`Final Review: reopened ${reopenedIds.length} bead(s): ${reopenedIds.join(', ')}.`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (dPushNeededAfterFinalFindings) {
|
|
387
|
+
// (apra-fleet-3swo.4.1) This D-push used to be a BARE doltPushAfter()
|
|
388
|
+
// outside every bracket, so the clean-state pause guard reported
|
|
389
|
+
// "safe to pause" while the Final Review findings were mid-push.
|
|
390
|
+
// pushBeadsAfter() is the bracketed entry point -- there is no
|
|
391
|
+
// unbracketed way to reach doltPushAfter() from this file any more.
|
|
392
|
+
await gitSync.pushBeadsAfter(orchestratorMember, { pushBeads: true });
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return {
|
|
396
|
+
finalVerdictResult,
|
|
397
|
+
finalClosedCount,
|
|
398
|
+
finalOpenAtGoalCount: finalOpenAtGoal.length,
|
|
399
|
+
// apra-fleet-rp7a.1: carried out so the sprint analysis document names
|
|
400
|
+
// what was skipped, not just how many beads remained open.
|
|
401
|
+
finalDeferredAtGoalIds,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// PHASE MODULE: Harvest (apra-fleet-3swo.6.9).
|
|
3
|
+
//
|
|
4
|
+
// The ELEVENTH of runSprintCycle's twelve phase() boundaries -- the sprint's
|
|
5
|
+
// knowledge-capture step: it builds the sprint-analysis document's text, the
|
|
6
|
+
// cost-analysis block and the harvester prompt from real, runner-computed
|
|
7
|
+
// values, dispatches the harvester ladder, and reports what came back. Moved
|
|
8
|
+
// verbatim out of runner.js: every prompt string, log line and dispatch option
|
|
9
|
+
// is byte-identical to the inline version, so the golden transcript is
|
|
10
|
+
// unchanged. Move-only, no behaviour change.
|
|
11
|
+
//
|
|
12
|
+
// WHERE THIS PHASE STARTS AND STOPS. It starts at its own phase() call and
|
|
13
|
+
// ends at the last of the three harvest-report log branches. The Regression
|
|
14
|
+
// Test call site immediately above it and the `// 7. Publish` section banner
|
|
15
|
+
// immediately below it both stay in runner.js, as do group('Finalization')/
|
|
16
|
+
// endGroup(), which wrap all four Finalization phases rather than this one.
|
|
17
|
+
//
|
|
18
|
+
// WHY IT SITS WHERE IT SITS. AFTER Regression Test, because that phase's
|
|
19
|
+
// summary is folded into docs/sprint-analysis-<slug>.md through
|
|
20
|
+
// buildAnalysisText() -- harvesting first would publish an analysis document
|
|
21
|
+
// with a hole where the regression section belongs. BEFORE Publish PR, because
|
|
22
|
+
// the harvester is a code-writing role: the docs/changelog/sprint-analysis
|
|
23
|
+
// commits it makes must be pushed before Publish PR pushes the branch and
|
|
24
|
+
// raises the PR a human will read. That ordering is structural here, not a
|
|
25
|
+
// comment: ./publish-pr.mjs's call site sits below this one in runner.js and
|
|
26
|
+
// this phase's dispatch keeps its own pushCode/pushBeads bracket.
|
|
27
|
+
//
|
|
28
|
+
// THE HARVESTER'S GIT/BEADS BRACKET IS POLICY, NOT CODE HERE
|
|
29
|
+
// (apra-fleet-3swo.5.7). The harvester ladder -- its dispatch, its
|
|
30
|
+
// pushCode/pushBeads git-sync bracket, its max_turns-exhaustion resume at
|
|
31
|
+
// doubled turns, its one bounded LLM-auth self-heal and its
|
|
32
|
+
// proceed-without-a-report degrade -- is the 'harvester' row of
|
|
33
|
+
// ../role-policies.mjs, executed by ../dispatch-role.mjs. Do not reintroduce a
|
|
34
|
+
// local bracket or retry here: `pushCode: true` (G-pull before, G-push after)
|
|
35
|
+
// and `pushBeads: true` (the issue-defer mutations D-pushed alongside) are set
|
|
36
|
+
// in that row, and this phase would silently double-push if it added its own.
|
|
37
|
+
// What lives in this file is what is genuinely NOT policy: the prompt inputs,
|
|
38
|
+
// the presentation labels, and what the caller does with the report.
|
|
39
|
+
//
|
|
40
|
+
// WHY ITS HELPERS ARE INJECTED RATHER THAN IMPORTED. computeBranchSlug,
|
|
41
|
+
// buildAnalysisText and buildCostAnalysis are defined in ../runner.js (the
|
|
42
|
+
// middle one is module-private there), so importing them would be a circular
|
|
43
|
+
// import back into the file this module was sliced out of -- they are injected
|
|
44
|
+
// exactly as ./final-review.mjs injects sanitizePrText. dispatchCtx, budget and
|
|
45
|
+
// the evidence arrays are runSprintCycle-scoped locals, so there is nothing to
|
|
46
|
+
// import; dispatchRole/TURN_BASES and buildHarvesterPrompt live in real sibling
|
|
47
|
+
// modules and are imported directly.
|
|
48
|
+
//
|
|
49
|
+
// GUARD COVERAGE: registered as 'phases/harvest.mjs' in ../guarded-modules.mjs.
|
|
50
|
+
// It took NO member_name-bearing command() call site out of runner.js -- the
|
|
51
|
+
// docs/changelog commits are made by the DISPATCHED harvester inside its own
|
|
52
|
+
// repo, and its pushes are the policy row's bracket -- but it took ONE
|
|
53
|
+
// dispatchRole() site (the harvester ladder), which is exactly what
|
|
54
|
+
// dispatch-safety-guard and the phase 3 dispatch census read. Both baselines
|
|
55
|
+
// are pinned rather than assumed.
|
|
56
|
+
// =============================================================================
|
|
57
|
+
|
|
58
|
+
import { dispatchRole, TURN_BASES } from '../dispatch-role.mjs';
|
|
59
|
+
import { buildHarvesterPrompt } from '../prompts.mjs';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Runs the Harvest phase: assemble the sprint-analysis inputs, dispatch the
|
|
63
|
+
* harvester ladder, and log what it reported.
|
|
64
|
+
*
|
|
65
|
+
* Returns nothing. Everything this phase produces is either written to the
|
|
66
|
+
* repo by the dispatched harvester itself (docs/, CHANGELOG, the deferred
|
|
67
|
+
* beads) or already logged here -- no later phase reads a value from it, which
|
|
68
|
+
* is why ./publish-pr.mjs's inputs are unchanged by its presence.
|
|
69
|
+
*
|
|
70
|
+
* @param {object} state Explicit phase state; see this file's header.
|
|
71
|
+
* @returns {Promise<void>}
|
|
72
|
+
*/
|
|
73
|
+
export async function runHarvestPhase({
|
|
74
|
+
// Presentation + dispatch seams.
|
|
75
|
+
phase,
|
|
76
|
+
log,
|
|
77
|
+
dispatchCtx,
|
|
78
|
+
// Sprint identity/config.
|
|
79
|
+
validated,
|
|
80
|
+
targetIssues,
|
|
81
|
+
finalCycleLabel,
|
|
82
|
+
budget,
|
|
83
|
+
// Evidence the analysis document renders; read-only here.
|
|
84
|
+
closedCountHistory,
|
|
85
|
+
highWaterClosedCount,
|
|
86
|
+
deployFailures,
|
|
87
|
+
integFailures,
|
|
88
|
+
rejectedNewTasks,
|
|
89
|
+
integTestRunnerSpend,
|
|
90
|
+
integTestRunnerDispatchCount,
|
|
91
|
+
// The closing results this phase folds into the analysis document.
|
|
92
|
+
finalVerdictResult,
|
|
93
|
+
finalClosedCount,
|
|
94
|
+
finalOpenAtGoalCount,
|
|
95
|
+
finalDeferredAtGoalIds,
|
|
96
|
+
regressionResult,
|
|
97
|
+
// Defined BY runner.js; injected to avoid a circular import (see header).
|
|
98
|
+
computeBranchSlug,
|
|
99
|
+
buildAnalysisText,
|
|
100
|
+
buildCostAnalysis,
|
|
101
|
+
}) {
|
|
102
|
+
phase(`Harvest C${finalCycleLabel}`);
|
|
103
|
+
// Wire the harvester's required inputs with real, runner-computed values --
|
|
104
|
+
// see buildAnalysisText()/buildCostAnalysis() in ../runner.js, which
|
|
105
|
+
// injects both (this file's header explains why). `branchSlug` (see
|
|
106
|
+
// computeBranchSlug(), also in ../runner.js) avoids embedding raw `/`
|
|
107
|
+
// characters from a branch name like `feat/fleet-reorg` in the artifact
|
|
108
|
+
// path, which would otherwise create surprise subdirectories. Deliberately
|
|
109
|
+
// no wall-clock timestamp in this path: it must stay identical across two
|
|
110
|
+
// dispatches of the same branch (idempotent re-runs, and the golden-transcript
|
|
111
|
+
// determinism test), and harvester.md Step 1 already overwrites the file at
|
|
112
|
+
// this path if it exists.
|
|
113
|
+
const branchSlug = computeBranchSlug(validated.branch);
|
|
114
|
+
const analysisArtifactFile = `docs/sprint-analysis-${branchSlug}.md`;
|
|
115
|
+
const analysisText = buildAnalysisText({
|
|
116
|
+
targetIssues,
|
|
117
|
+
branch: validated.branch,
|
|
118
|
+
baseBranch: validated.baseBranch,
|
|
119
|
+
cyclesRun: finalCycleLabel,
|
|
120
|
+
closedCountHistory,
|
|
121
|
+
highWaterClosedCount,
|
|
122
|
+
deployFailures,
|
|
123
|
+
integFailures,
|
|
124
|
+
rejectedNewTasks,
|
|
125
|
+
finalVerdictResult,
|
|
126
|
+
finalClosedCount,
|
|
127
|
+
finalOpenAtGoalCount,
|
|
128
|
+
finalDeferredAtGoalIds,
|
|
129
|
+
regressionResult,
|
|
130
|
+
});
|
|
131
|
+
const costAnalysis = buildCostAnalysis(budget, {
|
|
132
|
+
spend: integTestRunnerSpend,
|
|
133
|
+
dispatchCount: integTestRunnerDispatchCount,
|
|
134
|
+
});
|
|
135
|
+
const harvesterPrompt = buildHarvesterPrompt({
|
|
136
|
+
branch: validated.branch,
|
|
137
|
+
baseBranch: validated.baseBranch,
|
|
138
|
+
targetIssues,
|
|
139
|
+
analysisArtifactFile,
|
|
140
|
+
analysisText,
|
|
141
|
+
costAnalysis,
|
|
142
|
+
});
|
|
143
|
+
// apra-fleet-3swo.5.7: the harvester ladder -- its dispatch, its
|
|
144
|
+
// pushCode/pushBeads git-sync bracket, its max_turns-exhaustion resume at
|
|
145
|
+
// doubled turns, its one bounded LLM-auth self-heal and its
|
|
146
|
+
// proceed-without-a-report degrade -- is now the 'harvester' row of
|
|
147
|
+
// fleet-sprint/role-policies.mjs, executed by dispatchRole. What stays
|
|
148
|
+
// here is what is genuinely NOT policy: the prompts, the presentation
|
|
149
|
+
// labels, and what the caller does with the report.
|
|
150
|
+
//
|
|
151
|
+
// The harvester is a code-writing role (pushCode: true) alongside the doer
|
|
152
|
+
// -- G-pull before, G-push after so the docs/changelog/sprint-analysis
|
|
153
|
+
// commits it makes are published before anything downstream (Publish PR,
|
|
154
|
+
// below) reads the branch. It ALSO mutates beads (issue-defer of
|
|
155
|
+
// low-priority items), so it D-pushes those mutations alongside its git
|
|
156
|
+
// push. Both flags live in the policy row now.
|
|
157
|
+
const harvestOutcome = await dispatchRole(dispatchCtx, 'harvester', {
|
|
158
|
+
prompt: harvesterPrompt,
|
|
159
|
+
resumePrompt: 'Continue your harvest exactly where you left off in this same session -- do not redo docs or changelog sections already written. Finish the remaining updates, commit them, and return your final report now.',
|
|
160
|
+
roleLabel: 'Harvester',
|
|
161
|
+
resumeLabel: `Harvest (resume, max_turns=${TURN_BASES.HARVESTER_MAX_TURNS * 2})`,
|
|
162
|
+
});
|
|
163
|
+
const harvesterResult = harvestOutcome.value;
|
|
164
|
+
// No duplicate log() dump -- see dispatchReview() for why. The file
|
|
165
|
+
// path itself IS worth a line: it is the durable, committed record of
|
|
166
|
+
// the Final Review verdict (and everything else in analysisText) --
|
|
167
|
+
// unlike the verdict object, it survives after this process exits.
|
|
168
|
+
//
|
|
169
|
+
// A degraded harvest proceeds WITHOUT a validated report (the sprint
|
|
170
|
+
// verdict is already decided by this point), so everything below is
|
|
171
|
+
// gated on actually having one. The report's kb_captures were applied by
|
|
172
|
+
// the policy's 'kb-apply' postResult step, which only runs on success.
|
|
173
|
+
if (!harvestOutcome.ok) {
|
|
174
|
+
log(`Harvester: proceeding without a validated harvester report: ${harvestOutcome.error?.message ?? 'no report'}`);
|
|
175
|
+
} else if (harvesterResult.status !== 'OK') {
|
|
176
|
+
log(`Harvester reported FAILED: ${harvesterResult.notes}`);
|
|
177
|
+
} else {
|
|
178
|
+
log(`Harvester: wrote sprint analysis (including the Final Review verdict) to ${analysisArtifactFile}.`);
|
|
179
|
+
}
|
|
180
|
+
}
|