@telora/daemon 0.20.9 → 0.20.21
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/build-info.json +9 -3
- package/dist/cli/session-state.d.ts.map +1 -1
- package/dist/cli/session-state.js +6 -1
- package/dist/cli/session-state.js.map +1 -1
- package/dist/completion/review-exit-phase.d.ts +2 -0
- package/dist/completion/review-exit-phase.d.ts.map +1 -1
- package/dist/completion/review-exit-phase.js +59 -5
- package/dist/completion/review-exit-phase.js.map +1 -1
- package/dist/completion/review-exit-shortfall.d.ts +62 -0
- package/dist/completion/review-exit-shortfall.d.ts.map +1 -0
- package/dist/completion/review-exit-shortfall.js +84 -0
- package/dist/completion/review-exit-shortfall.js.map +1 -0
- package/dist/drift-ratify-loop.d.ts +68 -0
- package/dist/drift-ratify-loop.d.ts.map +1 -0
- package/dist/drift-ratify-loop.js +161 -0
- package/dist/drift-ratify-loop.js.map +1 -0
- package/dist/drift-ratify-policy.d.ts +101 -0
- package/dist/drift-ratify-policy.d.ts.map +1 -0
- package/dist/drift-ratify-policy.js +178 -0
- package/dist/drift-ratify-policy.js.map +1 -0
- package/dist/focus-loop-registry.d.ts.map +1 -1
- package/dist/focus-loop-registry.js +49 -0
- package/dist/focus-loop-registry.js.map +1 -1
- package/dist/prompt-sections/persona-sections.d.ts.map +1 -1
- package/dist/prompt-sections/persona-sections.js +41 -4
- package/dist/prompt-sections/persona-sections.js.map +1 -1
- package/dist/queries/deliveries.d.ts +22 -0
- package/dist/queries/deliveries.d.ts.map +1 -1
- package/dist/queries/deliveries.js +6 -0
- package/dist/queries/deliveries.js.map +1 -1
- package/dist/queries/focuses.d.ts +9 -0
- package/dist/queries/focuses.d.ts.map +1 -1
- package/dist/queries/focuses.js +14 -0
- package/dist/queries/focuses.js.map +1 -1
- package/dist/queries/reality-tree.d.ts +22 -0
- package/dist/queries/reality-tree.d.ts.map +1 -1
- package/dist/queries/reality-tree.js +32 -0
- package/dist/queries/reality-tree.js.map +1 -1
- package/dist/queries/schemas.d.ts +2 -0
- package/dist/queries/schemas.d.ts.map +1 -1
- package/dist/queries/schemas.js +5 -0
- package/dist/queries/schemas.js.map +1 -1
- package/dist/resolvers/drift-shortfall-proposals.d.ts +27 -0
- package/dist/resolvers/drift-shortfall-proposals.d.ts.map +1 -0
- package/dist/resolvers/drift-shortfall-proposals.js +90 -0
- package/dist/resolvers/drift-shortfall-proposals.js.map +1 -0
- package/dist/resolvers/index.d.ts.map +1 -1
- package/dist/resolvers/index.js +2 -0
- package/dist/resolvers/index.js.map +1 -1
- package/dist/shortfall-disposition-config.d.ts +34 -0
- package/dist/shortfall-disposition-config.d.ts.map +1 -0
- package/dist/shortfall-disposition-config.js +46 -0
- package/dist/shortfall-disposition-config.js.map +1 -0
- package/dist/shortfall-disposition-loop.d.ts +86 -0
- package/dist/shortfall-disposition-loop.d.ts.map +1 -0
- package/dist/shortfall-disposition-loop.js +309 -0
- package/dist/shortfall-disposition-loop.js.map +1 -0
- package/dist/unified-shell-status.d.ts.map +1 -1
- package/dist/unified-shell-status.js +5 -1
- package/dist/unified-shell-status.js.map +1 -1
- package/dist/verification-config.d.ts +64 -15
- package/dist/verification-config.d.ts.map +1 -1
- package/dist/verification-config.js +66 -21
- package/dist/verification-config.js.map +1 -1
- package/dist/verification-default-on.d.ts +73 -1
- package/dist/verification-default-on.d.ts.map +1 -1
- package/dist/verification-default-on.js +79 -0
- package/dist/verification-default-on.js.map +1 -1
- package/dist/verification-engine.d.ts +1 -1
- package/dist/verification-engine.d.ts.map +1 -1
- package/dist/verification-engine.js +26 -15
- package/dist/verification-engine.js.map +1 -1
- package/dist/verification-manifest.d.ts +110 -0
- package/dist/verification-manifest.d.ts.map +1 -0
- package/dist/verification-manifest.js +150 -0
- package/dist/verification-manifest.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { registerSourceResolver } from '../assembly-engine.js';
|
|
2
|
+
import { callApi } from '../queries/shared.js';
|
|
3
|
+
import { requiresReviewDisposition } from '../drift-ratify-policy.js';
|
|
4
|
+
import { createLogger } from '../log.js';
|
|
5
|
+
const log = createLogger({ module: 'assembly-engine' });
|
|
6
|
+
/**
|
|
7
|
+
* drift.shortfall_proposals
|
|
8
|
+
*
|
|
9
|
+
* Puts the focus's pending inward-SHORTFALL drift proposals into the review
|
|
10
|
+
* team's assembled context, so disposition is possible at all.
|
|
11
|
+
*
|
|
12
|
+
* A shortfall says: the tree claimed X, and the work delivered less than X.
|
|
13
|
+
* Someone must decide which one was wrong. Ratifying amends the CLAIM (only
|
|
14
|
+
* honest when the claim was mis-stated); filing defects says the WORK fell
|
|
15
|
+
* short and must re-enter coding. That decision is the review team's, because
|
|
16
|
+
* it did not write the code -- separation of duties standing in for the human
|
|
17
|
+
* gate that used to sit here.
|
|
18
|
+
*
|
|
19
|
+
* The classification is NOT re-derived here: `requiresReviewDisposition` from
|
|
20
|
+
* drift-ratify-policy.ts is the one place that decides what a shortfall is, and
|
|
21
|
+
* the daemon's auto-ratify tick reads the same predicate. Client-side filtering
|
|
22
|
+
* is required because crt_drift_proposal_list cannot filter on
|
|
23
|
+
* proposed_metadata (it supports focusId/productId/realityTreeId/status only).
|
|
24
|
+
*
|
|
25
|
+
* Fails soft -- returns empty string when there are none, or when the API call
|
|
26
|
+
* fails. An assembly section that throws would take the whole review prompt
|
|
27
|
+
* down with it; a review that runs without this section is degraded but the
|
|
28
|
+
* completion gate still refuses to let undisposed shortfalls through.
|
|
29
|
+
*/
|
|
30
|
+
/** Register this module's resolver(s). Called from initResolvers() -- not an import side effect. */
|
|
31
|
+
export function registerDriftShortfallProposalsResolver() {
|
|
32
|
+
registerSourceResolver('drift.shortfall_proposals', async (context) => {
|
|
33
|
+
try {
|
|
34
|
+
const list = await callApi('crt_drift_proposal_list', {
|
|
35
|
+
focusId: context.focusId,
|
|
36
|
+
status: 'proposed',
|
|
37
|
+
});
|
|
38
|
+
const shortfalls = (list.items ?? []).filter((p) => requiresReviewDisposition({
|
|
39
|
+
proposalKind: p.proposalKind,
|
|
40
|
+
proposedMetadata: p.proposedMetadata,
|
|
41
|
+
}));
|
|
42
|
+
if (shortfalls.length === 0)
|
|
43
|
+
return '';
|
|
44
|
+
const lines = [
|
|
45
|
+
'## Shortfall Drift Proposals Awaiting Your Disposition',
|
|
46
|
+
'',
|
|
47
|
+
`${shortfalls.length} proposal(s) report that reality fell short of what this focus's`,
|
|
48
|
+
'reality tree claimed. Each one is a contradiction between a tree claim and what',
|
|
49
|
+
'the work actually delivered, and each REQUIRES a disposition from you before this',
|
|
50
|
+
'review can close.',
|
|
51
|
+
'',
|
|
52
|
+
'**You must choose, per proposal:**',
|
|
53
|
+
'',
|
|
54
|
+
'1. **The WORK fell short** (the common case) -- file defect issues describing',
|
|
55
|
+
' the gap, THEN dismiss the proposal via `telora_reality_drift`',
|
|
56
|
+
' action=dismiss, passing:',
|
|
57
|
+
' - `proposalId`: the id below',
|
|
58
|
+
' - `reason`: a non-empty explanation naming the defect issues you filed.',
|
|
59
|
+
' Required -- the call is refused without it.',
|
|
60
|
+
' Dismissing REJECTS the proposed correction: the claim stands and the work',
|
|
61
|
+
' is what changes. Filing the defects ALONE is not enough -- it leaves the',
|
|
62
|
+
' proposal open and the delivery can never converge. Do NOT ratify.',
|
|
63
|
+
'2. **The CLAIM was wrong** -- the tree asserted something it should never have',
|
|
64
|
+
' asserted (mis-scoped, double-counted, or superseded). Ratify it via',
|
|
65
|
+
' `telora_reality_drift` action=ratify, passing:',
|
|
66
|
+
' - `proposalId`: the id below',
|
|
67
|
+
' - `rationale`: a non-empty explanation of why the CLAIM (not the work) was',
|
|
68
|
+
' wrong. Required -- the call is refused without it.',
|
|
69
|
+
' - `ratifiedBySessionId`: your review session id (given elsewhere in this',
|
|
70
|
+
' prompt). Required -- an agent cannot ratify a shortfall without it.',
|
|
71
|
+
'',
|
|
72
|
+
'Ratifying LOWERS A BAR. It is correct only when the claim was genuinely wrong,',
|
|
73
|
+
'never as a convenience when the work fell short. A ratified-shortfall rate is',
|
|
74
|
+
'measured; systematic ratification in place of filing defects is visible.',
|
|
75
|
+
'',
|
|
76
|
+
];
|
|
77
|
+
for (const p of shortfalls) {
|
|
78
|
+
const meta = p.proposedMetadata ?? {};
|
|
79
|
+
const nodeId = p.nodeId ?? meta.sourceNodeId ?? 'unknown';
|
|
80
|
+
lines.push(`### Proposal \`${p.id}\``, '', `- **Tree node:** \`${nodeId}\``, `- **Kind:** ${p.proposalKind}`, `- **Raised:** ${p.createdAt}`, '', `**The tree claimed:** ${p.observedState}`, '', `**What reality showed:** ${p.proposedCorrection}`, '');
|
|
81
|
+
}
|
|
82
|
+
return lines.join('\n');
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
log.warn(`drift.shortfall_proposals: failed: ${err.message}`);
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=drift-shortfall-proposals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift-shortfall-proposals.js","sourceRoot":"","sources":["../../src/resolvers/drift-shortfall-proposals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;AAkBxD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,oGAAoG;AACpG,MAAM,UAAU,uCAAuC;IACrD,sBAAsB,CACpB,2BAA2B,EAC3B,KAAK,EAAE,OAAwB,EAAmB,EAAE;QAClD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAe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AI,EAChC,eAAe,CAAC,CAAC,YAAY,EAAE,EAC/B,iBAAiB,CAAC,CAAC,SAAS,EAAE,EAC9B,EAAE,EACF,yBAAyB,CAAC,CAAC,aAAa,EAAE,EAC1C,EAAE,EACF,4BAA4B,CAAC,CAAC,kBAAkB,EAAE,EAClD,EAAE,CACH,CAAC;YACJ,CAAC;YAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,GAAG,CAAC,IAAI,CAAC,sCAAuC,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YACzE,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAyFH;;;;;;;;;GASG;AACH,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAgBxC;AAGD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC"}
|
package/dist/resolvers/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import { registerDeploymentProfileResolver } from './deployment-profile.js';
|
|
|
33
33
|
import { registerDeliveryListingResolver } from './delivery-listing.js';
|
|
34
34
|
import { registerFocusInjectionsResolver } from './focus-injections.js';
|
|
35
35
|
import { registerReviewOutcomesResolver } from './review-outcomes.js';
|
|
36
|
+
import { registerDriftShortfallProposalsResolver } from './drift-shortfall-proposals.js';
|
|
36
37
|
import { registerFocusAnchoringInjectionsResolver } from './focus-anchoring-injections.js';
|
|
37
38
|
import { registerRealityMetricsResolver } from './reality-metrics.js';
|
|
38
39
|
import { registerRealityProjectionsResolver } from './reality-projections.js';
|
|
@@ -73,6 +74,7 @@ const REGISTER_FUNCTIONS = [
|
|
|
73
74
|
registerDeliveryListingResolver,
|
|
74
75
|
registerFocusInjectionsResolver,
|
|
75
76
|
registerReviewOutcomesResolver,
|
|
77
|
+
registerDriftShortfallProposalsResolver,
|
|
76
78
|
registerFocusAnchoringInjectionsResolver,
|
|
77
79
|
registerRealityMetricsResolver,
|
|
78
80
|
registerRealityProjectionsResolver,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resolvers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,0CAA0C,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,qCAAqC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,uCAAuC,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,8BAA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@@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threshold for the shortfall-disposition attempt bound.
|
|
3
|
+
*
|
|
4
|
+
* The CANONICAL declaration (Zod schema, ENV_VAR_METADATA entry, default,
|
|
5
|
+
* description) lives in packages/daemon-core/src/env-config.ts, exactly like the
|
|
6
|
+
* stall-detector thresholds in stall-detector-config.ts.
|
|
7
|
+
*
|
|
8
|
+
* It is read RAW here rather than through loadEnvConfig() for one reason:
|
|
9
|
+
* @telora/daemon-core is REGISTRY-INSTALLED, not a workspace symlink, so
|
|
10
|
+
* packages/daemon compiles and runs against the PUBLISHED dist. A field added to
|
|
11
|
+
* daemon-core's source is invisible to loadEnvConfig() here until a publish
|
|
12
|
+
* lands and the pin moves. This is the same registry-lag workaround
|
|
13
|
+
* stall-detectors.ts documents for escalation kinds.
|
|
14
|
+
*
|
|
15
|
+
* The raw read is allowlisted in scripts/lint-config.json under "env-reads"
|
|
16
|
+
* with that reason. WHEN daemon-core >0.2.69 IS PUBLISHED AND PINNED: delete the
|
|
17
|
+
* allowlist entry and change this to
|
|
18
|
+
* `loadEnvConfig().TELORA_SHORTFALL_DISPOSITION_ATTEMPT_CAP`.
|
|
19
|
+
*
|
|
20
|
+
* @module shortfall-disposition-config
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Max scoped disposition passes armed per focus before the daemon stops arming
|
|
24
|
+
* and escalates instead.
|
|
25
|
+
*
|
|
26
|
+
* Invalid values (non-numeric, <= 0) fall back to the default rather than
|
|
27
|
+
* disabling the bound: a zero or negative cap would escalate immediately on
|
|
28
|
+
* every held focus, and a NaN would compare false forever and never escalate --
|
|
29
|
+
* the permanent silent wait this bound exists to prevent. Once daemon-core is
|
|
30
|
+
* republished, Zod's positiveInt does this validation at startup and fails loud,
|
|
31
|
+
* which is strictly better; this is the interim.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveShortfallDispositionAttemptCap(env?: NodeJS.ProcessEnv): number;
|
|
34
|
+
//# sourceMappingURL=shortfall-disposition-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortfall-disposition-config.d.ts","sourceRoot":"","sources":["../src/shortfall-disposition-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH;;;;;;;;;;GAUG;AACH,wBAAgB,qCAAqC,CACnD,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAUR"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threshold for the shortfall-disposition attempt bound.
|
|
3
|
+
*
|
|
4
|
+
* The CANONICAL declaration (Zod schema, ENV_VAR_METADATA entry, default,
|
|
5
|
+
* description) lives in packages/daemon-core/src/env-config.ts, exactly like the
|
|
6
|
+
* stall-detector thresholds in stall-detector-config.ts.
|
|
7
|
+
*
|
|
8
|
+
* It is read RAW here rather than through loadEnvConfig() for one reason:
|
|
9
|
+
* @telora/daemon-core is REGISTRY-INSTALLED, not a workspace symlink, so
|
|
10
|
+
* packages/daemon compiles and runs against the PUBLISHED dist. A field added to
|
|
11
|
+
* daemon-core's source is invisible to loadEnvConfig() here until a publish
|
|
12
|
+
* lands and the pin moves. This is the same registry-lag workaround
|
|
13
|
+
* stall-detectors.ts documents for escalation kinds.
|
|
14
|
+
*
|
|
15
|
+
* The raw read is allowlisted in scripts/lint-config.json under "env-reads"
|
|
16
|
+
* with that reason. WHEN daemon-core >0.2.69 IS PUBLISHED AND PINNED: delete the
|
|
17
|
+
* allowlist entry and change this to
|
|
18
|
+
* `loadEnvConfig().TELORA_SHORTFALL_DISPOSITION_ATTEMPT_CAP`.
|
|
19
|
+
*
|
|
20
|
+
* @module shortfall-disposition-config
|
|
21
|
+
*/
|
|
22
|
+
/** Must match the daemon-core default so the two cannot silently disagree. */
|
|
23
|
+
const DEFAULT_SHORTFALL_DISPOSITION_ATTEMPT_CAP = 3;
|
|
24
|
+
/**
|
|
25
|
+
* Max scoped disposition passes armed per focus before the daemon stops arming
|
|
26
|
+
* and escalates instead.
|
|
27
|
+
*
|
|
28
|
+
* Invalid values (non-numeric, <= 0) fall back to the default rather than
|
|
29
|
+
* disabling the bound: a zero or negative cap would escalate immediately on
|
|
30
|
+
* every held focus, and a NaN would compare false forever and never escalate --
|
|
31
|
+
* the permanent silent wait this bound exists to prevent. Once daemon-core is
|
|
32
|
+
* republished, Zod's positiveInt does this validation at startup and fails loud,
|
|
33
|
+
* which is strictly better; this is the interim.
|
|
34
|
+
*/
|
|
35
|
+
export function resolveShortfallDispositionAttemptCap(env = process.env) {
|
|
36
|
+
const raw = env.TELORA_SHORTFALL_DISPOSITION_ATTEMPT_CAP;
|
|
37
|
+
if (raw === undefined || raw.trim() === '') {
|
|
38
|
+
return DEFAULT_SHORTFALL_DISPOSITION_ATTEMPT_CAP;
|
|
39
|
+
}
|
|
40
|
+
const parsed = Number(raw);
|
|
41
|
+
if (!Number.isFinite(parsed) || !Number.isInteger(parsed) || parsed <= 0) {
|
|
42
|
+
return DEFAULT_SHORTFALL_DISPOSITION_ATTEMPT_CAP;
|
|
43
|
+
}
|
|
44
|
+
return parsed;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=shortfall-disposition-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortfall-disposition-config.js","sourceRoot":"","sources":["../src/shortfall-disposition-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,8EAA8E;AAC9E,MAAM,yCAAyC,GAAG,CAAC,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qCAAqC,CACnD,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,GAAG,GAAG,GAAG,CAAC,wCAAwC,CAAC;IACzD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3C,OAAO,yCAAyC,CAAC;IACnD,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QACzE,OAAO,yCAAyC,CAAC;IACnD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped shortfall-disposition pass.
|
|
3
|
+
*
|
|
4
|
+
* A focus carrying an undisposed shortfall cannot converge: the completion gate
|
|
5
|
+
* (review-exit-phase) withholds done until every shortfall is ratified or
|
|
6
|
+
* dismissed. A hold with no self-heal is just a wedge, so this tick finds held
|
|
7
|
+
* focuses and arms a one-shot pass whose ONLY mandate is disposing them.
|
|
8
|
+
*
|
|
9
|
+
* WHY A TICK AND NOT THE REVIEW-EXIT PATH. The mandate covers shortfalls a
|
|
10
|
+
* review missed AND ones that arrived after the review window closed. A late
|
|
11
|
+
* arrival coincides with no review exit at all -- no handler runs to notice it --
|
|
12
|
+
* so arming from the exit path could only ever cover half the job. A tick sees a
|
|
13
|
+
* held focus whenever it becomes held, regardless of what held it.
|
|
14
|
+
*
|
|
15
|
+
* WHAT THIS PASS CAN AND CANNOT DO. It runs as a CODING session (a 'review'
|
|
16
|
+
* sessionType would re-enter the review-exit handler on exit and re-trigger the
|
|
17
|
+
* whole auto-approve evaluation -- a spawn loop). product-api refuses an agent
|
|
18
|
+
* shortfall-RATIFY unless it carries a review session, so this pass structurally
|
|
19
|
+
* cannot ratify. That is deliberate, not a limitation to work around: a pass
|
|
20
|
+
* that cannot lower a bar is a safe pass. It disposes the common case (the work
|
|
21
|
+
* fell short -> file defects + dismiss) and deliberately LEAVES a
|
|
22
|
+
* genuinely-wrong claim undisposed for a real review or an operator. The stall
|
|
23
|
+
* detector bounds that tail.
|
|
24
|
+
*
|
|
25
|
+
* Activation: opt-out via TELORA_SHORTFALL_DISPOSITION_LOOP=0. See
|
|
26
|
+
* `shouldRunLoop()` in focus-engine.ts.
|
|
27
|
+
*
|
|
28
|
+
* @module shortfall-disposition-loop
|
|
29
|
+
*/
|
|
30
|
+
import type { DaemonConfig, StageDirective } from './types.js';
|
|
31
|
+
import { getActiveFocuses } from './queries/deliveries.js';
|
|
32
|
+
import { listOpenShortfallProposalIds } from './queries/reality-tree.js';
|
|
33
|
+
import { setShortfallDispositionAttempts } from './queries/focuses.js';
|
|
34
|
+
import { createEscalation, hasOpenFocusEscalation } from './queries/issues.js';
|
|
35
|
+
import { hasPendingSpawnDirective } from './directive/directive-queue.js';
|
|
36
|
+
import { assembleDirectiveContent } from './directive/directive-assembly.js';
|
|
37
|
+
/**
|
|
38
|
+
* The one-shot mandate. Pure + unit-testable.
|
|
39
|
+
*
|
|
40
|
+
* States the RULE only; the drift.shortfall_proposals resolver carries the DATA
|
|
41
|
+
* (ids, claims, both dispositions, the exact params). Duplicating the detail
|
|
42
|
+
* here would drift from the resolver.
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildShortfallDispositionDirective(): StageDirective;
|
|
45
|
+
export interface ShortfallDispositionTickResult {
|
|
46
|
+
productsScanned: number;
|
|
47
|
+
focusesScanned: number;
|
|
48
|
+
/** Focuses carrying at least one undisposed shortfall. */
|
|
49
|
+
focusesHeld: number;
|
|
50
|
+
/** Disposition directives armed this tick. */
|
|
51
|
+
armed: number;
|
|
52
|
+
/** Held focuses skipped: a team is already running or a directive is pending. */
|
|
53
|
+
skippedBusy: number;
|
|
54
|
+
/** Focuses that exhausted the attempt bound and were escalated to an operator. */
|
|
55
|
+
escalated: number;
|
|
56
|
+
/** Focuses whose attempt counter was reset because their shortfalls cleared. */
|
|
57
|
+
countersReset: number;
|
|
58
|
+
errors: number;
|
|
59
|
+
}
|
|
60
|
+
export interface ShortfallDispositionDeps {
|
|
61
|
+
getActiveFocuses: typeof getActiveFocuses;
|
|
62
|
+
listOpenShortfallProposalIds: typeof listOpenShortfallProposalIds;
|
|
63
|
+
/** True when a team is already running for the focus. */
|
|
64
|
+
hasActiveTeam: (focusId: string) => boolean;
|
|
65
|
+
hasPendingSpawnDirective: typeof hasPendingSpawnDirective;
|
|
66
|
+
assembleDirectiveContent: typeof assembleDirectiveContent;
|
|
67
|
+
/** Stash the directive for the spawner to consume. */
|
|
68
|
+
armDirective: (focusId: string, message: string, directive: StageDirective) => void;
|
|
69
|
+
/** Persist the durable attempt counter. */
|
|
70
|
+
setShortfallDispositionAttempts: typeof setShortfallDispositionAttempts;
|
|
71
|
+
/** Per-focus dedup so the cap files exactly one open escalation. */
|
|
72
|
+
hasOpenFocusEscalation: typeof hasOpenFocusEscalation;
|
|
73
|
+
createEscalation: typeof createEscalation;
|
|
74
|
+
/** Injectable so the pure decision unit-tests without env or Supabase. */
|
|
75
|
+
cap?: number;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Run one disposition-pass tick across every product in the daemon config.
|
|
79
|
+
*
|
|
80
|
+
* Arms at most one directive per held focus per tick, and never while a team is
|
|
81
|
+
* running or a directive is already pending -- so a focus that stays held across
|
|
82
|
+
* ticks does not accumulate spawns. Per-focus failures are counted and skipped;
|
|
83
|
+
* one unresolvable focus must not stop the others.
|
|
84
|
+
*/
|
|
85
|
+
export declare function runShortfallDispositionTick(config: DaemonConfig, depOverrides?: Partial<ShortfallDispositionDeps>): Promise<ShortfallDispositionTickResult>;
|
|
86
|
+
//# sourceMappingURL=shortfall-disposition-loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortfall-disposition-loop.d.ts","sourceRoot":"","sources":["../src/shortfall-disposition-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3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C1C,0EAA0E;IAC1E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAgGD;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,YAAY,EACpB,YAAY,GAAE,OAAO,CAAC,wBAAwB,CAAM,GACnD,OAAO,CAAC,8BAA8B,CAAC,CAuIzC"}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped shortfall-disposition pass.
|
|
3
|
+
*
|
|
4
|
+
* A focus carrying an undisposed shortfall cannot converge: the completion gate
|
|
5
|
+
* (review-exit-phase) withholds done until every shortfall is ratified or
|
|
6
|
+
* dismissed. A hold with no self-heal is just a wedge, so this tick finds held
|
|
7
|
+
* focuses and arms a one-shot pass whose ONLY mandate is disposing them.
|
|
8
|
+
*
|
|
9
|
+
* WHY A TICK AND NOT THE REVIEW-EXIT PATH. The mandate covers shortfalls a
|
|
10
|
+
* review missed AND ones that arrived after the review window closed. A late
|
|
11
|
+
* arrival coincides with no review exit at all -- no handler runs to notice it --
|
|
12
|
+
* so arming from the exit path could only ever cover half the job. A tick sees a
|
|
13
|
+
* held focus whenever it becomes held, regardless of what held it.
|
|
14
|
+
*
|
|
15
|
+
* WHAT THIS PASS CAN AND CANNOT DO. It runs as a CODING session (a 'review'
|
|
16
|
+
* sessionType would re-enter the review-exit handler on exit and re-trigger the
|
|
17
|
+
* whole auto-approve evaluation -- a spawn loop). product-api refuses an agent
|
|
18
|
+
* shortfall-RATIFY unless it carries a review session, so this pass structurally
|
|
19
|
+
* cannot ratify. That is deliberate, not a limitation to work around: a pass
|
|
20
|
+
* that cannot lower a bar is a safe pass. It disposes the common case (the work
|
|
21
|
+
* fell short -> file defects + dismiss) and deliberately LEAVES a
|
|
22
|
+
* genuinely-wrong claim undisposed for a real review or an operator. The stall
|
|
23
|
+
* detector bounds that tail.
|
|
24
|
+
*
|
|
25
|
+
* Activation: opt-out via TELORA_SHORTFALL_DISPOSITION_LOOP=0. See
|
|
26
|
+
* `shouldRunLoop()` in focus-engine.ts.
|
|
27
|
+
*
|
|
28
|
+
* @module shortfall-disposition-loop
|
|
29
|
+
*/
|
|
30
|
+
import { withRetry, ESCALATION_REASONS, ESCALATION_DISPOSITIONS } from '@telora/daemon-core';
|
|
31
|
+
import { configForProduct } from './config.js';
|
|
32
|
+
import { getActiveFocuses } from './queries/deliveries.js';
|
|
33
|
+
import { listOpenShortfallProposalIds } from './queries/reality-tree.js';
|
|
34
|
+
import { setShortfallDispositionAttempts } from './queries/focuses.js';
|
|
35
|
+
import { createEscalation, hasOpenFocusEscalation } from './queries/issues.js';
|
|
36
|
+
import { getActiveTeams } from './focus-team-state.js';
|
|
37
|
+
import { hasPendingSpawnDirective, pendingSpawnDirectives, computeDirectiveHash, } from './directive/directive-queue.js';
|
|
38
|
+
import { assembleDirectiveContent } from './directive/directive-assembly.js';
|
|
39
|
+
import { resolveShortfallDispositionAttemptCap } from './shortfall-disposition-config.js';
|
|
40
|
+
import { createLogger } from './log.js';
|
|
41
|
+
const log = createLogger({ module: 'shortfall-disposition-loop' });
|
|
42
|
+
/**
|
|
43
|
+
* Declared daemon-locally, not imported from @telora/daemon-core's EscalationKind
|
|
44
|
+
* union. That union is registry-published and lags the DB CHECK by several
|
|
45
|
+
* values, so it cannot name this kind until a publish lands. The DB CHECK
|
|
46
|
+
* (20260715231941) is the real constraint. Same workaround stall-detectors.ts
|
|
47
|
+
* documents.
|
|
48
|
+
*/
|
|
49
|
+
const SHORTFALL_UNDISPOSED_KIND = 'shortfall_undisposed';
|
|
50
|
+
/**
|
|
51
|
+
* Deliberately narrow. The pass needs the shortfalls (with their ids, claims,
|
|
52
|
+
* and what reality showed -- all rendered by the resolver) and the diff that
|
|
53
|
+
* produced them. Nothing else: a wider recipe invites the pass to re-adjudicate
|
|
54
|
+
* work that is not its mandate.
|
|
55
|
+
*/
|
|
56
|
+
const SHORTFALL_DISPOSITION_ASSEMBLY = [
|
|
57
|
+
'drift.shortfall_proposals',
|
|
58
|
+
'git.diff_against_base',
|
|
59
|
+
];
|
|
60
|
+
/**
|
|
61
|
+
* The one-shot mandate. Pure + unit-testable.
|
|
62
|
+
*
|
|
63
|
+
* States the RULE only; the drift.shortfall_proposals resolver carries the DATA
|
|
64
|
+
* (ids, claims, both dispositions, the exact params). Duplicating the detail
|
|
65
|
+
* here would drift from the resolver.
|
|
66
|
+
*/
|
|
67
|
+
export function buildShortfallDispositionDirective() {
|
|
68
|
+
return {
|
|
69
|
+
execution: 'spawn',
|
|
70
|
+
compact: null,
|
|
71
|
+
assembly: [...SHORTFALL_DISPOSITION_ASSEMBLY],
|
|
72
|
+
tools: null,
|
|
73
|
+
prompt: [
|
|
74
|
+
'You are a scoped disposition pass. This focus cannot finish because it',
|
|
75
|
+
'carries shortfall drift proposals nobody has disposed. Disposing them is',
|
|
76
|
+
'your ONLY mandate -- do not review the code, do not refactor, do not pick',
|
|
77
|
+
'up other work.',
|
|
78
|
+
'',
|
|
79
|
+
'A shortfall says: the reality tree claimed something, and the work',
|
|
80
|
+
'delivered less than that claim. One of the two was wrong, and until',
|
|
81
|
+
'someone says which, no delivery on this focus can converge to done.',
|
|
82
|
+
'',
|
|
83
|
+
'The proposals awaiting you are listed in your context, each with its id,',
|
|
84
|
+
'the claim, and what reality showed. For EACH one:',
|
|
85
|
+
'',
|
|
86
|
+
'- **The WORK fell short** (the common case) -- file a defect issue on the',
|
|
87
|
+
' delivery that owns the gap (`telora_product_issue` action=create, type',
|
|
88
|
+
' Bug or Task, with a concrete title/description the coding team can act',
|
|
89
|
+
' on), THEN dismiss the proposal via `telora_reality_drift`',
|
|
90
|
+
' action=dismiss with a non-empty `reason` naming the issues you filed.',
|
|
91
|
+
' Dismissing REJECTS the proposed correction: the claim stands, and the',
|
|
92
|
+
' work is what changes. Filing the defect ALONE is not a disposition --',
|
|
93
|
+
' it leaves the proposal open and the focus stays wedged.',
|
|
94
|
+
'',
|
|
95
|
+
'- **The CLAIM was wrong** -- the tree asserted something it should never',
|
|
96
|
+
' have asserted. You CANNOT dispose this case: amending a claim requires',
|
|
97
|
+
' an independent review session, and you are not one. Do NOT dismiss it',
|
|
98
|
+
' to clear the queue -- dismissing asserts the claim stands, which would',
|
|
99
|
+
' be a false statement about reality. LEAVE IT UNDISPOSED and say so',
|
|
100
|
+
' plainly in your final message, naming the proposal id and why you',
|
|
101
|
+
' believe the claim is wrong. An operator will be escalated to.',
|
|
102
|
+
'',
|
|
103
|
+
'Never dismiss a proposal you have not actually understood. An unexplained',
|
|
104
|
+
'dismissal discards the signal the loop exists to carry, and the dismiss',
|
|
105
|
+
'rate is measured.',
|
|
106
|
+
].join('\n'),
|
|
107
|
+
model: null,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function defaultArmDirective(focusId, message, directive) {
|
|
111
|
+
pendingSpawnDirectives.set(focusId, {
|
|
112
|
+
message,
|
|
113
|
+
model: directive.model ?? null,
|
|
114
|
+
// Fixed-purpose one-shot: the focus's model selector must not override it.
|
|
115
|
+
focusOverrideModel: null,
|
|
116
|
+
// MUST be 'coding'. A 'review' sessionType re-enters runReviewExitHandler on
|
|
117
|
+
// exit and re-triggers the auto-approve evaluation -- a spawn loop. The
|
|
118
|
+
// close_loop bookkeeper sets 'coding' for exactly this reason.
|
|
119
|
+
sessionType: 'coding',
|
|
120
|
+
// Its own lineage slot: cannot resume or clobber the coder's or reviewer's
|
|
121
|
+
// context (session-lineage.ts:53-70).
|
|
122
|
+
lineage: 'shortfall_disposition',
|
|
123
|
+
continuity: 'fresh',
|
|
124
|
+
contentHash: computeDirectiveHash(directive),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function defaultDeps() {
|
|
128
|
+
return {
|
|
129
|
+
getActiveFocuses,
|
|
130
|
+
listOpenShortfallProposalIds,
|
|
131
|
+
hasActiveTeam: (focusId) => getActiveTeams().has(focusId),
|
|
132
|
+
hasPendingSpawnDirective,
|
|
133
|
+
assembleDirectiveContent,
|
|
134
|
+
armDirective: defaultArmDirective,
|
|
135
|
+
setShortfallDispositionAttempts,
|
|
136
|
+
hasOpenFocusEscalation,
|
|
137
|
+
createEscalation,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* File the one escalation that lets a human into this loop.
|
|
142
|
+
*
|
|
143
|
+
* Deduped per focus against the DB (not memory), so the bound holds across a
|
|
144
|
+
* daemon restart and a held focus accrues exactly one open escalation.
|
|
145
|
+
*/
|
|
146
|
+
async function escalateUndisposed(deps, params) {
|
|
147
|
+
if (await deps.hasOpenFocusEscalation(params.focusId, SHORTFALL_UNDISPOSED_KIND)) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
await withRetry(() => deps.createEscalation({
|
|
151
|
+
organizationId: params.organizationId,
|
|
152
|
+
sessionId: '',
|
|
153
|
+
issueId: null,
|
|
154
|
+
reasonType: ESCALATION_REASONS.BLOCKED_BY_EXTERNAL,
|
|
155
|
+
disposition: ESCALATION_DISPOSITIONS.NEEDS_OPERATOR,
|
|
156
|
+
anchor: { focusId: params.focusId },
|
|
157
|
+
escalationKind: SHORTFALL_UNDISPOSED_KIND,
|
|
158
|
+
description: `Focus "${params.focusName}" cannot finish: ${params.shortfallIds.length} shortfall ` +
|
|
159
|
+
`drift proposal(s) are still undisposed after ${params.attempts} disposition pass(es) ` +
|
|
160
|
+
`(cap ${params.cap}). Its deliveries are held in verify and the loop will not ` +
|
|
161
|
+
`converge on its own.\n\n` +
|
|
162
|
+
`**Focus:** ${params.focusName}\n` +
|
|
163
|
+
`**Focus ID:** ${params.focusId}\n` +
|
|
164
|
+
`**Undisposed proposals:** ${params.shortfallIds.join(', ')}\n\n` +
|
|
165
|
+
`A shortfall means the reality tree claimed something and the work delivered less ` +
|
|
166
|
+
`than that claim. One of the two is wrong, and the machine could not decide which.\n\n` +
|
|
167
|
+
`The likeliest cause is that the CLAIM is wrong: the disposition pass runs as a ` +
|
|
168
|
+
`coding session and CANNOT ratify (amending a claim requires an independent review ` +
|
|
169
|
+
`session), so it correctly left these alone rather than dismissing them falsely.`,
|
|
170
|
+
whatWasTried: `${params.attempts} scoped disposition pass(es) were armed. Each could file defects ` +
|
|
171
|
+
`and dismiss a proposal whose CLAIM stands, but none disposed these.`,
|
|
172
|
+
helpNeeded: `Decide, per proposal: if the CLAIM was wrong, ratify it (with a rationale) so the ` +
|
|
173
|
+
`tree amends; if the WORK fell short, dismiss it (with a reason) and ensure defect ` +
|
|
174
|
+
`issues exist so the delivery re-codes. Either disposition clears the hold.`,
|
|
175
|
+
metadata: {
|
|
176
|
+
cause: SHORTFALL_UNDISPOSED_KIND,
|
|
177
|
+
focusName: params.focusName,
|
|
178
|
+
shortfallProposalIds: params.shortfallIds,
|
|
179
|
+
attempts: params.attempts,
|
|
180
|
+
cap: params.cap,
|
|
181
|
+
},
|
|
182
|
+
}), { maxAttempts: 3, label: `escalation-shortfall-undisposed-${params.focusId}` });
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Run one disposition-pass tick across every product in the daemon config.
|
|
187
|
+
*
|
|
188
|
+
* Arms at most one directive per held focus per tick, and never while a team is
|
|
189
|
+
* running or a directive is already pending -- so a focus that stays held across
|
|
190
|
+
* ticks does not accumulate spawns. Per-focus failures are counted and skipped;
|
|
191
|
+
* one unresolvable focus must not stop the others.
|
|
192
|
+
*/
|
|
193
|
+
export async function runShortfallDispositionTick(config, depOverrides = {}) {
|
|
194
|
+
const deps = { ...defaultDeps(), ...depOverrides };
|
|
195
|
+
const cap = deps.cap ?? resolveShortfallDispositionAttemptCap();
|
|
196
|
+
const counts = {
|
|
197
|
+
productsScanned: 0,
|
|
198
|
+
focusesScanned: 0,
|
|
199
|
+
focusesHeld: 0,
|
|
200
|
+
armed: 0,
|
|
201
|
+
skippedBusy: 0,
|
|
202
|
+
escalated: 0,
|
|
203
|
+
countersReset: 0,
|
|
204
|
+
errors: 0,
|
|
205
|
+
};
|
|
206
|
+
for (const product of config.products) {
|
|
207
|
+
counts.productsScanned += 1;
|
|
208
|
+
const pc = configForProduct(config, product);
|
|
209
|
+
let focuses;
|
|
210
|
+
try {
|
|
211
|
+
focuses = await deps.getActiveFocuses(config.organizationId, product.id);
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
counts.errors += 1;
|
|
215
|
+
log.warn(`[shortfall-disposition] getActiveFocuses failed for product ${product.id}: ${err.message}`);
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
for (const focus of focuses) {
|
|
219
|
+
counts.focusesScanned += 1;
|
|
220
|
+
let shortfallIds;
|
|
221
|
+
try {
|
|
222
|
+
shortfallIds = await deps.listOpenShortfallProposalIds(focus.focus_id);
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
counts.errors += 1;
|
|
226
|
+
log.warn(`[shortfall-disposition] shortfall lookup failed for "${focus.focus_name}": ${err.message}`);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const attempts = focus.shortfall_disposition_attempts ?? 0;
|
|
230
|
+
if (shortfallIds.length === 0) {
|
|
231
|
+
// Cleared. Reset the budget so a later, unrelated shortfall gets a full
|
|
232
|
+
// set of attempts rather than inheriting an exhausted counter.
|
|
233
|
+
if (attempts > 0) {
|
|
234
|
+
try {
|
|
235
|
+
await deps.setShortfallDispositionAttempts(focus.focus_id, 0);
|
|
236
|
+
counts.countersReset += 1;
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
counts.errors += 1;
|
|
240
|
+
log.warn(`[shortfall-disposition] failed to reset attempts for "${focus.focus_name}": ${err.message}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
counts.focusesHeld += 1;
|
|
246
|
+
// The bound. Past the cap the machine has demonstrably failed to dispose
|
|
247
|
+
// these on its own, so stop arming (each pass costs a team) and hand it to
|
|
248
|
+
// an operator instead. The counter is DURABLE, so this survives restarts:
|
|
249
|
+
// an in-process counter would reset and re-arm forever, never escalating.
|
|
250
|
+
if (attempts >= cap) {
|
|
251
|
+
try {
|
|
252
|
+
if (await escalateUndisposed(deps, {
|
|
253
|
+
organizationId: config.organizationId,
|
|
254
|
+
focusId: focus.focus_id,
|
|
255
|
+
focusName: focus.focus_name,
|
|
256
|
+
shortfallIds,
|
|
257
|
+
attempts,
|
|
258
|
+
cap,
|
|
259
|
+
})) {
|
|
260
|
+
counts.escalated += 1;
|
|
261
|
+
log.info(`[shortfall-disposition] filed ${SHORTFALL_UNDISPOSED_KIND} for "${focus.focus_name}" ` +
|
|
262
|
+
`(${shortfallIds.length} undisposed after ${attempts} pass(es), cap ${cap})`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (err) {
|
|
266
|
+
counts.errors += 1;
|
|
267
|
+
log.warn(`[shortfall-disposition] failed to escalate for "${focus.focus_name}": ${err.message}`);
|
|
268
|
+
}
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
// A running team already has (or will get) the context; a pending
|
|
272
|
+
// directive is already queued for the spawner. Arming over either would
|
|
273
|
+
// duplicate work or clobber a queued handoff.
|
|
274
|
+
if (deps.hasActiveTeam(focus.focus_id) || deps.hasPendingSpawnDirective(focus.focus_id)) {
|
|
275
|
+
counts.skippedBusy += 1;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
const directive = buildShortfallDispositionDirective();
|
|
280
|
+
// No worktree path: the pass is armed between teams, so there is no live
|
|
281
|
+
// team to read one from. git.diff_against_base degrades to nothing
|
|
282
|
+
// rather than throwing (assembly sources fail soft), and the shortfall
|
|
283
|
+
// section -- the part that matters -- resolves regardless.
|
|
284
|
+
const message = await deps.assembleDirectiveContent(pc, focus.focus_id, directive, null);
|
|
285
|
+
deps.armDirective(focus.focus_id, message, directive);
|
|
286
|
+
counts.armed += 1;
|
|
287
|
+
// Count the attempt AFTER the arm succeeds -- an assembly failure is not
|
|
288
|
+
// an attempt, and charging for it would burn the budget without the pass
|
|
289
|
+
// ever running. Persisted before the next tick can read it, so the bound
|
|
290
|
+
// advances even if this process dies immediately after.
|
|
291
|
+
await deps.setShortfallDispositionAttempts(focus.focus_id, attempts + 1);
|
|
292
|
+
log.info(`[shortfall-disposition] armed a disposition pass for "${focus.focus_name}" ` +
|
|
293
|
+
`(attempt ${attempts + 1}/${cap}, ${shortfallIds.length} undisposed shortfall(s): ` +
|
|
294
|
+
`${shortfallIds.join(', ')})`);
|
|
295
|
+
}
|
|
296
|
+
catch (err) {
|
|
297
|
+
counts.errors += 1;
|
|
298
|
+
log.warn(`[shortfall-disposition] failed to arm for "${focus.focus_name}": ${err.message}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (counts.focusesHeld > 0 || counts.errors > 0) {
|
|
303
|
+
log.info(`[shortfall-disposition] tick: products=${counts.productsScanned} focuses=${counts.focusesScanned} ` +
|
|
304
|
+
`held=${counts.focusesHeld} armed=${counts.armed} skippedBusy=${counts.skippedBusy} ` +
|
|
305
|
+
`escalated=${counts.escalated} reset=${counts.countersReset} errors=${counts.errors}`);
|
|
306
|
+
}
|
|
307
|
+
return counts;
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=shortfall-disposition-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shortfall-disposition-loop.js","sourceRoot":"","sources":["../src/shortfall-disposition-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;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