@kognai/orchestrator-core 0.2.7 → 0.2.8

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.
@@ -68,6 +68,16 @@ class CodingAgent {
68
68
  delete task._escalateNext;
69
69
  (0, orchestrate_engine_1.log)(orchestrate_engine_1.c.magenta, ` ⤴ [ESCALATE] ${task.id}: prior ${escalation} → upgrading to ${model}`);
70
70
  }
71
+ // TICKET-349 (trigger fix): when the previous attempt was rejected for
72
+ // truncation by the supervisor (authoritative), force the multi-pass
73
+ // continuation loop on this attempt's generated file(s) — even if the coder's
74
+ // detectTruncation() heuristic thinks the file looks complete. The supervisor
75
+ // already determined it isn't. Consumed once here.
76
+ const forceContinuation = task._forceContinuation === true;
77
+ if (forceContinuation) {
78
+ delete task._forceContinuation;
79
+ (0, orchestrate_engine_1.log)(orchestrate_engine_1.c.magenta, ` ⤴ [ASSEMBLE] ${task.id}: prior TRUNCATION reject → forcing multi-pass continuation on this attempt`);
80
+ }
71
81
  (0, orchestrate_engine_1.log)(orchestrate_engine_1.c.gray, ` -> Using ${model} [${routingReason}]`);
72
82
  // B.12: Compress context before cloud calls to reduce token spend 70-80%
73
83
  if (provider === 'clawrouter' || provider === 'anthropic') {
@@ -331,7 +341,12 @@ Write ONLY the content for "${filepath}". Rules:
331
341
  // and a no-progress guard so it can never loop forever.
332
342
  const MAX_CONTINUATION_CHUNKS = parseInt(process.env.KOGNAI_MAX_CONTINUATION_CHUNKS ?? '5', 10);
333
343
  let chunk = 0;
334
- while (this.detectTruncation(fileContent) && chunk < MAX_CONTINUATION_CHUNKS) {
344
+ // TICKET-349 (trigger fix): fire on detectTruncation OR a forced first
345
+ // pass (set when the supervisor truncation-rejected the prior attempt).
346
+ // The forced pass only applies to chunk 0; after that the loop continues
347
+ // purely on detectTruncation, and the no-progress guard stops it if the
348
+ // file is actually complete (a continuation that adds nothing → break).
349
+ while ((this.detectTruncation(fileContent) || (forceContinuation && chunk === 0)) && chunk < MAX_CONTINUATION_CHUNKS) {
335
350
  chunk++;
336
351
  (0, orchestrate_engine_1.log)(orchestrate_engine_1.c.yellow, ` ! TRUNCATION in ${filepath} — continuation pass ${chunk}/${MAX_CONTINUATION_CHUNKS} (gateway ~4k output cap)...`);
337
352
  const continuationPrompt = `The previous response for "${filepath}" was TRUNCATED — it ended mid-function or with an incomplete block. Here is the tail of what exists so far:
@@ -915,6 +915,15 @@ ONLY output the JSON array. No markdown, no explanation.`;
915
915
  // escalation at typical token volumes — well under the daily wallet.
916
916
  // Cleared in CodingAgent.execute after consumption.
917
917
  task._escalateNext = 'TRUNCATION';
918
+ // TICKET-349 (trigger fix): the supervisor's truncation verdict is the
919
+ // AUTHORITATIVE "this file is incomplete" signal — stronger than the
920
+ // coder's detectTruncation() brace-heuristic, which lets balanced-but-
921
+ // incomplete files through (verified 2026-06-13: 0 continuation passes
922
+ // fired despite repeated truncation rejects). Force the coder's
923
+ // multi-pass continuation loop on the next attempt so it ASSEMBLES the
924
+ // file across passes instead of one-shot-regenerating (which re-truncates
925
+ // even on Sonnet). Consumed + cleared in CodingAgent.execute.
926
+ task._forceContinuation = true;
918
927
  }
919
928
  else if (task._integrityFailed) {
920
929
  (0, engine_primitives_1.log)(engine_primitives_1.c.yellow, `\n↻ Task ${task.id} REJECTED on attempt ${attempt} (${review.score}/100) [INTEGRITY-FAILED]`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kognai/orchestrator-core",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Kognai sovereign orchestrator — core engine (template-agnostic). Shared by all products (Kognai/coding, Voxight/market-intel, Invoica/fin-compliance); each supplies only its template. Replaces per-repo forks of orchestrate-agents-v2 / sprint-runner / lib.",
5
5
  "license": "MIT",
6
6
  "author": "SkinGem",