claude-code-session-manager 0.97.0 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bin/cli.cjs +16 -4
- package/bin/node-floor.cjs +41 -0
- package/dist/assets/{DataModel-D93FoaOm.js → DataModel-HdR0AxFq.js} +1 -1
- package/dist/assets/{History-CXxxqNP1.js → History-Dr4Jr_5z.js} +2 -2
- package/dist/assets/{Hooks-CzeYFQjq.js → Hooks-NhrvH3JP.js} +3 -3
- package/dist/assets/{Library-D2zPkwOC.js → Library-Dv_EtIMr.js} +1 -1
- package/dist/assets/{MarkdownEditor-DbinP78A.js → MarkdownEditor-DTKDWV_n.js} +1 -1
- package/dist/assets/{McpServers-Bu_sVGLr.js → McpServers-M034G9B3.js} +2 -2
- package/dist/assets/{Memory-BgiI6LZ_.js → Memory-DzF1B4gx.js} +6 -6
- package/dist/assets/{Permissions-C1MMzZRm.js → Permissions-DrgbSGWl.js} +3 -3
- package/dist/assets/{Plugins-Dhu6wAZi.js → Plugins-Bd3ef35w.js} +2 -2
- package/dist/assets/{ProvenanceBadge-C3AcWKMG.js → ProvenanceBadge-DcBHT1Iy.js} +1 -1
- package/dist/assets/{SaveBar-plwYm0iO.js → SaveBar-rimJem-Y.js} +1 -1
- package/dist/assets/Scheduler-DjgFJl2w.js +16 -0
- package/dist/assets/{ScopeSwitcher-DFy0vv_o.js → ScopeSwitcher-CnAzTBrl.js} +1 -1
- package/dist/assets/Settings-Dc1F_sSg.js +3 -0
- package/dist/assets/{SkillReferenceGraph-DsI7hRPB.js → SkillReferenceGraph-B9aZDecM.js} +1 -1
- package/dist/assets/{Skills-3E748UfB.js → Skills-DRXd18gu.js} +2 -2
- package/dist/assets/{SystemPrompt-BqmfUJOd.js → SystemPrompt-ahy5-Fwe.js} +1 -1
- package/dist/assets/{TagLibrary-CPz6fO8Q.js → TagLibrary-C_tToDeL.js} +1 -1
- package/dist/assets/{TiptapBody-D9EoBQ1P.js → TiptapBody-DvdefS6K.js} +1 -1
- package/dist/assets/{Toggle-BHAmZNDn.js → Toggle-6Jl5Njc6.js} +1 -1
- package/dist/assets/{index-CKH5Uxik.css → index-Bta-hwud.css} +1 -1
- package/dist/assets/{index-tn5JIVPj.js → index-vx8O73l8.js} +497 -502
- package/dist/assets/{settingsSchema-Crqy_aNz.js → settingsSchema-D6iRguNV.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +26 -29
- package/plugins/CLAUDE.md +6 -6
- package/plugins/session-manager-dev/skills/builder/4-manual/SKILL.md +23 -19
- package/plugins/session-manager-dev/skills/builder/SKILL.md +3 -3
- package/plugins/session-manager-dev/skills/develop/SKILL.md +254 -510
- package/plugins/session-manager-dev/skills/develop/standards.md +17 -22
- package/scripts/README.md +3 -11
- package/scripts/audit-ops-hygiene.cjs +3 -3
- package/scripts/hooks/lib/guard-prd-writes-policy.cjs +1 -1
- package/scripts/hooks/lib/guard-self-schedule-policy.cjs +1 -1
- package/scripts/mint-epic.cjs +2 -3
- package/scripts/scheduler-mcp-server.cjs +36 -7
- package/src/main/agentLibrary.cjs +22 -2
- package/src/main/build-info.json +4 -4
- package/src/main/config.cjs +41 -38
- package/src/main/docEdit.cjs +4 -1
- package/src/main/files.cjs +2 -5
- package/src/main/health.cjs +1 -1
- package/src/main/index.cjs +23 -10
- package/src/main/ipcSchemas.cjs +28 -35
- package/src/main/lib/agentPersonaSchema.cjs +13 -2
- package/src/main/lib/atomicFs.cjs +116 -0
- package/src/main/lib/branchSweep.cjs +13 -12
- package/src/main/lib/buildTarget.cjs +3 -3
- package/src/main/lib/claudeCliCaps.cjs +129 -0
- package/src/main/lib/credentials.cjs +2 -4
- package/src/main/lib/crossProjectFeedback.cjs +3 -3
- package/src/main/lib/cwdClassify.cjs +15 -3
- package/src/main/lib/definitionOfDone.cjs +207 -125
- package/src/main/lib/dodDrainHook.cjs +11 -5
- package/src/main/lib/epicMint.cjs +2 -4
- package/src/main/lib/epicStatusMirror.cjs +8 -10
- package/src/main/lib/epicWorktreeProjectConfig.cjs +2 -4
- package/src/main/lib/gateAuthority.cjs +96 -0
- package/src/main/lib/gitExec.cjs +69 -0
- package/src/main/lib/gitWorktree.cjs +656 -92
- package/src/main/lib/instanceLock.cjs +5 -8
- package/src/main/lib/launchFailure.cjs +2 -3
- package/src/main/lib/macroLibrary.cjs +386 -0
- package/src/main/lib/mcpToolCatalog.cjs +26 -17
- package/src/main/lib/needsReviewLedger.cjs +1 -1
- package/src/main/lib/opsErrorLog.cjs +11 -1
- package/src/main/lib/opsOwnership.cjs +0 -5
- package/src/main/lib/pidAlive.cjs +32 -0
- package/src/main/lib/prdCreate.cjs +153 -19
- package/src/main/lib/prdDisposition.cjs +2 -2
- package/src/main/lib/prdGateFiles.cjs +284 -0
- package/src/main/lib/prdLocations.cjs +61 -0
- package/src/main/lib/prdMigration.cjs +2 -3
- package/src/main/lib/prdSizing.cjs +2 -1
- package/src/main/lib/promptSessionSchema.cjs +10 -2
- package/src/main/lib/rcaReport.cjs +4 -6
- package/src/main/lib/reaperHelpers.cjs +8 -1
- package/src/main/lib/reservationExpiry.cjs +6 -1
- package/src/main/lib/reviewNotice.cjs +263 -0
- package/src/main/lib/runClaudeP.cjs +4 -1
- package/src/main/lib/schedulerPaths.cjs +22 -2
- package/src/main/lib/sessionSlots.cjs +2 -4
- package/src/main/lib/shippedPersonaSeeds.cjs +179 -0
- package/src/main/lib/timeoutShim.cjs +123 -0
- package/src/main/lib/timeoutShimScript.cjs +275 -0
- package/src/main/lib/upgradeDrain.cjs +4 -10
- package/src/main/lib/watchdogHelpers.cjs +33 -30
- package/src/main/lib/workTypeLibrary.cjs +7 -1
- package/src/main/promptSessionEvents.cjs +37 -13
- package/src/main/queueOps.cjs +17 -6
- package/src/main/scheduler.cjs +975 -203
- package/src/main/seedAgentPersonas.cjs +278 -23
- package/src/main/supervisor.cjs +4 -1
- package/src/main/templates/PRD_AUTHORING.md +126 -406
- package/src/preload/__tests__/preload-surface.test.cjs +68 -0
- package/src/preload/api.d.ts +41 -94
- package/src/preload/index.cjs +14 -9
- package/src/seed/agents/architect.md +1 -0
- package/src/seed/agents/dev-lead.md +17 -18
- package/src/seed/agents/project-home-builder.md +1 -0
- package/src/seed/agents/validator.md +10 -4
- package/dist/assets/HostBilko-nESrTRIg.js +0 -1
- package/dist/assets/Scheduler-BVYTeh39.js +0 -16
- package/dist/assets/Settings-DIhGgdfs.js +0 -3
- package/src/main/__tests__/activeIndexMerge.test.cjs +0 -235
- package/src/main/__tests__/agentEffortResolve.test.cjs +0 -117
- package/src/main/__tests__/agentLibrary.test.cjs +0 -276
- package/src/main/__tests__/agentModelResolve.test.cjs +0 -311
- package/src/main/__tests__/agentOverlayWrite.test.cjs +0 -95
- package/src/main/__tests__/bilkoHost-deriveSlug.test.cjs +0 -26
- package/src/main/__tests__/bilkoHost-integration.test.cjs +0 -118
- package/src/main/__tests__/bilkoHostCore.test.cjs +0 -72
- package/src/main/__tests__/broadcastCoalescer.test.cjs +0 -122
- package/src/main/__tests__/chat-cancel-terminal.test.cjs +0 -120
- package/src/main/__tests__/chat-dead-channels.test.cjs +0 -63
- package/src/main/__tests__/chat-exit-close-race.test.cjs +0 -146
- package/src/main/__tests__/chat-mcp-consent-notice.test.cjs +0 -139
- package/src/main/__tests__/chat-preamble-anchors.test.cjs +0 -100
- package/src/main/__tests__/chat-queue.test.cjs +0 -97
- package/src/main/__tests__/chat-stop-signal.test.cjs +0 -89
- package/src/main/__tests__/chatRunner-epic-worktree-execcwd.test.cjs +0 -125
- package/src/main/__tests__/chatRunner-session-flag-retry.test.cjs +0 -252
- package/src/main/__tests__/classifyPromptTicket.test.cjs +0 -101
- package/src/main/__tests__/classifyTranscriptLine.test.cjs +0 -201
- package/src/main/__tests__/computeDepHistorySatisfaction.test.cjs +0 -66
- package/src/main/__tests__/config-readText-bounded.test.cjs +0 -84
- package/src/main/__tests__/configWriteBoundaryOwners.test.cjs +0 -59
- package/src/main/__tests__/crossProjectFeedback.test.cjs +0 -334
- package/src/main/__tests__/crossProjectFeedbackRoutes.test.cjs +0 -161
- package/src/main/__tests__/dep-orphan-archive-health.test.cjs +0 -77
- package/src/main/__tests__/develop-skill-failure-modes.test.cjs +0 -70
- package/src/main/__tests__/docEdit.test.cjs +0 -244
- package/src/main/__tests__/dod-batchkey.test.cjs +0 -183
- package/src/main/__tests__/dod-drain-hook.test.cjs +0 -302
- package/src/main/__tests__/dod-report.test.cjs +0 -304
- package/src/main/__tests__/dod-reverify.test.cjs +0 -285
- package/src/main/__tests__/epicContextDigest.test.cjs +0 -174
- package/src/main/__tests__/epicMint.test.cjs +0 -332
- package/src/main/__tests__/epicMintTelemetryTap.test.cjs +0 -64
- package/src/main/__tests__/epicStatusMirror.test.cjs +0 -110
- package/src/main/__tests__/epicValidationHook.test.cjs +0 -291
- package/src/main/__tests__/exchanges.test.cjs +0 -122
- package/src/main/__tests__/exchangesPromptId.test.cjs +0 -61
- package/src/main/__tests__/extractJson.test.cjs +0 -51
- package/src/main/__tests__/files-reject-credentials.test.cjs +0 -40
- package/src/main/__tests__/fixtures/1218-fo-01-move-scripts-lib-into-src-main-lib.log +0 -556
- package/src/main/__tests__/flatPrdTickSweep.test.cjs +0 -110
- package/src/main/__tests__/health-build-freshness.test.cjs +0 -39
- package/src/main/__tests__/health-claude-md-budget.test.cjs +0 -57
- package/src/main/__tests__/health-credentials.test.cjs +0 -81
- package/src/main/__tests__/health-delegation-chain.test.cjs +0 -124
- package/src/main/__tests__/health-per-project-stall.test.cjs +0 -84
- package/src/main/__tests__/health-prd-migration.test.cjs +0 -37
- package/src/main/__tests__/health-queue-dispatch.test.cjs +0 -135
- package/src/main/__tests__/health-starve-escalation.test.cjs +0 -94
- package/src/main/__tests__/health-tick-liveness.test.cjs +0 -179
- package/src/main/__tests__/health-usage-poller.test.cjs +0 -144
- package/src/main/__tests__/health-worktree-cap-blocked.test.cjs +0 -65
- package/src/main/__tests__/heapSnapshot.test.cjs +0 -121
- package/src/main/__tests__/historyAggregatorIntraday.test.cjs +0 -313
- package/src/main/__tests__/historyDashboard.test.cjs +0 -163
- package/src/main/__tests__/historyRollup.test.cjs +0 -333
- package/src/main/__tests__/intradayRefresh.test.cjs +0 -39
- package/src/main/__tests__/ipcSchemas-dependsOn.test.cjs +0 -39
- package/src/main/__tests__/kg-augment.test.cjs +0 -195
- package/src/main/__tests__/loadGateDetailTick.test.cjs +0 -31
- package/src/main/__tests__/machineProfile.test.cjs +0 -152
- package/src/main/__tests__/mcpStatus.test.cjs +0 -61
- package/src/main/__tests__/memoryAggregate.test.cjs +0 -109
- package/src/main/__tests__/memoryStale.test.cjs +0 -88
- package/src/main/__tests__/needsReviewLedger.test.cjs +0 -162
- package/src/main/__tests__/openExternalApp-spawn-error.test.cjs +0 -25
- package/src/main/__tests__/opsErrorLog.test.cjs +0 -109
- package/src/main/__tests__/opsErrorLogTelemetryTap.test.cjs +0 -173
- package/src/main/__tests__/personaMerge.test.cjs +0 -169
- package/src/main/__tests__/planValidator.test.cjs +0 -125
- package/src/main/__tests__/pollLoop-dispatch-on-failure.test.cjs +0 -176
- package/src/main/__tests__/prd-group-allocator.test.cjs +0 -119
- package/src/main/__tests__/prdAdminRouteParity.test.cjs +0 -70
- package/src/main/__tests__/prdAdminRoutes.test.cjs +0 -718
- package/src/main/__tests__/prdAgentType.test.cjs +0 -103
- package/src/main/__tests__/prdAuthoringSeed.test.cjs +0 -39
- package/src/main/__tests__/prdCreate.test.cjs +0 -979
- package/src/main/__tests__/prdCreateDisposition.test.cjs +0 -201
- package/src/main/__tests__/prdCreatePlanId.test.cjs +0 -132
- package/src/main/__tests__/prdFrontmatterAgentType.test.cjs +0 -117
- package/src/main/__tests__/prdFrontmatterDependsOn.test.cjs +0 -136
- package/src/main/__tests__/prdFrontmatterDisposition.test.cjs +0 -125
- package/src/main/__tests__/prdFrontmatterQuietMachine.test.cjs +0 -108
- package/src/main/__tests__/prdLocations.test.cjs +0 -195
- package/src/main/__tests__/prdLocationsArchived.test.cjs +0 -201
- package/src/main/__tests__/prdMigration.test.cjs +0 -349
- package/src/main/__tests__/prdMigrationLegacyAdopt.test.cjs +0 -91
- package/src/main/__tests__/prdParserHighWater.test.cjs +0 -74
- package/src/main/__tests__/prdParserSourcePromptId.test.cjs +0 -65
- package/src/main/__tests__/prdSetDisposition.test.cjs +0 -222
- package/src/main/__tests__/prdSizing.test.cjs +0 -106
- package/src/main/__tests__/prdSourcePromptIdBackfill.test.cjs +0 -118
- package/src/main/__tests__/prdUpdateDependsOn.test.cjs +0 -160
- package/src/main/__tests__/proc-role-env.test.cjs +0 -125
- package/src/main/__tests__/procname-claude-spawn-sites.test.cjs +0 -304
- package/src/main/__tests__/procname-sm-processes.test.cjs +0 -127
- package/src/main/__tests__/projectHomeAdminRoutes.test.cjs +0 -177
- package/src/main/__tests__/projectPages.test.cjs +0 -137
- package/src/main/__tests__/promptSessionEvents.test.cjs +0 -234
- package/src/main/__tests__/promptSessionSchema.test.cjs +0 -101
- package/src/main/__tests__/promptSessionTranscript.test.cjs +0 -0
- package/src/main/__tests__/promptSessionsCreateEpicHandler.test.cjs +0 -159
- package/src/main/__tests__/pty-epic-worktree-spawn-cwd.test.cjs +0 -282
- package/src/main/__tests__/pty-session-open-telemetry.test.cjs +0 -96
- package/src/main/__tests__/pty-write-result.test.cjs +0 -46
- package/src/main/__tests__/queue-health-verdict.test.cjs +0 -170
- package/src/main/__tests__/queue-starvation-dispatch-driver.test.cjs +0 -286
- package/src/main/__tests__/queue-starvation-per-project.test.cjs +0 -147
- package/src/main/__tests__/queueHistory.test.cjs +0 -355
- package/src/main/__tests__/queueOps-interactive-ac-lint.test.cjs +0 -65
- package/src/main/__tests__/queueOpsArchiveDestination.test.cjs +0 -65
- package/src/main/__tests__/queueOpsAutoArchive.test.cjs +0 -154
- package/src/main/__tests__/rateLimitPollerStreak.test.cjs +0 -128
- package/src/main/__tests__/rcaReport.test.cjs +0 -266
- package/src/main/__tests__/reconcileFlatPrdSweep.test.cjs +0 -119
- package/src/main/__tests__/reconcileTiming.test.cjs +0 -135
- package/src/main/__tests__/runLogRetention.test.cjs +0 -489
- package/src/main/__tests__/runVerify-atomic-verdicts.test.cjs +0 -26
- package/src/main/__tests__/runVerify-blocked-by-foreign-wip.test.cjs +0 -58
- package/src/main/__tests__/runVerify-landed-commit-outranks.test.cjs +0 -191
- package/src/main/__tests__/runVerify-policy-denial.test.cjs +0 -89
- package/src/main/__tests__/runVerify-transcript-commit-evidence.test.cjs +0 -225
- package/src/main/__tests__/runVerify.test.cjs +0 -1784
- package/src/main/__tests__/scheduleJobSchema.test.cjs +0 -127
- package/src/main/__tests__/scheduleJobStatusDrift.test.cjs +0 -65
- package/src/main/__tests__/scheduleJobTransitions.test.cjs +0 -277
- package/src/main/__tests__/scheduleJobTransitionsGrep.test.cjs +0 -59
- package/src/main/__tests__/scheduleJobTransitionsTelemetryTap.test.cjs +0 -72
- package/src/main/__tests__/scheduler-admin-routes.test.cjs +0 -199
- package/src/main/__tests__/scheduler-adopted-run-supervision.test.cjs +0 -143
- package/src/main/__tests__/scheduler-already-satisfied-on-main.test.cjs +0 -105
- package/src/main/__tests__/scheduler-archive-completed-prd.test.cjs +0 -102
- package/src/main/__tests__/scheduler-archived-twin-guard.test.cjs +0 -155
- package/src/main/__tests__/scheduler-autofix-outcome.test.cjs +0 -188
- package/src/main/__tests__/scheduler-autofix-select.test.cjs +0 -439
- package/src/main/__tests__/scheduler-autopromote.test.cjs +0 -51
- package/src/main/__tests__/scheduler-bash-timeout-env.test.cjs +0 -101
- package/src/main/__tests__/scheduler-blocked-by-foreign-wip.test.cjs +0 -107
- package/src/main/__tests__/scheduler-boot-orphans.test.cjs +0 -153
- package/src/main/__tests__/scheduler-broadcast-reconcile.test.cjs +0 -121
- package/src/main/__tests__/scheduler-clear-queue-history.test.cjs +0 -134
- package/src/main/__tests__/scheduler-commit-guard-noop.test.cjs +0 -244
- package/src/main/__tests__/scheduler-committed-in-window.test.cjs +0 -182
- package/src/main/__tests__/scheduler-cross-project-batch.test.cjs +0 -43
- package/src/main/__tests__/scheduler-default-eligible-heal.test.cjs +0 -168
- package/src/main/__tests__/scheduler-dispatch-loop.test.cjs +0 -58
- package/src/main/__tests__/scheduler-effective-concurrency.test.cjs +0 -81
- package/src/main/__tests__/scheduler-epic-digest.test.cjs +0 -227
- package/src/main/__tests__/scheduler-failed-autoreset.test.cjs +0 -121
- package/src/main/__tests__/scheduler-finalize-dispatch-guards.test.cjs +0 -229
- package/src/main/__tests__/scheduler-find-prd-dir.test.cjs +0 -75
- package/src/main/__tests__/scheduler-fix-plan-path.test.cjs +0 -119
- package/src/main/__tests__/scheduler-force-tick-outcome.test.cjs +0 -46
- package/src/main/__tests__/scheduler-foreign-wip-manifest.test.cjs +0 -78
- package/src/main/__tests__/scheduler-gate-shadow.test.cjs +0 -119
- package/src/main/__tests__/scheduler-guard-verdict-autoresolve.test.cjs +0 -390
- package/src/main/__tests__/scheduler-heal-refusal.test.cjs +0 -61
- package/src/main/__tests__/scheduler-heartbeat-payload.test.cjs +0 -80
- package/src/main/__tests__/scheduler-inplace-salvage.test.cjs +0 -323
- package/src/main/__tests__/scheduler-integration-failure-stamp.test.cjs +0 -41
- package/src/main/__tests__/scheduler-investigation-clean-skip.test.cjs +0 -63
- package/src/main/__tests__/scheduler-investigation-prompt.test.cjs +0 -123
- package/src/main/__tests__/scheduler-job-budget.test.cjs +0 -172
- package/src/main/__tests__/scheduler-job-overrun.test.cjs +0 -175
- package/src/main/__tests__/scheduler-launch-failure.test.cjs +0 -199
- package/src/main/__tests__/scheduler-leftover-fields.test.cjs +0 -52
- package/src/main/__tests__/scheduler-leftover-quarantine.test.cjs +0 -199
- package/src/main/__tests__/scheduler-looks-done.test.cjs +0 -537
- package/src/main/__tests__/scheduler-manual-pause.test.cjs +0 -118
- package/src/main/__tests__/scheduler-mechanical-recovery.test.cjs +0 -245
- package/src/main/__tests__/scheduler-meta-code-sha.test.cjs +0 -46
- package/src/main/__tests__/scheduler-needs-review-autoresolve.test.cjs +0 -197
- package/src/main/__tests__/scheduler-never-stop.test.cjs +0 -157
- package/src/main/__tests__/scheduler-no-dead-end-status.test.cjs +0 -152
- package/src/main/__tests__/scheduler-no-orphan-run-dir.test.cjs +0 -81
- package/src/main/__tests__/scheduler-notify-originating-tab-transcript.test.cjs +0 -87
- package/src/main/__tests__/scheduler-notify-originating-tab.test.cjs +0 -343
- package/src/main/__tests__/scheduler-periodic-reverify-guard.test.cjs +0 -217
- package/src/main/__tests__/scheduler-porcelain-rename.test.cjs +0 -164
- package/src/main/__tests__/scheduler-prd-missing-skip.test.cjs +0 -161
- package/src/main/__tests__/scheduler-prd-persona-spawn.test.cjs +0 -178
- package/src/main/__tests__/scheduler-quarantine-autoresolve.test.cjs +0 -165
- package/src/main/__tests__/scheduler-quiet-machine-lease.test.cjs +0 -257
- package/src/main/__tests__/scheduler-rate-limit-cooldown-freshness.test.cjs +0 -123
- package/src/main/__tests__/scheduler-rate-limit-pause.test.cjs +0 -152
- package/src/main/__tests__/scheduler-rate-limit-spin-guard.test.cjs +0 -156
- package/src/main/__tests__/scheduler-reap-dead-running-jobs.test.cjs +0 -754
- package/src/main/__tests__/scheduler-reaper-helpers-basics.test.cjs +0 -87
- package/src/main/__tests__/scheduler-reconcile-cwd-preserve.test.cjs +0 -100
- package/src/main/__tests__/scheduler-reconcile-history-backfill.test.cjs +0 -105
- package/src/main/__tests__/scheduler-reconcile-invalid-repair.test.cjs +0 -203
- package/src/main/__tests__/scheduler-reconcile-quarantine.test.cjs +0 -247
- package/src/main/__tests__/scheduler-reset-job-fields-guard.test.cjs +0 -77
- package/src/main/__tests__/scheduler-resume-recovery.test.cjs +0 -254
- package/src/main/__tests__/scheduler-shard-quarantine.test.cjs +0 -115
- package/src/main/__tests__/scheduler-shared-tree-guard.test.cjs +0 -380
- package/src/main/__tests__/scheduler-sigterm-commit.test.cjs +0 -43
- package/src/main/__tests__/scheduler-stall-per-project.test.cjs +0 -126
- package/src/main/__tests__/scheduler-starve-escalation.test.cjs +0 -154
- package/src/main/__tests__/scheduler-stranded-autofix-park.test.cjs +0 -252
- package/src/main/__tests__/scheduler-stranded-investigation.test.cjs +0 -185
- package/src/main/__tests__/scheduler-stuck-failed-escalation.test.cjs +0 -136
- package/src/main/__tests__/scheduler-supervisor-record.test.cjs +0 -81
- package/src/main/__tests__/scheduler-tick-cancel-token.test.cjs +0 -54
- package/src/main/__tests__/scheduler-tick-wedge.test.cjs +0 -172
- package/src/main/__tests__/scheduler-transient-failure.test.cjs +0 -141
- package/src/main/__tests__/scheduler-unreadable-queue-guard.test.cjs +0 -62
- package/src/main/__tests__/scheduler-utilization-hold.test.cjs +0 -89
- package/src/main/__tests__/scheduler-verify-prd-path.test.cjs +0 -109
- package/src/main/__tests__/scheduler-worktree-cap-defer.test.cjs +0 -234
- package/src/main/__tests__/scheduler-worktree-exec-cwd.test.cjs +0 -120
- package/src/main/__tests__/scheduler-writeprd-epic-rollback.test.cjs +0 -105
- package/src/main/__tests__/schedulerBatchRootBlocker.test.cjs +0 -117
- package/src/main/__tests__/schedulerStateSidecarRestore.test.cjs +0 -110
- package/src/main/__tests__/seedAgentPersonas.test.cjs +0 -184
- package/src/main/__tests__/seedSchedulerMcp.test.cjs +0 -211
- package/src/main/__tests__/seedStatus.test.cjs +0 -100
- package/src/main/__tests__/seedValidatorPersona.test.cjs +0 -116
- package/src/main/__tests__/stop-signal-anchor.test.cjs +0 -75
- package/src/main/__tests__/telemetryClient.test.cjs +0 -1055
- package/src/main/__tests__/telemetryContract.test.cjs +0 -930
- package/src/main/__tests__/telemetrySettings.test.cjs +0 -210
- package/src/main/__tests__/transcripts-batch-flush.test.cjs +0 -249
- package/src/main/__tests__/transcripts-doFlush-array.test.cjs +0 -124
- package/src/main/__tests__/transcripts-paged-reads.test.cjs +0 -241
- package/src/main/__tests__/transcripts-worktree-epic-path.test.cjs +0 -154
- package/src/main/__tests__/transcriptsUsageFor.test.cjs +0 -206
- package/src/main/__tests__/uniquePrdNumbers.test.cjs +0 -153
- package/src/main/__tests__/usageSingleFlight.test.cjs +0 -169
- package/src/main/__tests__/validationSentinels.test.cjs +0 -84
- package/src/main/__tests__/workTypeLibrary.test.cjs +0 -89
- package/src/main/bilkoHost.cjs +0 -314
- package/src/main/bilkoHostCore.cjs +0 -89
- package/src/main/lib/__tests__/active-sessions.test.cjs +0 -251
- package/src/main/lib/__tests__/activeIndexRebuild.test.cjs +0 -179
- package/src/main/lib/__tests__/agentPersonaSchema.test.cjs +0 -67
- package/src/main/lib/__tests__/auditLog.test.cjs +0 -38
- package/src/main/lib/__tests__/bootSelfHeal.test.cjs +0 -107
- package/src/main/lib/__tests__/branchSweep.test.cjs +0 -164
- package/src/main/lib/__tests__/buildIdentity.test.cjs +0 -121
- package/src/main/lib/__tests__/buildTarget.test.cjs +0 -52
- package/src/main/lib/__tests__/childWithLog.test.cjs +0 -321
- package/src/main/lib/__tests__/coldBootPromptSessionsWrite.test.cjs +0 -87
- package/src/main/lib/__tests__/crashTelemetry.test.cjs +0 -103
- package/src/main/lib/__tests__/credentials-futile-refresh.test.cjs +0 -115
- package/src/main/lib/__tests__/cwdClassify.test.cjs +0 -111
- package/src/main/lib/__tests__/definitionOfDoneSequence.test.cjs +0 -95
- package/src/main/lib/__tests__/delegationReadiness.test.cjs +0 -1175
- package/src/main/lib/__tests__/dispatchLoop.test.cjs +0 -63
- package/src/main/lib/__tests__/effectiveModelInfo.test.cjs +0 -244
- package/src/main/lib/__tests__/ephemeralCwd.test.cjs +0 -91
- package/src/main/lib/__tests__/epicDelegationStats.test.cjs +0 -137
- package/src/main/lib/__tests__/epicSpawnCwd.test.cjs +0 -283
- package/src/main/lib/__tests__/epicSpawnPlan.test.cjs +0 -196
- package/src/main/lib/__tests__/epicTranscriptPath.test.cjs +0 -163
- package/src/main/lib/__tests__/epicWorktreeBoot.test.cjs +0 -136
- package/src/main/lib/__tests__/epicWorktreeMerge.test.cjs +0 -130
- package/src/main/lib/__tests__/epicWorktreeMint.test.cjs +0 -117
- package/src/main/lib/__tests__/epicWorktreeProjectConfig.test.cjs +0 -137
- package/src/main/lib/__tests__/fixChainDepth.test.cjs +0 -40
- package/src/main/lib/__tests__/fixtures/204-mercury-steam-horse.log.txt +0 -13
- package/src/main/lib/__tests__/fixtures/scheduler-machine.json.corrupt-1789147548 +0 -34
- package/src/main/lib/__tests__/gateFixtures.json +0 -20
- package/src/main/lib/__tests__/gitCacheBound.test.cjs +0 -69
- package/src/main/lib/__tests__/gitWorktree.test.cjs +0 -1478
- package/src/main/lib/__tests__/gitWorktreeSalvage.test.cjs +0 -107
- package/src/main/lib/__tests__/gitWorktreeSalvageDelta.test.cjs +0 -153
- package/src/main/lib/__tests__/guardShims.test.cjs +0 -158
- package/src/main/lib/__tests__/importReferences.spec.cjs +0 -56
- package/src/main/lib/__tests__/instanceLock.test.cjs +0 -173
- package/src/main/lib/__tests__/jobSupervisorRecord.test.cjs +0 -78
- package/src/main/lib/__tests__/jobWorktree.test.cjs +0 -199
- package/src/main/lib/__tests__/jobWorktreeBootLive.test.cjs +0 -82
- package/src/main/lib/__tests__/landedSinceRun.test.cjs +0 -133
- package/src/main/lib/__tests__/launchFailure.test.cjs +0 -220
- package/src/main/lib/__tests__/loadGate.test.cjs +0 -303
- package/src/main/lib/__tests__/localAdminHttp.test.cjs +0 -214
- package/src/main/lib/__tests__/loopDelay.test.cjs +0 -68
- package/src/main/lib/__tests__/mcpToolCatalog.test.cjs +0 -107
- package/src/main/lib/__tests__/modelCatalog.test.cjs +0 -202
- package/src/main/lib/__tests__/opsOwnership.test.cjs +0 -113
- package/src/main/lib/__tests__/opsRootAbsoluteCwd.test.cjs +0 -328
- package/src/main/lib/__tests__/opsRootNestedWrite.test.cjs +0 -51
- package/src/main/lib/__tests__/opsRootResolve.test.cjs +0 -149
- package/src/main/lib/__tests__/prdDeclaredPaths.test.cjs +0 -82
- package/src/main/lib/__tests__/prdDisposition.test.cjs +0 -224
- package/src/main/lib/__tests__/procIdentity.test.cjs +0 -119
- package/src/main/lib/__tests__/procName.test.cjs +0 -92
- package/src/main/lib/__tests__/projectBriefCore.test.cjs +0 -216
- package/src/main/lib/__tests__/projectRootResolve.test.cjs +0 -148
- package/src/main/lib/__tests__/queueHealth.test.cjs +0 -58
- package/src/main/lib/__tests__/queueStoreAtomicWrite.test.cjs +0 -88
- package/src/main/lib/__tests__/queueStoreMachineStateRecovery.test.cjs +0 -190
- package/src/main/lib/__tests__/quietMachineLease.test.cjs +0 -39
- package/src/main/lib/__tests__/rateLimitWindow.test.cjs +0 -88
- package/src/main/lib/__tests__/reaperHelpers.test.cjs +0 -577
- package/src/main/lib/__tests__/schedulerBatchDepends.test.cjs +0 -312
- package/src/main/lib/__tests__/schedulerBatchFairness.test.cjs +0 -213
- package/src/main/lib/__tests__/schedulerBatchLaunchHold.test.cjs +0 -125
- package/src/main/lib/__tests__/schedulerBatchProjectCap.test.cjs +0 -127
- package/src/main/lib/__tests__/schedulerBatchQuietMachine.test.cjs +0 -109
- package/src/main/lib/__tests__/schedulerMcpServerHeadlessRefusal.test.cjs +0 -71
- package/src/main/lib/__tests__/schedulerMcpServerHelp.test.cjs +0 -216
- package/src/main/lib/__tests__/schedulerMcpServerProjectHome.test.cjs +0 -183
- package/src/main/lib/__tests__/schedulerPaths.test.cjs +0 -226
- package/src/main/lib/__tests__/schedulerPathsWorktree.test.cjs +0 -133
- package/src/main/lib/__tests__/schedulerRuntimeState.test.cjs +0 -56
- package/src/main/lib/__tests__/sessionSlots.test.cjs +0 -144
- package/src/main/lib/__tests__/telemetryBacklog.test.cjs +0 -626
- package/src/main/lib/__tests__/telemetryBoot.test.cjs +0 -134
- package/src/main/lib/__tests__/telemetryConsent.test.cjs +0 -136
- package/src/main/lib/__tests__/telemetryCounters.test.cjs +0 -57
- package/src/main/lib/__tests__/telemetryCountersMetadataColumn.test.cjs +0 -98
- package/src/main/lib/__tests__/terminalRunOutcome.test.cjs +0 -200
- package/src/main/lib/__tests__/toolUseClassify.test.cjs +0 -53
- package/src/main/lib/__tests__/updateCheck.test.cjs +0 -63
- package/src/main/lib/__tests__/upgradeDrain.test.cjs +0 -130
- package/src/main/lib/__tests__/usageCircuit.test.cjs +0 -354
- package/src/main/lib/__tests__/watchdog-helpers.test.cjs +0 -375
- package/src/main/lib/__tests__/watchdog-relaunch.test.cjs +0 -266
- package/src/main/lib/kgExchangePairing.cjs +0 -75
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scheduler-guard-verdict-autoresolve.test.cjs — needs_review ladder gap
|
|
3
|
-
* (2026-09-12, PRD 1181 shape).
|
|
4
|
-
*
|
|
5
|
-
* Auto-fix investigations only ever launch for FAILING runs — a job that
|
|
6
|
-
* exits 0 and gets parked by a post-run GUARD verdict (commit-guard
|
|
7
|
-
* 'silent_no_op', shared-tree-guard 'shared_tree_reverted') never has
|
|
8
|
-
* job.autoFixAttempted set, so isExhaustedAutoFix(job) is false forever and
|
|
9
|
-
* the row is invisible to the existing needs_review auto-resolve ladder —
|
|
10
|
-
* it sits in needs_review permanently, blocking every dependsOn row behind
|
|
11
|
-
* it, until a human clears it by hand. PRD 1181 proved it: exit 0, commit
|
|
12
|
-
* aff5607 landed, parked on a guard verdict, needed a human.
|
|
13
|
-
*
|
|
14
|
-
* This file covers the widened entry gate (isGuardParkedWithoutAutoFix /
|
|
15
|
-
* isEligibleForNeedsReviewAutoResolve) that admits these rows to the SAME
|
|
16
|
-
* ladder (selectExhaustedNeedsReviewTargets / applyNeedsReviewAutoResolve)
|
|
17
|
-
* the exhausted-auto-fix path already uses, keyed on landedCommit +
|
|
18
|
-
* looksDone evidence instead of a spent auto-fix attempt — and the closed
|
|
19
|
-
* set of verdicts eligible for this (GUARD_VERDICT_EVIDENCE_ELIGIBLE)
|
|
20
|
-
* excludes 'worktree_integration_failed', whose damage IS a commit (one
|
|
21
|
-
* stranded on an unmerged branch), so a landedCommit there is not evidence
|
|
22
|
-
* against the verdict.
|
|
23
|
-
*
|
|
24
|
-
* scheduler-needs-review-autoresolve.test.cjs's own suite covers the
|
|
25
|
-
* pre-existing exhausted-auto-fix ladder and must keep passing UNCHANGED —
|
|
26
|
-
* this file only adds new coverage for the second door into the same ladder.
|
|
27
|
-
*
|
|
28
|
-
* HOME is overridden to a tmp dir BEFORE requiring scheduler.cjs — same
|
|
29
|
-
* reason as scheduler-needs-review-autoresolve.test.cjs (appendAuditEvent
|
|
30
|
-
* writes under $HOME/.claude/session-manager/audit-log.jsonl).
|
|
31
|
-
*
|
|
32
|
-
* Run: timeout 120 npx vitest run src/main/__tests__/scheduler-guard-verdict-autoresolve.test.cjs
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
'use strict';
|
|
36
|
-
|
|
37
|
-
const assert = require('node:assert/strict');
|
|
38
|
-
const fs = require('node:fs');
|
|
39
|
-
const os = require('node:os');
|
|
40
|
-
const path = require('node:path');
|
|
41
|
-
|
|
42
|
-
const tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), 'guard-verdict-autoresolve-test-'));
|
|
43
|
-
process.env.HOME = tmpHome;
|
|
44
|
-
|
|
45
|
-
const { execFileSync } = require('node:child_process');
|
|
46
|
-
|
|
47
|
-
const {
|
|
48
|
-
selectExhaustedNeedsReviewTargets,
|
|
49
|
-
applyNeedsReviewAutoResolve,
|
|
50
|
-
NEEDS_REVIEW_RESOLVE_CAP,
|
|
51
|
-
GUARD_VERDICT_EVIDENCE_ELIGIBLE,
|
|
52
|
-
isGuardParkedWithoutAutoFix,
|
|
53
|
-
isEligibleForNeedsReviewAutoResolve,
|
|
54
|
-
isExhaustedAutoFix,
|
|
55
|
-
reverifyNeedsReview,
|
|
56
|
-
} = require('../scheduler.cjs');
|
|
57
|
-
|
|
58
|
-
const { pickForProject } = require('../lib/schedulerBatch.cjs');
|
|
59
|
-
const { resolvePrdWriteDir } = require('../lib/prdLocations.cjs');
|
|
60
|
-
const { bustCwdCache } = require('../lib/queueStore.cjs');
|
|
61
|
-
|
|
62
|
-
const MIN_MS = 60_000;
|
|
63
|
-
const THRESHOLD_MS = 30 * MIN_MS;
|
|
64
|
-
|
|
65
|
-
function guardParkedJob(overrides = {}) {
|
|
66
|
-
return {
|
|
67
|
-
slug: '1181-guard-parked-row',
|
|
68
|
-
cwd: '/home/user/project',
|
|
69
|
-
status: 'needs_review',
|
|
70
|
-
exitCode: 0,
|
|
71
|
-
verifierVerdict: 'silent_no_op',
|
|
72
|
-
landedCommit: 'aff5607abc123',
|
|
73
|
-
statusHistory: [{ to: 'needs_review', at: new Date(Date.now() - 45 * MIN_MS).toISOString() }],
|
|
74
|
-
...overrides,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// --- enumeration: which guard verdicts are eligible ---
|
|
79
|
-
|
|
80
|
-
test('GUARD_VERDICT_EVIDENCE_ELIGIBLE contains exactly the benign guard verdicts, never worktree_integration_failed', () => {
|
|
81
|
-
assert.ok(GUARD_VERDICT_EVIDENCE_ELIGIBLE.has('silent_no_op'));
|
|
82
|
-
assert.ok(GUARD_VERDICT_EVIDENCE_ELIGIBLE.has('shared_tree_reverted'));
|
|
83
|
-
assert.equal(GUARD_VERDICT_EVIDENCE_ELIGIBLE.has('worktree_integration_failed'), false);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// reaperHelpers.resolvePidlessFailureOverride parks a pidless reap on this
|
|
87
|
-
// exact verdict when the row already carries a landedCommit — same shape as
|
|
88
|
-
// silent_no_op/shared_tree_reverted (exit never observed, no autoFixAttempted,
|
|
89
|
-
// real commit evidence), so it must share this ladder too, or a pidless-reap
|
|
90
|
-
// row stalls in needs_review with nothing to spend and nothing to exhaust —
|
|
91
|
-
// the same bug this file's other tests exist to prevent for the other two
|
|
92
|
-
// verdicts.
|
|
93
|
-
test('GUARD_VERDICT_EVIDENCE_ELIGIBLE also contains pidless_reap_with_landed_commit', () => {
|
|
94
|
-
assert.ok(GUARD_VERDICT_EVIDENCE_ELIGIBLE.has('pidless_reap_with_landed_commit'));
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// --- isGuardParkedWithoutAutoFix / isEligibleForNeedsReviewAutoResolve ---
|
|
98
|
-
|
|
99
|
-
test('a guard-verdict park with no auto-fix history is guard-parked-without-autofix', () => {
|
|
100
|
-
const job = guardParkedJob();
|
|
101
|
-
assert.equal(isGuardParkedWithoutAutoFix(job), true);
|
|
102
|
-
assert.equal(isExhaustedAutoFix(job), false, 'never went through auto-fix — must not double-count as exhausted');
|
|
103
|
-
assert.equal(isEligibleForNeedsReviewAutoResolve(job), true);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test('a row that DID get an auto-fix investigation is left to the exhausted-auto-fix door, not this one', () => {
|
|
107
|
-
const job = guardParkedJob({ autoFixAttempted: true, autoFixOutcome: 'no-plan', autoFixRetries: 1 });
|
|
108
|
-
assert.equal(isGuardParkedWithoutAutoFix(job), false);
|
|
109
|
-
assert.equal(isExhaustedAutoFix(job), true);
|
|
110
|
-
assert.equal(isEligibleForNeedsReviewAutoResolve(job), true, 'still eligible overall, via the OTHER door');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
test('(c) worktree_integration_failed is never guard-parked-without-autofix, whatever evidence it carries', () => {
|
|
114
|
-
const job = guardParkedJob({ verifierVerdict: 'worktree_integration_failed' });
|
|
115
|
-
assert.equal(isGuardParkedWithoutAutoFix(job), false);
|
|
116
|
-
assert.equal(isEligibleForNeedsReviewAutoResolve(job), false);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test('a needs_review row with an unrecognized verifierVerdict and no auto-fix history is not eligible', () => {
|
|
120
|
-
const job = guardParkedJob({ verifierVerdict: 'transcript_errors' });
|
|
121
|
-
assert.equal(isGuardParkedWithoutAutoFix(job), false);
|
|
122
|
-
assert.equal(isEligibleForNeedsReviewAutoResolve(job), false);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// --- selectExhaustedNeedsReviewTargets: the widened selector ---
|
|
126
|
-
|
|
127
|
-
test('a fresh guard-parked row (under threshold) is not selected', () => {
|
|
128
|
-
const job = guardParkedJob({
|
|
129
|
-
statusHistory: [{ to: 'needs_review', at: new Date(Date.now() - 2 * MIN_MS).toISOString() }],
|
|
130
|
-
});
|
|
131
|
-
assert.equal(selectExhaustedNeedsReviewTargets([job], Date.now(), THRESHOLD_MS).length, 0);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
test('a guard-parked row past threshold, under the cap, is selected', () => {
|
|
135
|
-
const job = guardParkedJob();
|
|
136
|
-
const found = selectExhaustedNeedsReviewTargets([job], Date.now(), THRESHOLD_MS);
|
|
137
|
-
assert.equal(found.length, 1);
|
|
138
|
-
assert.equal(found[0].slug, '1181-guard-parked-row');
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
test('(c) worktree_integration_failed is never selected, even past threshold with a landedCommit', () => {
|
|
142
|
-
const job = guardParkedJob({ verifierVerdict: 'worktree_integration_failed' });
|
|
143
|
-
assert.equal(selectExhaustedNeedsReviewTargets([job], Date.now(), THRESHOLD_MS).length, 0);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
// --- applyNeedsReviewAutoResolve: the three-branch policy, entered via the guard door ---
|
|
147
|
-
|
|
148
|
-
test('(a) the 1181 shape — exit 0 + guard verdict + landedCommit + looksDone — auto-completes', () => {
|
|
149
|
-
const job = guardParkedJob({
|
|
150
|
-
looksDone: { commits: ['aff5607'], paths: ['src/main/scheduler.cjs'], detectedAt: new Date().toISOString() },
|
|
151
|
-
});
|
|
152
|
-
const outcome = applyNeedsReviewAutoResolve(job);
|
|
153
|
-
assert.equal(outcome, 'completed');
|
|
154
|
-
assert.equal(job.status, 'completed');
|
|
155
|
-
assert.match(job.statusHistory.at(-1).reason, /silent_no_op/, 'the reason must name the evidence, not just "auto-resolved"');
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test('(b) the same shape WITHOUT looksDone does not auto-complete on the first pass — bounded requeue instead', () => {
|
|
159
|
-
const job = guardParkedJob({ exhaustedResolveAttempts: 0 });
|
|
160
|
-
assert.equal(job.looksDone, undefined);
|
|
161
|
-
const outcome = applyNeedsReviewAutoResolve(job);
|
|
162
|
-
assert.equal(outcome, 'requeued');
|
|
163
|
-
assert.equal(job.status, 'pending');
|
|
164
|
-
assert.equal(job.exhaustedResolveAttempts, 1);
|
|
165
|
-
assert.match(job.statusHistory.at(-1).reason, /silent_no_op/);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
test('a guard-parked row with no evidence, cap spent, auto-skips with the guard verdict named in job.error', () => {
|
|
169
|
-
const job = guardParkedJob({ exhaustedResolveAttempts: NEEDS_REVIEW_RESOLVE_CAP });
|
|
170
|
-
const outcome = applyNeedsReviewAutoResolve(job);
|
|
171
|
-
assert.equal(outcome, 'skipped');
|
|
172
|
-
assert.equal(job.status, 'skipped');
|
|
173
|
-
assert.equal(job.needsReviewAutoResolvedSkip, true);
|
|
174
|
-
assert.match(job.error, /silent_no_op/, 'a human reading the queue must see WHY, not a generic auto-resolved label');
|
|
175
|
-
assert.doesNotMatch(job.error, /exhausted auto-fix path/, 'this row never went through auto-fix — must not claim it did');
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
test('(c) worktree_integration_failed never auto-completes on landed-commit + looksDone evidence', () => {
|
|
179
|
-
const job = guardParkedJob({
|
|
180
|
-
verifierVerdict: 'worktree_integration_failed',
|
|
181
|
-
looksDone: { commits: ['aff5607'], paths: ['src/main/scheduler.cjs'], detectedAt: new Date().toISOString() },
|
|
182
|
-
});
|
|
183
|
-
const outcome = applyNeedsReviewAutoResolve(job);
|
|
184
|
-
assert.equal(outcome, null, 'this verdict has no door into this ladder at all');
|
|
185
|
-
assert.equal(job.status, 'needs_review', 'must stay parked — its own mechanical-recovery path owns this verdict, not this ladder');
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
test('the pre-existing exhausted-auto-fix ladder is unaffected: same branch, same cap, same audit shape', () => {
|
|
189
|
-
const job = {
|
|
190
|
-
slug: 'exhausted-row',
|
|
191
|
-
cwd: '/home/user/project',
|
|
192
|
-
status: 'needs_review',
|
|
193
|
-
autoFixAttempted: true,
|
|
194
|
-
autoFixOutcome: 'no-plan',
|
|
195
|
-
autoFixRetries: 1,
|
|
196
|
-
exhaustedResolveAttempts: 1,
|
|
197
|
-
looksDone: { commits: ['abc1234'], paths: ['src/main/scheduler.cjs'], detectedAt: new Date().toISOString() },
|
|
198
|
-
};
|
|
199
|
-
const outcome = applyNeedsReviewAutoResolve(job);
|
|
200
|
-
assert.equal(outcome, 'completed');
|
|
201
|
-
assert.match(job.statusHistory.at(-1).reason, /verifier annotation shows work landed/);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// --- (d) chain drain: a downstream dependsOn row becomes eligible once the guard-parked blocker resolves ---
|
|
205
|
-
|
|
206
|
-
test('(d) a dependsOn chain drains once a guard-parked blocker (no auto-fix, no evidence, cap spent) auto-skips', () => {
|
|
207
|
-
const now = Date.now();
|
|
208
|
-
const rowA = { slug: 'a-first', cwd: '/home/user/project', status: 'completed' };
|
|
209
|
-
const rowB = guardParkedJob({
|
|
210
|
-
slug: 'b-middle',
|
|
211
|
-
exhaustedResolveAttempts: NEEDS_REVIEW_RESOLVE_CAP,
|
|
212
|
-
dependsOn: ['a-first'],
|
|
213
|
-
});
|
|
214
|
-
const rowC = { slug: 'c-last', cwd: '/home/user/project', status: 'pending', dependsOn: ['b-middle'] };
|
|
215
|
-
const jobs = [rowA, rowB, rowC];
|
|
216
|
-
|
|
217
|
-
const before = pickForProject(jobs, new Set(), 5);
|
|
218
|
-
assert.equal(before.batch.length, 0, 'C must not be eligible while B still sits in needs_review');
|
|
219
|
-
|
|
220
|
-
const targets = selectExhaustedNeedsReviewTargets(jobs, now, THRESHOLD_MS);
|
|
221
|
-
assert.equal(targets.length, 1);
|
|
222
|
-
assert.equal(targets[0].slug, 'b-middle');
|
|
223
|
-
const outcome = applyNeedsReviewAutoResolve(rowB);
|
|
224
|
-
assert.equal(outcome, 'skipped');
|
|
225
|
-
|
|
226
|
-
const after = pickForProject(jobs, new Set(), 5);
|
|
227
|
-
assert.ok(after.batch.some((j) => j.slug === 'c-last'), 'C must become eligible once B is auto-skipped');
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// --- end-to-end: reverifyNeedsReview computes looksDone for a guard-parked row ---
|
|
231
|
-
|
|
232
|
-
function git(args, cwd) {
|
|
233
|
-
return execFileSync('git', args, { cwd, encoding: 'utf8' });
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function initRepo(dir) {
|
|
237
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
238
|
-
git(['init', '-q'], dir);
|
|
239
|
-
git(['config', 'user.email', 'test@example.com'], dir);
|
|
240
|
-
git(['config', 'user.name', 'Test'], dir);
|
|
241
|
-
fs.writeFileSync(path.join(dir, 'README.md'), 'hello\n', 'utf8');
|
|
242
|
-
git(['add', '-A'], dir);
|
|
243
|
-
git(['commit', '-q', '-m', 'initial'], dir);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function commitFile(dir, relPath, content, message) {
|
|
247
|
-
const abs = path.join(dir, relPath);
|
|
248
|
-
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
249
|
-
fs.writeFileSync(abs, content);
|
|
250
|
-
git(['add', relPath], dir);
|
|
251
|
-
git(['commit', '-q', '-m', message], dir);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function registerActiveProject(cwd, slug) {
|
|
255
|
-
const slugDir = path.join(tmpHome, '.claude', 'projects', slug);
|
|
256
|
-
fs.mkdirSync(slugDir, { recursive: true });
|
|
257
|
-
fs.writeFileSync(path.join(slugDir, 'transcript.jsonl'), JSON.stringify({ cwd }) + '\n');
|
|
258
|
-
bustCwdCache();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function writeProjectQueue(cwd, jobs) {
|
|
262
|
-
const stateDir = path.join(cwd, 'session-manager-operations', 'scheduler', 'state');
|
|
263
|
-
fs.mkdirSync(stateDir, { recursive: true });
|
|
264
|
-
fs.writeFileSync(path.join(stateDir, 'queue.json'), JSON.stringify({ jobs }, null, 2));
|
|
265
|
-
return path.join(stateDir, 'queue.json');
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
function writePrd(cwd, slug, body) {
|
|
269
|
-
const dir = resolvePrdWriteDir(cwd);
|
|
270
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
271
|
-
const text = `---\ntitle: Test PRD\ncwd: ${cwd}\nestimateMinutes: 30\n---\n${body}\n`;
|
|
272
|
-
fs.writeFileSync(path.join(dir, `${slug}.md`), text);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
async function wait(ms) {
|
|
276
|
-
await new Promise((r) => setTimeout(r, ms));
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
test('reverifyNeedsReview computes looksDone for a guard-parked (silent_no_op) row with no auto-fix history', async () => {
|
|
280
|
-
const projectCwd = path.join(tmpHome, 'proj-guard-parked');
|
|
281
|
-
initRepo(projectCwd);
|
|
282
|
-
registerActiveProject(projectCwd, 'proj-guard-parked-slug');
|
|
283
|
-
writePrd(projectCwd, '1181-guard-parked', [
|
|
284
|
-
'# Implementation notes',
|
|
285
|
-
'Edit `src/thing.js`.',
|
|
286
|
-
].join('\n'));
|
|
287
|
-
|
|
288
|
-
const startedAt = new Date().toISOString();
|
|
289
|
-
const queuePath = writeProjectQueue(projectCwd, [
|
|
290
|
-
{
|
|
291
|
-
slug: '1181-guard-parked',
|
|
292
|
-
status: 'needs_review',
|
|
293
|
-
cwd: projectCwd,
|
|
294
|
-
runId: 'run-1181',
|
|
295
|
-
startedAt,
|
|
296
|
-
finishedAt: new Date().toISOString(),
|
|
297
|
-
exitCode: 0,
|
|
298
|
-
verifierVerdict: 'silent_no_op',
|
|
299
|
-
landedCommit: 'deadbeef',
|
|
300
|
-
error: 'commit-guard: made no commit on an already-clean tree',
|
|
301
|
-
},
|
|
302
|
-
]);
|
|
303
|
-
|
|
304
|
-
await wait(1100); // git --since has 1s resolution
|
|
305
|
-
// Must be attributable to THIS job (see attributeLandedCommits) — path
|
|
306
|
-
// overlap alone is no longer evidence. The row's own `landedCommit`
|
|
307
|
-
// ('deadbeef') is a stale/unresolvable placeholder, so this falls to the
|
|
308
|
-
// 'slug trailer' rule by naming the job's own slug in the commit message.
|
|
309
|
-
commitFile(projectCwd, 'src/thing.js', 'hello', 'the actual fix for 1181-guard-parked landed');
|
|
310
|
-
|
|
311
|
-
await reverifyNeedsReview();
|
|
312
|
-
|
|
313
|
-
const jobs = JSON.parse(fs.readFileSync(queuePath, 'utf8')).jobs;
|
|
314
|
-
assert.equal(jobs.length, 1);
|
|
315
|
-
assert.equal(jobs[0].status, 'needs_review', 'looksDone alone never auto-completes — only applyNeedsReviewAutoResolve does');
|
|
316
|
-
assert.ok(jobs[0].looksDone, 'expected a looksDone annotation computed for this guard-parked row');
|
|
317
|
-
assert.equal(jobs[0].looksDone.commits.length, 1);
|
|
318
|
-
assert.equal(jobs[0].looksDone.rule, 'slug trailer');
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
test('reverifyNeedsReview never computes looksDone for a worktree_integration_failed row', async () => {
|
|
322
|
-
const projectCwd = path.join(tmpHome, 'proj-stranded-branch');
|
|
323
|
-
initRepo(projectCwd);
|
|
324
|
-
registerActiveProject(projectCwd, 'proj-stranded-branch-slug');
|
|
325
|
-
writePrd(projectCwd, '1181-stranded', [
|
|
326
|
-
'# Implementation notes',
|
|
327
|
-
'Edit `src/thing.js`.',
|
|
328
|
-
].join('\n'));
|
|
329
|
-
|
|
330
|
-
const startedAt = new Date().toISOString();
|
|
331
|
-
const queuePath = writeProjectQueue(projectCwd, [
|
|
332
|
-
{
|
|
333
|
-
slug: '1181-stranded',
|
|
334
|
-
status: 'needs_review',
|
|
335
|
-
cwd: projectCwd,
|
|
336
|
-
runId: 'run-stranded',
|
|
337
|
-
startedAt,
|
|
338
|
-
finishedAt: new Date().toISOString(),
|
|
339
|
-
exitCode: 0,
|
|
340
|
-
verifierVerdict: 'worktree_integration_failed',
|
|
341
|
-
landedCommit: 'deadbeef',
|
|
342
|
-
error: 'worktree branch integration failed',
|
|
343
|
-
},
|
|
344
|
-
]);
|
|
345
|
-
|
|
346
|
-
await wait(1100);
|
|
347
|
-
commitFile(projectCwd, 'src/thing.js', 'hello', 'unrelated later commit');
|
|
348
|
-
|
|
349
|
-
await reverifyNeedsReview();
|
|
350
|
-
|
|
351
|
-
const jobs = JSON.parse(fs.readFileSync(queuePath, 'utf8')).jobs;
|
|
352
|
-
assert.equal(jobs.length, 1);
|
|
353
|
-
assert.equal(jobs[0].looksDone, undefined, 'a stranded-branch verdict must never be treated as evidence-gatherable');
|
|
354
|
-
assert.equal(jobs[0].status, 'needs_review');
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
test('reverifyNeedsReview heals a stale shared_tree_reverted row (autoFixAttempted, no outcome) whose landedCommit is still an ancestor of HEAD', async () => {
|
|
358
|
-
const projectCwd = path.join(tmpHome, 'proj-stale-shared-tree');
|
|
359
|
-
initRepo(projectCwd);
|
|
360
|
-
registerActiveProject(projectCwd, 'proj-stale-shared-tree-slug');
|
|
361
|
-
writePrd(projectCwd, '1229-stale-shared-tree', '# Implementation notes\nEdit `src/thing.js`.');
|
|
362
|
-
|
|
363
|
-
const startedAt = new Date(Date.now() - 5000).toISOString();
|
|
364
|
-
await wait(1100);
|
|
365
|
-
commitFile(projectCwd, 'src/thing.js', 'job work', 'the job own commit');
|
|
366
|
-
const landed = git(['rev-parse', 'HEAD'], projectCwd).trim();
|
|
367
|
-
commitFile(projectCwd, 'docs/unrelated.md', 'human', 'human commit after the job');
|
|
368
|
-
|
|
369
|
-
const queuePath = writeProjectQueue(projectCwd, [
|
|
370
|
-
{
|
|
371
|
-
slug: '1229-stale-shared-tree',
|
|
372
|
-
status: 'needs_review',
|
|
373
|
-
cwd: projectCwd,
|
|
374
|
-
runId: 'run-1229',
|
|
375
|
-
startedAt,
|
|
376
|
-
finishedAt: new Date().toISOString(),
|
|
377
|
-
exitCode: 0,
|
|
378
|
-
verifierVerdict: 'shared_tree_reverted',
|
|
379
|
-
landedCommit: landed,
|
|
380
|
-
autoFixAttempted: true,
|
|
381
|
-
},
|
|
382
|
-
]);
|
|
383
|
-
|
|
384
|
-
await reverifyNeedsReview();
|
|
385
|
-
|
|
386
|
-
const jobs = JSON.parse(fs.readFileSync(queuePath, 'utf8')).jobs;
|
|
387
|
-
// Healed rows are archived out of the live queue on the same pass.
|
|
388
|
-
const row = jobs.find((j) => j.slug === '1229-stale-shared-tree');
|
|
389
|
-
assert.ok(!row || row.status === 'completed', 'row must no longer be parked in needs_review');
|
|
390
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scheduler-heal-refusal.test.cjs — PRD 983.
|
|
3
|
-
*
|
|
4
|
-
* Guards the needs_review → completed self-heal in reverifyNeedsReview.
|
|
5
|
-
*
|
|
6
|
-
* Incident being regression-tested: job 972 (2026-08-03) ran 34 s, edited zero
|
|
7
|
-
* files, exited 0. verifyRun correctly raised `no_verdict_sentinel` /
|
|
8
|
-
* downgradeTo 'needs_review'. One minute later the self-heal pass promoted it
|
|
9
|
-
* to `completed` and the false green shipped. Cause: the rescan recomputes
|
|
10
|
-
* `committedDuringRun` from `committedInWindow`, a repo-wide
|
|
11
|
-
* `git log --all --since --until` with no author/message/slug filter — a
|
|
12
|
-
* CONCURRENT job's commit inside the window was credited to this job, which
|
|
13
|
-
* suppressed the no_verdict_sentinel check on re-verify and let the verdict
|
|
14
|
-
* conclude `clean`.
|
|
15
|
-
*
|
|
16
|
-
* Run: timeout 300 npx vitest run src/main/__tests__/scheduler-heal-refusal.test.cjs
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
import { test, expect } from 'vitest';
|
|
22
|
-
const { healRefusalReason } = require('../scheduler.cjs');
|
|
23
|
-
|
|
24
|
-
const CLEAN = { verdict: 'clean', reason: 'no issues detected' };
|
|
25
|
-
|
|
26
|
-
test('REGRESSION (PRD 983): a no_verdict_sentinel job with no landedCommit is NOT healed, even on a clean re-verify', () => {
|
|
27
|
-
const job = { slug: '972-notify', verifierVerdict: 'no_verdict_sentinel', landedCommit: null };
|
|
28
|
-
const refusal = healRefusalReason(job, CLEAN, true);
|
|
29
|
-
expect(refusal).toBeTruthy();
|
|
30
|
-
expect(refusal).toContain('no job-attributable commit');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('a no_verdict_sentinel job WITH its own landedCommit is allowed to heal', () => {
|
|
34
|
-
const job = { slug: '900-real', verifierVerdict: 'no_verdict_sentinel', landedCommit: 'abc1234' };
|
|
35
|
-
expect(healRefusalReason(job, CLEAN, true)).toBeNull();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test('other verdict classes are untouched — transcript_errors still heals on a clean re-verify', () => {
|
|
39
|
-
const job = { slug: '901-transcript', verifierVerdict: 'transcript_errors', landedCommit: null };
|
|
40
|
-
expect(healRefusalReason(job, CLEAN, true)).toBeNull();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('verify_unavailable (the other pre-sentinel-heal class) is untouched', () => {
|
|
44
|
-
const job = { slug: '902-unavailable', verifierVerdict: 'verify_unavailable', landedCommit: null };
|
|
45
|
-
expect(healRefusalReason(job, CLEAN, true)).toBeNull();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('a non-completed-equivalent re-verify verdict is left to the existing path, not refused here', () => {
|
|
49
|
-
const job = { slug: '903-still-bad', verifierVerdict: 'no_verdict_sentinel', landedCommit: null };
|
|
50
|
-
expect(healRefusalReason(job, { verdict: 'transcript_errors', reason: 'x' }, false)).toBeNull();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('an honest no-op exemption verdict still heals when the job recorded its own commit', () => {
|
|
54
|
-
const job = { slug: '904-shipped', verifierVerdict: 'no_verdict_sentinel', landedCommit: 'deadbee' };
|
|
55
|
-
expect(healRefusalReason(job, { verdict: 'pass_no_commit_already_shipped', reason: 'x' }, false)).toBeNull();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('null/missing inputs never throw and never refuse', () => {
|
|
59
|
-
expect(healRefusalReason(null, CLEAN, true)).toBeNull();
|
|
60
|
-
expect(healRefusalReason({ slug: 'x' }, null, true)).toBeNull();
|
|
61
|
-
});
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scheduler-heartbeat-payload.test.cjs — the heartbeat line carries build
|
|
3
|
-
* identity, a subsystem throw yields a `degraded: true` line, and both
|
|
4
|
-
* watchdogHelpers.heartbeatFresh and health.readFreshHeartbeat treat a
|
|
5
|
-
* degraded line as NOT fresh.
|
|
6
|
-
*
|
|
7
|
-
* Run: timeout 120 npx vitest run src/main/__tests__/scheduler-heartbeat-payload.test.cjs
|
|
8
|
-
*/
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
import { test, expect, beforeEach, vi } from 'vitest';
|
|
12
|
-
const fs = require('node:fs');
|
|
13
|
-
const schedulerPaths = require('../lib/schedulerPaths.cjs');
|
|
14
|
-
const scheduler = require('../scheduler.cjs');
|
|
15
|
-
const { heartbeatFresh } = require('../lib/watchdogHelpers.cjs');
|
|
16
|
-
const { readFreshHeartbeat } = require('../health.cjs');
|
|
17
|
-
|
|
18
|
-
const HB = () => schedulerPaths.heartbeatPath();
|
|
19
|
-
const lastLine = () => JSON.parse(fs.readFileSync(HB(), 'utf8').trim().split('\n').pop());
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
fs.mkdirSync(require('node:path').dirname(HB()), { recursive: true });
|
|
23
|
-
fs.rmSync(HB(), { force: true });
|
|
24
|
-
vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('healthy tick writes build {version, codeSha, builtAt} and is fresh', () => {
|
|
28
|
-
const entry = scheduler.heartbeatTick({ readQueueSync: () => ({ jobs: [], unreadable: true, paused: null }) });
|
|
29
|
-
expect(entry.degraded).toBeUndefined();
|
|
30
|
-
const line = lastLine();
|
|
31
|
-
expect(line.build).toEqual(expect.objectContaining({ version: expect.anything() }));
|
|
32
|
-
expect(Object.keys(line.build).sort()).toEqual(['builtAt', 'codeSha', 'version']);
|
|
33
|
-
expect(line.counts).toBeDefined();
|
|
34
|
-
expect(heartbeatFresh(HB())).toBe(true);
|
|
35
|
-
expect(readFreshHeartbeat(HB())).not.toBeNull();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test('a throwing queue read writes a degraded line with the error, never a fresh one', () => {
|
|
39
|
-
scheduler.heartbeatTick({ readQueueSync: () => { throw new Error('boom-queue'); } });
|
|
40
|
-
const line = lastLine();
|
|
41
|
-
expect(line.degraded).toBe(true);
|
|
42
|
-
expect(line.errors[0]).toEqual({ subsystem: 'queue-read-starvation-watchdog', error: 'boom-queue' });
|
|
43
|
-
expect(line.build).toBeDefined();
|
|
44
|
-
expect(line.utilization).toBeUndefined();
|
|
45
|
-
expect(heartbeatFresh(HB())).toBe(false);
|
|
46
|
-
expect(readFreshHeartbeat(HB())).toBeNull();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('a throw in the stall detector degrades the line too', () => {
|
|
50
|
-
scheduler.heartbeatTick({ readQueueSync: () => ({ jobs: null, unreadable: true, paused: null }) });
|
|
51
|
-
const line = lastLine();
|
|
52
|
-
expect(line.degraded).toBe(true);
|
|
53
|
-
expect(line.errors.some((e) => e.subsystem === 'stall-detector' || e.subsystem === 'heartbeat-write')).toBe(true);
|
|
54
|
-
expect(heartbeatFresh(HB())).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('watchdogHelpers treats a hand-written degraded line as stale', () => {
|
|
58
|
-
fs.writeFileSync(HB(), JSON.stringify({ ts: Date.now(), degraded: true }) + '\n');
|
|
59
|
-
expect(heartbeatFresh(HB())).toBe(false);
|
|
60
|
-
fs.writeFileSync(HB(), JSON.stringify({ ts: Date.now() }) + '\n');
|
|
61
|
-
expect(heartbeatFresh(HB())).toBe(true);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('healthy tick carries dispatch {..., pendingDispatchable excludes blocked chains}', () => {
|
|
65
|
-
const jobs = [
|
|
66
|
-
{ slug: '1-a', cwd: '/p', status: 'failed' },
|
|
67
|
-
{ slug: '2-b', cwd: '/p', status: 'pending', dependsOn: ['1-a'] },
|
|
68
|
-
{ slug: '3-c', cwd: '/p', status: 'pending' },
|
|
69
|
-
];
|
|
70
|
-
const entry = scheduler.heartbeatTick({
|
|
71
|
-
readQueueSync: () => ({ jobs, unreadable: true, paused: null, lastRunAt: '2026-01-01T00:00:00.000Z' }),
|
|
72
|
-
});
|
|
73
|
-
expect(entry.dispatch).toEqual(expect.objectContaining({
|
|
74
|
-
lastRunAt: '2026-01-01T00:00:00.000Z', pendingDispatchable: 1, runningCount: 0, paused: false,
|
|
75
|
-
}));
|
|
76
|
-
expect(Object.keys(entry.dispatch).sort()).toEqual(
|
|
77
|
-
['drain', 'lastDispatchAttemptAt', 'lastRunAt', 'lastTickReason', 'paused', 'pendingDispatchable', 'runningCount'],
|
|
78
|
-
);
|
|
79
|
-
expect(entry.dispatch.drain).toBeNull();
|
|
80
|
-
});
|