@open-mercato/cezar 0.15.0 → 0.15.1
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/dist/automations/github-poller.d.ts +8 -1
- package/dist/automations/github-poller.js +78 -13
- package/dist/automations/github-poller.js.map +1 -1
- package/dist/automations/pr-head.js +15 -1
- package/dist/automations/pr-head.js.map +1 -1
- package/dist/automations/prompts.js +2 -2
- package/dist/automations/types.d.ts +10 -0
- package/dist/automations/types.js +12 -1
- package/dist/automations/types.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/contract/automations.d.ts +31 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +161 -17
- package/dist/contract/projects.d.ts +46 -0
- package/dist/contract/runs.d.ts +15 -0
- package/dist/contract/skills.d.ts +1 -0
- package/dist/contract/telemetry.d.ts +124 -0
- package/dist/contract/workspace.d.ts +3 -0
- package/dist/core/cursor-agent-runner.d.ts +11 -0
- package/dist/core/cursor-agent-runner.js +48 -4
- package/dist/core/cursor-agent-runner.js.map +1 -1
- package/dist/core/disclaim-spawn.d.ts +10 -0
- package/dist/core/disclaim-spawn.js +105 -8
- package/dist/core/disclaim-spawn.js.map +1 -1
- package/dist/git-diff-base.js +26 -19
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-remotes.d.ts +43 -0
- package/dist/git-remotes.js +127 -0
- package/dist/git-remotes.js.map +1 -0
- package/dist/git-worktree.d.ts +43 -19
- package/dist/git-worktree.js +138 -54
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +46 -6
- package/dist/index.js.map +1 -1
- package/dist/runs/auto-name.d.ts +17 -0
- package/dist/runs/auto-name.js +47 -2
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/event-history.d.ts +10 -2
- package/dist/runs/event-history.js +290 -120
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/retention.js +1 -1
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/store.d.ts +16 -3
- package/dist/runs/store.js +89 -10
- package/dist/runs/store.js.map +1 -1
- package/dist/server/checkout.d.ts +4 -0
- package/dist/server/checkout.js +9 -5
- package/dist/server/checkout.js.map +1 -1
- package/dist/server/create-project.d.ts +77 -0
- package/dist/server/create-project.js +342 -0
- package/dist/server/create-project.js.map +1 -0
- package/dist/server/forge/github.d.ts +2 -0
- package/dist/server/forge/github.js +32 -10
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/index.d.ts +1 -12
- package/dist/server/forge/index.js +7 -29
- package/dist/server/forge/index.js.map +1 -1
- package/dist/server/forge/types.d.ts +2 -0
- package/dist/server/git-changes.d.ts +15 -0
- package/dist/server/git-changes.js +51 -1
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/git.d.ts +3 -2
- package/dist/server/git.js +4 -3
- package/dist/server/git.js.map +1 -1
- package/dist/server/project-context.js +1 -1
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/server.d.ts +609 -302
- package/dist/server/server.js +191 -12
- package/dist/server/server.js.map +1 -1
- package/dist/server/star-count.d.ts +27 -11
- package/dist/server/star-count.js +57 -28
- package/dist/server/star-count.js.map +1 -1
- package/dist/telemetry-cli.d.ts +10 -0
- package/dist/telemetry-cli.js +54 -0
- package/dist/telemetry-cli.js.map +1 -0
- package/dist/telemetry-service.json +1 -0
- package/dist/telemetry.d.ts +79 -0
- package/dist/telemetry.js +453 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/workflows/run.d.ts +28 -0
- package/dist/workflows/run.js +111 -16
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/config.d.ts +10 -0
- package/dist/workspace/config.js +16 -0
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +3 -0
- package/dist/workspace/projects-cli.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +32 -17
- package/scripts/stamp-telemetry-service.mjs +20 -0
- package/web/dist/assets/agent-task-pickers-mJzYn0UB.js +1 -0
- package/web/dist/assets/{alert-dialog-CF_-dmQ1.js → alert-dialog-Dd1WPOaz.js} +1 -1
- package/web/dist/assets/arrow-left-fsST4JqT.js +1 -0
- package/web/dist/assets/{automation-format-D1nqk0ID.js → automation-format-BTIFWfjt.js} +1 -1
- package/web/dist/assets/automations-route-DJjhwqug.js +1 -0
- package/web/dist/assets/button-BNnH7COh.js +100 -0
- package/web/dist/assets/{centered-state-T0J7VmBb.js → centered-state-sEYB3bgq.js} +1 -1
- package/web/dist/assets/check-DA37PQLT.js +1 -0
- package/web/dist/assets/chevron-left-zbXV2Qbu.js +1 -0
- package/web/dist/assets/chevron-right-Beu1pd6H.js +1 -0
- package/web/dist/assets/{collapsible-RD4hkew7.js → collapsible-MuXfYnM8.js} +1 -1
- package/web/dist/assets/commit-list-Bps23fvP.js +1 -0
- package/web/dist/assets/compare-variants-CQskdfDW.js +1 -0
- package/web/dist/assets/composer-DKWLJeo9.js +18 -0
- package/web/dist/assets/dashboard-BCNe_6p7.js +44 -0
- package/web/dist/assets/diff-CrLUECGW.js +3 -0
- package/web/dist/assets/{diff-stat-CFoeFye2.js → diff-stat-SpfygteL.js} +1 -1
- package/web/dist/assets/diff-view-DP4Gw3QJ.js +13 -0
- package/web/dist/assets/{download-BFQEsJRY.js → download-CBwSbmy_.js} +1 -1
- package/web/dist/assets/dropdown-menu-CxPGHgWX.js +1 -0
- package/web/dist/assets/ellipsis-BmusVE8U.js +1 -0
- package/web/dist/assets/{file-Df5WtpM_.js → file-DkvcUwxT.js} +1 -1
- package/web/dist/assets/file-preview-DxFusXAO.js +2 -0
- package/web/dist/assets/file-text-DBeC0yKb.js +1 -0
- package/web/dist/assets/file-tree-BTJZXRkM.js +1 -0
- package/web/dist/assets/{git-commit-horizontal-DawNm4qg.js → git-commit-horizontal-BM9_nEW7.js} +1 -1
- package/web/dist/assets/git-toolbar-DXyPCDkQ.js +1 -0
- package/web/dist/assets/github-G5fU4gJd.js +1 -0
- package/web/dist/assets/index-BN3w52uE.js +21 -0
- package/web/dist/assets/index-CAvSSpvF.css +2 -0
- package/web/dist/assets/{markdown-Bmfy_1Ll.js → markdown-BpZ4p95p.js} +1 -1
- package/web/dist/assets/{markdown-B_O1ys3h.js → markdown-C5F95Rt-.js} +1 -1
- package/web/dist/assets/{message-square-BOO9s3qX.js → message-square-BFQln9c4.js} +1 -1
- package/web/dist/assets/{pill-bO5OcHuK.js → pill-BcIQGDbn.js} +1 -1
- package/web/dist/assets/project-router-CWMOKp_H.js +3 -0
- package/web/dist/assets/reference-chip-B7lU_Pyh.js +1 -0
- package/web/dist/assets/reference-overflow-ClRRXWez.js +1 -0
- package/web/dist/assets/{refresh-cw-BaFyjVUz.js → refresh-cw-BBEYC6z2.js} +1 -1
- package/web/dist/assets/repo-git-CgxxZ7cO.js +1 -0
- package/web/dist/assets/{run-diff-GZbNs8fA.js → run-diff-BTB7nBeD.js} +1 -1
- package/web/dist/assets/run-header-BPNBEaOy.js +1 -0
- package/web/dist/assets/{image-preview-4SVDrBvn.js → scroll-within-DRt7mAnQ.js} +1 -1
- package/web/dist/assets/{search-x-bpAfQtVY.js → search-x-6BavY3mg.js} +1 -1
- package/web/dist/assets/sheet-D9PeyyRZ.js +1 -0
- package/web/dist/assets/skills-SIMzpL0l.js +1 -0
- package/web/dist/assets/square-DsFAQaY9.js +1 -0
- package/web/dist/assets/tab-link-DEUSZU49.js +1 -0
- package/web/dist/assets/{tag-DLwUkUsN.js → tag-DvCVnA6I.js} +1 -1
- package/web/dist/assets/task-changes-D-aajoMU.js +1 -0
- package/web/dist/assets/task-commits-BYD1GVkS.js +1 -0
- package/web/dist/assets/task-composer-7bdNNMP_.js +12 -0
- package/web/dist/assets/task-files-BfIOz-eN.js +1 -0
- package/web/dist/assets/task-graph-B5-5_IPh.js +1 -0
- package/web/dist/assets/task-notes-CfkTBgo8.js +1 -0
- package/web/dist/assets/task-thread-eEkjTDxr.js +10 -0
- package/web/dist/assets/{terminal-CwrL1hAi.js → terminal-xRHwWarr.js} +1 -1
- package/web/dist/assets/textarea-rKUFh5lI.js +1 -0
- package/web/dist/assets/thread-loading-DLlbK51g.js +1 -0
- package/web/dist/assets/{token-metrics-C149OWmd.js → token-metrics-BcPjL36-.js} +1 -1
- package/web/dist/assets/tooltip-BVqBAGNb.js +1 -0
- package/web/dist/assets/tracker-2DfMzsIE.js +4 -0
- package/web/dist/assets/triangle-alert-CP3Xp0FU.js +1 -0
- package/web/dist/assets/upload-bwO_2kok.js +1 -0
- package/web/dist/assets/use-automations-PceYR6ss.js +5 -0
- package/web/dist/assets/use-now-BAKdIYLG.js +1 -0
- package/web/dist/assets/use-submit-shortcut-BA4NVpJl.js +1 -0
- package/web/dist/assets/workflow-graph-HopaWPea.js +13 -0
- package/web/dist/assets/x-HaVPcg_B.js +1 -0
- package/web/dist/index.html +28 -31
- package/web/dist/assets/agent-task-pickers-C3ydGatB.js +0 -1
- package/web/dist/assets/arrow-left-BxBdc5DC.js +0 -1
- package/web/dist/assets/automations-route-BsflncpV.js +0 -1
- package/web/dist/assets/button-CjSjKnkd.js +0 -100
- package/web/dist/assets/check-DAAMuI4o.js +0 -1
- package/web/dist/assets/chevron-left-CvcqxpQZ.js +0 -1
- package/web/dist/assets/chevron-right-DKiL3NWw.js +0 -1
- package/web/dist/assets/commit-list-BJac2uO6.js +0 -1
- package/web/dist/assets/compare-variants-CfqICvRy.js +0 -1
- package/web/dist/assets/composer-DZx3cwQW.js +0 -18
- package/web/dist/assets/dashboard-CpCDiZdE.js +0 -44
- package/web/dist/assets/diff-LG2cl0PE.js +0 -3
- package/web/dist/assets/diff-controls-QgdH-r3F.js +0 -1
- package/web/dist/assets/diff-view-BVwSaBb2.js +0 -13
- package/web/dist/assets/dropdown-menu-DkEK7m00.js +0 -1
- package/web/dist/assets/editable-title-CJSWyCcL.js +0 -1
- package/web/dist/assets/ellipsis-vertical-CB0adfr7.js +0 -1
- package/web/dist/assets/external-link-DPKRidDg.js +0 -1
- package/web/dist/assets/eye-CEHQ0c-s.js +0 -1
- package/web/dist/assets/file-preview-kYsqZiLU.js +0 -2
- package/web/dist/assets/file-text-m0tZu8sU.js +0 -1
- package/web/dist/assets/git-merge-B7oVXcKc.js +0 -1
- package/web/dist/assets/git-toolbar-B0K4Q5Zv.js +0 -1
- package/web/dist/assets/github-C4WaHPni.js +0 -1
- package/web/dist/assets/index-CiQrbvAq.js +0 -21
- package/web/dist/assets/index-WWaEax-B.css +0 -2
- package/web/dist/assets/pencil-CCR9uUZ1.js +0 -1
- package/web/dist/assets/reference-chip-Bx_mG9QG.js +0 -1
- package/web/dist/assets/repo-git-Mn3_jrGP.js +0 -1
- package/web/dist/assets/run-header-i1D5Lvfs.js +0 -1
- package/web/dist/assets/sheet-DCdZVHFk.js +0 -1
- package/web/dist/assets/skills-Dea5ynJK.js +0 -1
- package/web/dist/assets/tab-link-BVItTl_Y.js +0 -1
- package/web/dist/assets/task-changes-xNbBM7FO.js +0 -1
- package/web/dist/assets/task-commits-BYozE_X3.js +0 -1
- package/web/dist/assets/task-composer-Brx0sa7_.js +0 -12
- package/web/dist/assets/task-files-MAPO-efK.js +0 -1
- package/web/dist/assets/task-graph-BSLCUr1E.js +0 -1
- package/web/dist/assets/task-thread-CRVmwchQ.js +0 -9
- package/web/dist/assets/textarea-Bb0_Hz53.js +0 -1
- package/web/dist/assets/thread-loading-Bo6IOu3Y.js +0 -1
- package/web/dist/assets/toaster-Hj_czp_o.js +0 -3
- package/web/dist/assets/tooltip--PYfu68E.js +0 -1
- package/web/dist/assets/tracker-DM5WtYD0.js +0 -4
- package/web/dist/assets/trash-2-EdjdGvEo.js +0 -1
- package/web/dist/assets/triangle-alert-DpH3QFz6.js +0 -1
- package/web/dist/assets/use-automations-XKvBTPM-.js +0 -5
- package/web/dist/assets/use-now-CrM50BFB.js +0 -1
- package/web/dist/assets/use-submit-shortcut-BJ10ZshV.js +0 -1
- package/web/dist/assets/workflow-graph-Y2Pr7ubb.js +0 -13
- package/web/dist/assets/x-BkwTUDpG.js +0 -1
package/dist/workflows/run.js
CHANGED
|
@@ -27,7 +27,7 @@ import { materializeSkillDir } from '../skills-remote.js';
|
|
|
27
27
|
import { seedAgentConfigLocalLayer } from '../agent-config/seed.js';
|
|
28
28
|
import { readAgentModelProvider } from '../agent-config/models.js';
|
|
29
29
|
import { loadConfig, resolveWorktreeRetention } from '../config.js';
|
|
30
|
-
import { autosaveCommit, chooseForkBase, commitAll, createWorktree, pushBranch, syncWithBase, worktreeChangedFiles, worktreeChangedPaths, worktreeDiff, worktreeShortstat, } from '../git-worktree.js';
|
|
30
|
+
import { autosaveCommit, chooseForkBase, commitAll, createWorktree, pushBranch, syncWithBase, uniqueBranchName, worktreeChangedFiles, worktreeChangedPaths, worktreeDiff, worktreeShortstat, } from '../git-worktree.js';
|
|
31
31
|
import { commentOnIssue, commentOnPr, fetchGithubChecks, updatePr } from '../server/forge/github.js';
|
|
32
32
|
import { createDraftPr } from '../server/pr.js';
|
|
33
33
|
import { getHeadCommit, getRepoInfo } from '../server/git.js';
|
|
@@ -40,7 +40,7 @@ import { reclaimWorktrees, rematerializeReclaimedWorktree } from '../runs/retent
|
|
|
40
40
|
import { AgentTempDirError, agentTmpEnv, removeAgentTmpDir, sweepAgentTmpDirs, } from '../runs/agent-tmpdir.js';
|
|
41
41
|
import { extractTaskRefs, refineTaskRefs, titleRefNumber } from '../runs/task-refs.js';
|
|
42
42
|
import { parseTaskMarkers, stripTaskMarkers } from '../runs/task-markers.js';
|
|
43
|
-
import { autoNamingActive, generateRunName, liveTitleUpdatesEnabled, postValidateTitle } from '../runs/auto-name.js';
|
|
43
|
+
import { autoNamingActive, generateRunName, liveTitleUpdatesEnabled, NAMER_TIMEOUT_MS, postValidateTitle } from '../runs/auto-name.js';
|
|
44
44
|
import { reviewGateEnabled } from '../runs/review-gate.js';
|
|
45
45
|
import { resolveProfileEnvForRoot } from '../workspace/agent-profiles.js';
|
|
46
46
|
import { DEFAULT_AGENT_ACCOUNT_ID } from '../workspace/agent-accounts.js';
|
|
@@ -49,6 +49,7 @@ import { SecretStore } from '../workspace/secrets.js';
|
|
|
49
49
|
import { PROJECT_ID_RE } from '../workspace/config.js';
|
|
50
50
|
import { prunePrHeadRefs } from '../automations/pr-head.js';
|
|
51
51
|
import { MIN_SECRET_LEN } from '../core/secret-redaction.js';
|
|
52
|
+
import { track } from '../telemetry.js';
|
|
52
53
|
import { UiEventSink } from '../runs/ui-event-sink.js';
|
|
53
54
|
import { chainStepNote, DEFAULT_ALLOWED_TOOLS, stepKind, } from './types.js';
|
|
54
55
|
import { advance, compileV1, compareValues, enterGraph, globMatch, graphRailSteps, loopBodyIds, edgeFrom, forkShape, isFailurePort, isTerminalAgent, nodeToStep, parseVerdict, renderNodeRefs, stripVerdictMarker, verdictInstruction, isExecutableNode, } from './graph.js';
|
|
@@ -93,6 +94,11 @@ async function configuredModelProvider(backend, repoRoot) {
|
|
|
93
94
|
}
|
|
94
95
|
/** Maximum time a live provider gets to honor cancellation before its slot is reaped. */
|
|
95
96
|
const CANCEL_GRACE_MS = 1_000;
|
|
97
|
+
/** How long a fork waits for the namer's branch (spec 2026-10-11-branch-naming-instructions).
|
|
98
|
+
* On an idle cockpit a task starts the instant it is created, so the wait begins together with
|
|
99
|
+
* the namer call — and a cold `claude -p` alone takes more than five seconds (run 269606ac
|
|
100
|
+
* forked on `cez/` with "not ready in time"). Sized to the namer's own timeout plus a margin. */
|
|
101
|
+
const BRANCH_NAME_WAIT_MS = NAMER_TIMEOUT_MS + 10_000;
|
|
96
102
|
/**
|
|
97
103
|
* Task-completion marker from the agent contract (HANDOFF_INSTRUCTIONS): a
|
|
98
104
|
* turn whose text ends with `CEZ:DONE` means "goal achieved, nothing to ask" —
|
|
@@ -157,6 +163,10 @@ export function turnEndMarkerText(turnText) {
|
|
|
157
163
|
export function endsWithMonitoringMarker(turnText) {
|
|
158
164
|
return MONITORING_MARKER_RE.test(turnEndMarkerText(turnText));
|
|
159
165
|
}
|
|
166
|
+
/** Strict superset of the historical DONE suffix check, accepting trailing task references. */
|
|
167
|
+
export function endsWithDoneMarker(turnText) {
|
|
168
|
+
return DONE_MARKER_RE.test(turnEndMarkerText(turnText));
|
|
169
|
+
}
|
|
160
170
|
/**
|
|
161
171
|
* The follow-up cezar sends when a turn ended on nothing but the backend compacting its own
|
|
162
172
|
* context (#955). Not a user message: it never enters the transcript as one, and it is written
|
|
@@ -244,7 +254,7 @@ function askMarkerRecovery(result) {
|
|
|
244
254
|
function resolveAskTurn(turnText, enabled) {
|
|
245
255
|
if (!enabled)
|
|
246
256
|
return { ask: null, notes: [] };
|
|
247
|
-
const result = parseAskMarkerResult(turnText);
|
|
257
|
+
const result = parseAskMarkerResult(turnEndMarkerText(turnText));
|
|
248
258
|
const notes = [];
|
|
249
259
|
const rejection = askMarkerRejection(result);
|
|
250
260
|
if (rejection)
|
|
@@ -268,7 +278,6 @@ function resolveAskTurn(turnText, enabled) {
|
|
|
268
278
|
* question the user needs to see, not an invitation to keep going.
|
|
269
279
|
*/
|
|
270
280
|
function markerlessTurn(turnText) {
|
|
271
|
-
const trimmed = turnText.trimEnd();
|
|
272
281
|
// Through `turnEndMarkerText` (#933), the same reading the monitoring decision uses: a turn
|
|
273
282
|
// that ends `CEZ:MONITORING` followed by a `CEZ:PR=` line spoke, and must not be continued.
|
|
274
283
|
const markerText = turnEndMarkerText(turnText);
|
|
@@ -279,7 +288,7 @@ function markerlessTurn(turnText) {
|
|
|
279
288
|
// see — would read as ordinary prose and authorize a continuation. The parser's looser
|
|
280
289
|
// `none` test is the right question here, and its known over-reach (an earlier PROSE mention
|
|
281
290
|
// of the keyword also counts as spoken) errs towards parking, which is today's behavior.
|
|
282
|
-
return parseAskMarkerResult(
|
|
291
|
+
return parseAskMarkerResult(markerText).kind === 'none';
|
|
283
292
|
}
|
|
284
293
|
/** Periodic "cezar autosave" commit in the task worktree (spec 006). */
|
|
285
294
|
export const AUTOSAVE_INTERVAL_MS = 90_000;
|
|
@@ -687,6 +696,10 @@ export class RunManager {
|
|
|
687
696
|
*/
|
|
688
697
|
unitParents = new Set();
|
|
689
698
|
pendingJobs = new Map();
|
|
699
|
+
/** The creation-time namer's branch answer per queued run (spec
|
|
700
|
+
* 2026-10-11-branch-naming-instructions) — `execute` awaits it, bounded, before the fork. */
|
|
701
|
+
pendingBranchNames = new Map();
|
|
702
|
+
branchNameWaitMs;
|
|
690
703
|
/** Interrupted agent turns recovered after a process restart. Unlike an
|
|
691
704
|
* explicit user Continue, these are bulk scheduler work and must re-enter
|
|
692
705
|
* through `pump()` so both workspace and per-project caps are honored. */
|
|
@@ -752,6 +765,7 @@ export class RunManager {
|
|
|
752
765
|
this.store = store;
|
|
753
766
|
this.repoRoot = repoRoot;
|
|
754
767
|
this.dataDir = join(repoRoot, '.ai/cezar');
|
|
768
|
+
this.branchNameWaitMs = options.branchNameWaitMs ?? BRANCH_NAME_WAIT_MS;
|
|
755
769
|
this.projectId = options.projectId;
|
|
756
770
|
this.resolveTrackerEnv = options.resolveTrackerEnv;
|
|
757
771
|
this.secrets = options.secrets ?? new SecretStore();
|
|
@@ -801,6 +815,7 @@ export class RunManager {
|
|
|
801
815
|
this.starting.clear();
|
|
802
816
|
this.queue.length = 0;
|
|
803
817
|
this.pendingJobs.clear();
|
|
818
|
+
this.pendingBranchNames.clear();
|
|
804
819
|
this.pendingContinuations.clear();
|
|
805
820
|
this.memoryPausing.clear();
|
|
806
821
|
this.lastNamerKey.clear();
|
|
@@ -1034,8 +1049,12 @@ export class RunManager {
|
|
|
1034
1049
|
}
|
|
1035
1050
|
// Fire-and-forget LLM naming (task auto-naming spec): the heuristic title
|
|
1036
1051
|
// above shows instantly; the namer's short title replaces it when (and if)
|
|
1037
|
-
// the model answers. Never awaited, never fails the run.
|
|
1038
|
-
|
|
1052
|
+
// the model answers. Never awaited here, never fails the run. The same call
|
|
1053
|
+
// also answers the task branch when instructions are set; `execute` waits
|
|
1054
|
+
// for that part, bounded, before it forks.
|
|
1055
|
+
this.pendingBranchNames.set(run.id, this.autoNameRun(run.id, skillHint, input.task));
|
|
1056
|
+
// `default` = no explicit pick; the runner/CLI chose. Never the prompt itself.
|
|
1057
|
+
track('task_start', { label: `${input.runner ?? 'default'}/${effectiveInput.model ?? 'default'}` }, { sid: input.deviceSid });
|
|
1039
1058
|
this.pendingJobs.set(run.id, { workflow, input: effectiveInput });
|
|
1040
1059
|
this.queue.push(run.id);
|
|
1041
1060
|
void this.pump();
|
|
@@ -1581,6 +1600,7 @@ export class RunManager {
|
|
|
1581
1600
|
this.store.clearRunSecrets(runId);
|
|
1582
1601
|
this.memoryPausing.delete(runId);
|
|
1583
1602
|
this.lastNamerKey.delete(runId);
|
|
1603
|
+
this.pendingBranchNames.delete(runId);
|
|
1584
1604
|
this.forceStarted.delete(runId);
|
|
1585
1605
|
// The run's slot is gone from busySlots() as of the deletes above — hand it
|
|
1586
1606
|
// to the workspace's oldest queued run, in ANY project. Every terminal path
|
|
@@ -1731,11 +1751,17 @@ export class RunManager {
|
|
|
1731
1751
|
* working. Delivered into the still-open session so the run is working again, not parking —
|
|
1732
1752
|
* a task that never parks still hears its parent within one turn. Not on a turn that asked: a
|
|
1733
1753
|
* run parking on the Guard waits for the human, and a message must not stand in for the answer.
|
|
1754
|
+
*
|
|
1755
|
+
* The ask is read through `turnEndMarkerText` (#997), the same normalization `resolveAskTurn`
|
|
1756
|
+
* uses: this guard runs BEFORE the ask is resolved, and a delivery sets `rePrompted` — which
|
|
1757
|
+
* auto-continues the turn and suppresses the ask card entirely. Reading the raw text here
|
|
1758
|
+
* would let a question with a trailing `CEZ:PR=` line be answered by a sibling's message
|
|
1759
|
+
* instead of by the human, which is exactly what this guard exists to prevent.
|
|
1734
1760
|
*/
|
|
1735
1761
|
deliverOwnInbox(runId, state, stepId, turnText) {
|
|
1736
1762
|
if (!state.autonomous || state.cancelled || !state.session?.open)
|
|
1737
1763
|
return false;
|
|
1738
|
-
if (parseAskMarker(turnText) !== null)
|
|
1764
|
+
if (parseAskMarker(turnEndMarkerText(turnText)) !== null)
|
|
1739
1765
|
return false;
|
|
1740
1766
|
if ((state.autoContinues ?? 0) >= MAX_AUTO_CONTINUES)
|
|
1741
1767
|
return false;
|
|
@@ -2651,6 +2677,7 @@ export class RunManager {
|
|
|
2651
2677
|
if (queuedAt >= 0) {
|
|
2652
2678
|
this.queue.splice(queuedAt, 1);
|
|
2653
2679
|
this.pendingJobs.delete(runId);
|
|
2680
|
+
this.pendingBranchNames.delete(runId);
|
|
2654
2681
|
this.pendingContinuations.delete(runId);
|
|
2655
2682
|
this.store.updateRun(runId, { status: 'cancelled', finishedAt: new Date().toISOString() });
|
|
2656
2683
|
this.store.appendEvent(runId, { type: 'lifecycle', message: 'cancelled while queued' });
|
|
@@ -3473,7 +3500,7 @@ export class RunManager {
|
|
|
3473
3500
|
// because a turn that finished or dispatched is progress too.
|
|
3474
3501
|
if (!compacted)
|
|
3475
3502
|
state.compactionContinues = 0;
|
|
3476
|
-
const done = sessionOpen &&
|
|
3503
|
+
const done = sessionOpen && endsWithDoneMarker(turnText);
|
|
3477
3504
|
// The dispatch facts of this turn (spec 2026-09-10-dispatch), through the ONE helper both
|
|
3478
3505
|
// turn-end handlers call. Inert for a run with no `dispatch`.
|
|
3479
3506
|
const dispatchTurn = this.handleDispatchTurn(runId, turnText, {
|
|
@@ -3878,6 +3905,8 @@ export class RunManager {
|
|
|
3878
3905
|
const startingCommit = await getHeadCommit(repo.root);
|
|
3879
3906
|
if (startingCommit)
|
|
3880
3907
|
this.store.updateRun(runId, { baseBranch: startingCommit });
|
|
3908
|
+
// In-place runs never fork, so nothing will ever read the namer's branch answer.
|
|
3909
|
+
this.pendingBranchNames.delete(runId);
|
|
3881
3910
|
emit({ type: 'note', message: 'worktree off — running in the repo working tree' });
|
|
3882
3911
|
}
|
|
3883
3912
|
else if (repo) {
|
|
@@ -3897,11 +3926,37 @@ export class RunManager {
|
|
|
3897
3926
|
// reused as-is, and re-resolving against a since-changed config would
|
|
3898
3927
|
// silently re-anchor the `merge-base` every diff/shortstat is measured
|
|
3899
3928
|
// from, shifting "what did this task change" under an existing task.
|
|
3900
|
-
const
|
|
3929
|
+
const recordedRun = this.store.getRun(runId);
|
|
3930
|
+
const recorded = recordedRun?.baseBranch;
|
|
3901
3931
|
const base = recorded ??
|
|
3902
3932
|
(await chooseForkBase(this.repoRoot, repo.branch, config.baseBranch, (message) => emit({ type: 'note', message })));
|
|
3903
3933
|
try {
|
|
3904
|
-
|
|
3934
|
+
// A recorded branch (restart, rematerialize) always wins — a named branch cannot be
|
|
3935
|
+
// recomputed from the id. A fresh run waits, bounded, for the namer's branch instead.
|
|
3936
|
+
const branch = recordedRun?.branch ??
|
|
3937
|
+
(await this.awaitGeneratedBranch(runId, config.branchNaming, (message) => emit({ type: 'note', message })));
|
|
3938
|
+
// The wait can last the namer's whole timeout; a Cancel during it must not fork.
|
|
3939
|
+
if (state.cancelled) {
|
|
3940
|
+
this.dropActive(runId, state);
|
|
3941
|
+
return;
|
|
3942
|
+
}
|
|
3943
|
+
let wt;
|
|
3944
|
+
try {
|
|
3945
|
+
wt = await createWorktree(this.repoRoot, runId, base, { branch });
|
|
3946
|
+
}
|
|
3947
|
+
catch (err) {
|
|
3948
|
+
// A generated name git still refuses (ref race, an exotic conflict) must degrade to
|
|
3949
|
+
// `cez/<id8>`, never fail the task. A recorded branch is the run's own: no fallback.
|
|
3950
|
+
const generated = branch !== undefined && recordedRun?.branch === undefined;
|
|
3951
|
+
if (!generated || state.cancelled)
|
|
3952
|
+
throw err;
|
|
3953
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
3954
|
+
emit({
|
|
3955
|
+
type: 'note',
|
|
3956
|
+
message: `generated branch "${branch}" could not be created (${reason}) — using the default cez/ branch`,
|
|
3957
|
+
});
|
|
3958
|
+
wt = await createWorktree(this.repoRoot, runId, base);
|
|
3959
|
+
}
|
|
3905
3960
|
state.cwd = wt.path;
|
|
3906
3961
|
this.store.updateRun(runId, {
|
|
3907
3962
|
worktreePath: wt.path,
|
|
@@ -3937,6 +3992,7 @@ export class RunManager {
|
|
|
3937
3992
|
}
|
|
3938
3993
|
}
|
|
3939
3994
|
else {
|
|
3995
|
+
this.pendingBranchNames.delete(runId);
|
|
3940
3996
|
emit({ type: 'note', message: 'not a git repository — running in place, one task at a time' });
|
|
3941
3997
|
}
|
|
3942
3998
|
if (state.cwd === this.repoRoot) {
|
|
@@ -5212,7 +5268,7 @@ export class RunManager {
|
|
|
5212
5268
|
const markerless = compacted && markerlessTurn(turnText);
|
|
5213
5269
|
if (!compacted)
|
|
5214
5270
|
state.compactionContinues = 0;
|
|
5215
|
-
const done = interactive && sessionOpen &&
|
|
5271
|
+
const done = interactive && sessionOpen && endsWithDoneMarker(turnText);
|
|
5216
5272
|
// The dispatch facts, through the same ONE helper `runContinuation` calls (spec
|
|
5217
5273
|
// 2026-09-10-dispatch A5). Not gated on `interactive`: a report and a dispatch
|
|
5218
5274
|
// are the agent telling cezar what it did, and a chained workflow's non-final step that
|
|
@@ -5662,11 +5718,15 @@ export class RunManager {
|
|
|
5662
5718
|
* refresh). A user-owned title (`titleOrigin: 'user'`) is never overwritten;
|
|
5663
5719
|
* namer-owned titles may be replaced by fresher namer results.
|
|
5664
5720
|
*/
|
|
5721
|
+
/**
|
|
5722
|
+
* Resolves to the namer's branch (spec 2026-10-11-branch-naming-instructions) on the
|
|
5723
|
+
* creation call — undefined whenever naming is off, unconfigured, or the answer was unusable.
|
|
5724
|
+
*/
|
|
5665
5725
|
async autoNameRun(runId, skillName, task, live) {
|
|
5666
5726
|
// CEZ_AUTONAME=0 kills all LLM naming; dry-run skips it too unless
|
|
5667
5727
|
// CEZ_AUTONAME=1 forces the mock path — see autoNamingActive.
|
|
5668
5728
|
if (!autoNamingActive())
|
|
5669
|
-
return;
|
|
5729
|
+
return undefined;
|
|
5670
5730
|
task = this.store.redactRunText(runId, task);
|
|
5671
5731
|
if (live?.turnText)
|
|
5672
5732
|
live = { ...live, turnText: this.store.redactRunText(runId, live.turnText) };
|
|
@@ -5676,15 +5736,16 @@ export class RunManager {
|
|
|
5676
5736
|
const skills = await discoverSkills(this.repoRoot).catch(() => []);
|
|
5677
5737
|
skillDescription = skills.find((s) => s.name === skillName)?.description;
|
|
5678
5738
|
}
|
|
5679
|
-
|
|
5739
|
+
// Only the creation call names the branch: the live refresh must never move it.
|
|
5740
|
+
const result = await generateRunName(this.repoRoot, { task, skillName, skillDescription, ...live, nameBranch: !live });
|
|
5680
5741
|
if (!result)
|
|
5681
|
-
return;
|
|
5742
|
+
return undefined;
|
|
5682
5743
|
const run = this.store.getRun(runId);
|
|
5683
5744
|
// Marker-owned state outranks the namer (spec 2026-07-18-task-ref-markers):
|
|
5684
5745
|
// a declared title blocks the whole apply (this call raced the marker),
|
|
5685
5746
|
// and a declared pr/issue kind blocks that kind field-by-field.
|
|
5686
5747
|
if (!run || run.titleOrigin === 'user' || run.titleOrigin === 'marker')
|
|
5687
|
-
return;
|
|
5748
|
+
return result.branch;
|
|
5688
5749
|
this.store.updateRun(runId, {
|
|
5689
5750
|
titleSummary: result.titleSummary,
|
|
5690
5751
|
titleOrigin: 'auto',
|
|
@@ -5695,10 +5756,44 @@ export class RunManager {
|
|
|
5695
5756
|
? { issueNumber: result.issueNumber }
|
|
5696
5757
|
: {}),
|
|
5697
5758
|
});
|
|
5759
|
+
return result.branch;
|
|
5698
5760
|
}
|
|
5699
5761
|
catch {
|
|
5700
5762
|
// Naming is best-effort — nothing here may disturb the run.
|
|
5763
|
+
return undefined;
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
/**
|
|
5767
|
+
* The branch a fresh fork should use (spec 2026-10-11-branch-naming-instructions): the
|
|
5768
|
+
* namer's answer, made unique against existing branches, awaited for at most
|
|
5769
|
+
* `BRANCH_NAME_WAIT_MS` and only when instructions are set — the zero-config fork stays
|
|
5770
|
+
* instant. Undefined means `cez/<id8>`; a late answer is dropped, never applied as a rename.
|
|
5771
|
+
*/
|
|
5772
|
+
async awaitGeneratedBranch(runId, branchNaming, note) {
|
|
5773
|
+
const pending = this.pendingBranchNames.get(runId);
|
|
5774
|
+
this.pendingBranchNames.delete(runId);
|
|
5775
|
+
if (!pending || !branchNaming)
|
|
5776
|
+
return undefined;
|
|
5777
|
+
const TIMED_OUT = Symbol('timed out');
|
|
5778
|
+
let timer;
|
|
5779
|
+
const timeout = new Promise((resolve) => {
|
|
5780
|
+
timer = setTimeout(() => resolve(TIMED_OUT), this.branchNameWaitMs);
|
|
5781
|
+
});
|
|
5782
|
+
const wanted = await Promise.race([pending, timeout]).finally(() => clearTimeout(timer));
|
|
5783
|
+
if (wanted === TIMED_OUT) {
|
|
5784
|
+
note('branch name not ready in time — using the default cez/ branch');
|
|
5785
|
+
return undefined;
|
|
5786
|
+
}
|
|
5787
|
+
if (!wanted) {
|
|
5788
|
+
note('the namer answered no branch name — using the default cez/ branch');
|
|
5789
|
+
return undefined;
|
|
5790
|
+
}
|
|
5791
|
+
const unique = await uniqueBranchName(this.repoRoot, wanted, runId);
|
|
5792
|
+
if (!unique) {
|
|
5793
|
+
note(`generated branch name "${wanted}" is not usable — using the default cez/ branch`);
|
|
5794
|
+
return undefined;
|
|
5701
5795
|
}
|
|
5796
|
+
return unique;
|
|
5702
5797
|
}
|
|
5703
5798
|
async recordTurnEnd(runId, turnText, owner) {
|
|
5704
5799
|
// The namer can finish after session cleanup removes its in-memory secrets.
|