@ngockhoale/ukit 3.5.13 → 3.5.15

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.
@@ -330,6 +330,22 @@ export async function readRouteState(projectRoot, payload = {}) {
330
330
  return readSessionRouteState(projectRoot, sessionId);
331
331
  }
332
332
 
333
+ // Field #14 recovery: the session sidecar is missing, but the shared single-slot route file may still
334
+ // hold THIS session's task (unstamped by an older router, or re-stamped by a concurrent session that
335
+ // routed afterwards). The session ledger records the taskInstanceId it was opened under; a shared
336
+ // route carrying that exact id is the same task, so adopt it (in memory only) rather than declaring
337
+ // the route lost. Task ids are unique per route, so a different task is never adopted.
338
+ export async function recoverRouteStateFromLedger(projectRoot, payload = {}, ledger = {}) {
339
+ try {
340
+ const taskId = ledger?.taskInstanceId;
341
+ const sessionId = explicitSessionId(payload);
342
+ if (!taskId || !sessionId) return null;
343
+ const shared = await readJson(path.join(projectRoot, '.claude', 'ukit', 'skill-router-state.json'), null);
344
+ if (!shared || shared.routePublicationIncomplete || shared.taskInstanceId !== taskId) return null;
345
+ return { ...shared, sessionId };
346
+ } catch { return null; }
347
+ }
348
+
333
349
  export function ownerStopActive(state, payload = {}) {
334
350
  const control = state?.ownerControl;
335
351
  if (!control || control.kind !== 'stop') return false;
@@ -1042,6 +1058,56 @@ function maskedVerificationStage(command, depth = 0, options = {}) {
1042
1058
  return sawRunner ? null : text;
1043
1059
  }
1044
1060
 
1061
+ // Field telemetry #3 (2026-11-20): `runner > log 2>&1; echo "exit=$?"` and zsh
1062
+ // `runner | tail; echo "exit=${pipestatus[1]}"` were the top "unproven" storms. A status echoed
1063
+ // IMMEDIATELY after the runner IS the runner's status — the same proof OpenHands (PS1 `"exit_code": "$?"`)
1064
+ // and SWE-ReX (`echo $?` after each command) rely on. Accepted only when: the echo is the LAST unit, holds
1065
+ // exactly one status reference and no other expansion, the reference points at the single runner (bash
1066
+ // PIPESTATUS is 0-based, zsh pipestatus 1-based; `$?` only after a non-pipeline runner), the command before
1067
+ // the echo is itself unmasked, and the LAST stdout line is exactly the echo literal with a number. Anything
1068
+ // else returns null and the caller keeps the fail-closed "unproven" verdict.
1069
+ const STATUS_ECHO_RE = /^echo\s+(?:"([^"$`\\]*)(\$\?|\$\{\?\}|\$\{PIPESTATUS\[(\d)\]\}|\$\{pipestatus\[(\d)\]\})([^"$`\\]*)"|([^\s"'$`\\;|&<>()]*)(\$\?|\$\{\?\}|\$\{PIPESTATUS\[(\d)\]\}|\$\{pipestatus\[(\d)\]\})([^\s"'$`\\;|&<>()]*))$/;
1070
+ function bashStdoutText(response) {
1071
+ if (typeof response === 'string') return response;
1072
+ if (!response || typeof response !== 'object' || Array.isArray(response)) return '';
1073
+ for (const key of ['stdout', 'output', 'content']) if (typeof response[key] === 'string') return response[key];
1074
+ return '';
1075
+ }
1076
+ function printedRunnerStatus(command, toolResponse) {
1077
+ const text = String(command || '').trim();
1078
+ if (!text || /\n/.test(text) || executableSubstitutions(text).length) return null;
1079
+ const units = verificationShellUnits(text);
1080
+ if (!units || units.length < 2) return null;
1081
+ const echo = units[units.length - 1];
1082
+ const m = STATUS_ECHO_RE.exec(echo.text);
1083
+ if (!m || echo.separator) return null;
1084
+ const before = m[1] ?? m[6] ?? '';
1085
+ const ref = m[2] ?? m[7];
1086
+ const after = m[5] ?? m[10] ?? '';
1087
+ const bashIdx = m[3] ?? m[8];
1088
+ const zshIdx = m[4] ?? m[9];
1089
+ const end = units.length - 2;
1090
+ if (units[end].separator !== ';') return null;
1091
+ let start = end;
1092
+ while (start > 0 && (units[start - 1].separator === '|' || units[start - 1].separator === '|&')) start -= 1;
1093
+ let stage;
1094
+ if (bashIdx !== undefined) stage = Number(bashIdx);
1095
+ else if (zshIdx !== undefined) stage = Number(zshIdx) - 1;
1096
+ else if (ref === '$?' || ref === '${?}') stage = start === end ? 0 : -1;
1097
+ if (!(stage >= 0) || start + stage > end) return null;
1098
+ const runner = units[start + stage];
1099
+ if (!isVerificationCommand(runner.text)) return null;
1100
+ for (let i = start; i <= end; i += 1) if (i !== start + stage && isVerificationCommand(units[i].text)) return null;
1101
+ // The prefix plus the runner alone must already be an unmasked verification command.
1102
+ const head = [...units.slice(0, start).map((u) => `${u.text} ${u.separator}`), runner.text].join(' ');
1103
+ if (maskedVerificationStage(head) !== null) return null;
1104
+ const lines = bashStdoutText(toolResponse).replace(/\s+$/, '').split(/\r?\n/);
1105
+ const last = lines[lines.length - 1] ?? '';
1106
+ if (!last.startsWith(before) || !last.endsWith(after)) return null;
1107
+ const digits = last.slice(before.length, last.length - after.length);
1108
+ return /^\d{1,3}$/.test(digits) ? Number(digits) : null;
1109
+ }
1110
+
1045
1111
  // Announce through the in-proc hook emitter only (never fd 1 from library callers).
1046
1112
  // Host launch acknowledgement of a backgrounded Bash call (Claude Code: structured
1047
1113
  // `backgroundTaskId`, or the fixed "running in background" text). Structured field first.
@@ -1134,7 +1200,7 @@ function hostCompletionExit(transcriptPath, id) {
1134
1200
  // ANY notification, with or without an exit code, ends the pending state), memoized per (path, mtimeMs, size) so repeated Stop checks do not re-read the file.
1135
1201
  const HOST_SCAN_CACHE = [];
1136
1202
  function scanHostNotifications(transcriptPath) {
1137
- const empty = { notified: new Set(), exits: new Map() };
1203
+ const empty = { notified: new Set(), exits: new Map(), asyncAgents: new Map() };
1138
1204
  if (!transcriptPath) return empty;
1139
1205
  let st;
1140
1206
  try { st = fsSync.statSync(transcriptPath); } catch { return empty; }
@@ -1142,11 +1208,22 @@ function scanHostNotifications(transcriptPath) {
1142
1208
  if (hit) return hit.scan;
1143
1209
  let raw;
1144
1210
  try { raw = fsSync.readFileSync(transcriptPath, 'utf8'); } catch { return empty; }
1145
- const scan = { notified: new Set(), exits: new Map() };
1211
+ const scan = { notified: new Set(), exits: new Map(), asyncAgents: new Map() };
1146
1212
  for (const line of raw.split('\n')) {
1147
- if (!line.includes('<task-id>')) continue;
1213
+ const asyncLaunch = line.includes('"async_launched"');
1214
+ if (!asyncLaunch && !line.includes('<task-id>')) continue;
1148
1215
  let o;
1149
1216
  try { o = JSON.parse(line); } catch { continue; }
1217
+ // Field telemetry #1 (2026-11-20): Claude Code background subagents (`Agent` with run_in_background) are
1218
+ // host-written `toolUseResult: { isAsync, status: 'async_launched', agentId }` tool results, finished by the
1219
+ // same <task-notification> as a background shell. 149 of 487 Stop blocks fired while such an agent was still
1220
+ // running — blocking cannot produce its result, so it gets the same bounded WAIT as a background shell.
1221
+ const tur = o?.type === 'user' ? o.toolUseResult : null;
1222
+ if (asyncLaunch && tur && tur.isAsync === true && tur.status === 'async_launched'
1223
+ && typeof tur.agentId === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(tur.agentId)) {
1224
+ scan.asyncAgents.set(tur.agentId, Date.parse(o.timestamp) || 0);
1225
+ continue;
1226
+ }
1150
1227
  let text = null;
1151
1228
  if (o?.type === 'queue-operation' && o.operation === 'enqueue' && typeof o.content === 'string') text = o.content;
1152
1229
  else if (o?.type === 'user' && typeof o.message?.content === 'string') text = o.message.content;
@@ -2610,7 +2687,7 @@ function isPlaybookRead(file, playbookId) {
2610
2687
  * playbookId yields the not-applicable trace (no requirements) — the greeting /
2611
2688
  * informational shape.
2612
2689
  */
2613
- export function buildPlaybookTrace(ledger = {}, playbookId = null) {
2690
+ export function buildPlaybookTrace(ledger = {}, playbookId = null, priorTrace = null) {
2614
2691
  const id = playbookId || null;
2615
2692
  if (!id) {
2616
2693
  return {
@@ -2685,9 +2762,29 @@ export function buildPlaybookTrace(ledger = {}, playbookId = null) {
2685
2762
  stepsSkipped.push({ id: step.id, justification: PROPORTIONATE_JUSTIFICATION });
2686
2763
  }
2687
2764
  }
2765
+ // Monotone: the receipt window is capped (MAX_RECEIPTS), so a step proven earlier in the task may have
2766
+ // had its receipt evicted. A prior trace of the SAME playbook keeps its done steps/outputs (field #17:
2767
+ // false "missing: analog-search, verify" after long runs).
2768
+ let priorVerified = false;
2769
+ if (priorTrace && priorTrace.playbookId === id) {
2770
+ const have = new Set(stepsDone.map((step) => step.id));
2771
+ for (const done of Array.isArray(priorTrace.stepsDone) ? priorTrace.stepsDone : []) {
2772
+ if (done?.id && steps.some((step) => step.id === done.id) && !have.has(done.id)) {
2773
+ stepsDone.push(done);
2774
+ const at = stepsSkipped.findIndex((skip) => skip.id === done.id);
2775
+ if (at !== -1) stepsSkipped.splice(at, 1);
2776
+ }
2777
+ }
2778
+ stepsDone.sort((x, y) => steps.findIndex((st) => st.id === x.id) - steps.findIndex((st) => st.id === y.id));
2779
+ for (const out of Array.isArray(priorTrace.outputs) ? priorTrace.outputs : []) {
2780
+ if (typeof out === 'string' && !outputs.includes(out) && outputs.length < MAX_PLAYBOOK_OUTPUTS) outputs.push(out);
2781
+ }
2782
+ priorVerified = priorTrace.verification === 'passed';
2783
+ if (priorTrace.loaded === true) loaded = true;
2784
+ }
2688
2785
  const verification = steps.length === 0
2689
2786
  ? 'n/a'
2690
- : stepEvidence.has('post-verify') ? 'passed'
2787
+ : stepEvidence.has('post-verify') || priorVerified ? 'passed'
2691
2788
  : anyVerificationFailed ? 'failed'
2692
2789
  : 'pending';
2693
2790
  return {
@@ -3198,7 +3295,7 @@ function applyReceiptCore(ledger, receipt, { vibecode = false, projectRoot } = {
3198
3295
  // receipt (live and journaled replay alike) so the persisted record never
3199
3296
  // shows an evictable window. Only playbook-routed ledgers grow the field.
3200
3297
  if (next.playbookId) {
3201
- next.playbookTrace = buildPlaybookTrace(next, next.playbookId);
3298
+ next.playbookTrace = buildPlaybookTrace(next, next.playbookId, ledger?.playbookTrace);
3202
3299
  }
3203
3300
  next.updatedAt = Date.now();
3204
3301
  return { ledger: next, value: null };
@@ -3357,6 +3454,21 @@ function pendingBackgroundJob(ledger, { unreleasedOnly = false } = {}) {
3357
3454
  return null;
3358
3455
  }
3359
3456
 
3457
+ // A host background subagent launched during this task ledger and not yet finished (no task-notification).
3458
+ // Claude Code only (host-written transcript); other hosts return null and keep their existing behaviour.
3459
+ function pendingAsyncAgent(ledger, { unreleasedOnly = false } = {}) {
3460
+ if (!ledger?.transcriptPath) return null;
3461
+ const scan = scanHostNotifications(ledger.transcriptPath);
3462
+ const since = Number(ledger.startedAt) || 0;
3463
+ let latest = null;
3464
+ for (const [id, ts] of scan.asyncAgents) {
3465
+ if (scan.notified.has(id) || (since && ts && ts + 2000 < since)) continue;
3466
+ if (unreleasedOnly && (ledger.waitReleasedFor || []).includes(id)) continue;
3467
+ latest = id;
3468
+ }
3469
+ return latest;
3470
+ }
3471
+
3360
3472
  function liveBaseLedger(event, current, payload, routeState, harness, fallbackLedger, projectRoot = null) {
3361
3473
  if (current && routeState?.taskInstanceId && current.taskInstanceId !== routeState.taskInstanceId
3362
3474
  && routeState.predecessor && current.taskInstanceId === routeState.predecessor.predecessorTaskInstanceId) {
@@ -3851,6 +3963,14 @@ export async function recordExecutionReceipt({
3851
3963
  if (ledgerMessageEmitter) {
3852
3964
  try { ledgerMessageEmitter(`${JSON.stringify({ systemMessage: isOmpBackgroundId(receipt.backgroundTaskId) ? `UKit execution-ledger: UNSUPPORTED_EVIDENCE — omp job ${receipt.backgroundTaskId} has no exit status and cannot count as a pass; run the verification once in the foreground (async:false) for a native exit.` : `UKit execution-ledger: background verification ${receipt.backgroundTaskId || '(unknown id)'} is pending. Wait for the same job; do not launch a duplicate. After the host task-notification, Read its tasks/<id>.output through the final exit footer to ingest completion; Bash/grep does not ingest it.` })}\n`); } catch { /* advisory */ }
3853
3965
  }
3966
+ } else if (maskedStage && receipt.success && recognizedRunner
3967
+ && (exitCode === 0 || (exitCode === null && hostProvesCleanBashExit(harness, payload, toolResponse)))
3968
+ && printedRunnerStatus(toolInput.command, toolResponse) !== null) {
3969
+ // The wrapper exited cleanly AND printed the runner's own status as its last line.
3970
+ const printed = printedRunnerStatus(toolInput.command, toolResponse);
3971
+ receipt.exitCode = printed;
3972
+ receipt.exitProof = 'printed-status';
3973
+ receipt.success = printed === 0;
3854
3974
  } else if (maskedStage && receipt.success) {
3855
3975
  receipt.success = false;
3856
3976
  receipt.exitStatusUnproven = true;
@@ -5140,6 +5260,11 @@ function evaluateCompletionContract({ state = {}, ledger = {}, cwd, phase = null
5140
5260
  // At most ONE WAIT release per (task, job id): the CLI records it (`wait-released`), after which a job that
5141
5261
  // is still pending falls back to the normal gate (finite cap, pending-job wording, never an edit demand).
5142
5262
  const waitingOn = pendingBackgroundJob(effectiveLedger, { unreleasedOnly: true });
5263
+ const waitingAgent = waitingOn ? null : pendingAsyncAgent(effectiveLedger, { unreleasedOnly: true });
5264
+ if (waitingAgent) {
5265
+ return { continue: false, notify: true, complete: false, wait: true, outcome: 'waiting', waitingOn: waitingAgent, missingEvidence,
5266
+ reason: `UKit WAIT: a background subagent this task launched is still running. Blocking this Stop cannot produce its result, so it is released without spending continuation budget. Missing ${missingEvidence.join(', ')} until the subagent reports back; when its task-notification arrives, review its result, then run the verification yourself and continue. Do not launch a duplicate agent.` };
5267
+ }
5143
5268
  if (waitingOn) {
5144
5269
  return { continue: false, notify: true, complete: false, wait: true, outcome: 'waiting', waitingOn, missingEvidence,
5145
5270
  reason: `UKit WAIT: background job ${waitingOn} is pending. Wait for the same job; do not launch a duplicate. This Stop is released without spending continuation budget and without demanding an edit. Missing ${missingEvidence.join(', ')} until the host task-notification arrives; then Read tasks/${waitingOn}.output through the exit footer and continue with the next milestone (artifact verification, authorized deploy, live verification). Do not relaunch the job.` };
@@ -5389,7 +5514,7 @@ function playbookStopAdvisory({ state = {}, ledger = {}, cwd } = {}, result = {}
5389
5514
  if (!playbookId || playbookId === BUGFIX_PLAYBOOK_ID) return null;
5390
5515
  const effectiveLedger = effectiveRequestLedger(state, ledger, cwd);
5391
5516
  if (effectiveLedger.writeAttempted !== true) return null;
5392
- const trace = buildPlaybookTrace(effectiveLedger, playbookId);
5517
+ const trace = buildPlaybookTrace(effectiveLedger, playbookId, effectiveLedger.playbookTrace);
5393
5518
  const stepNote = playbookTraceMissingSteps(trace).length === 0 ? null
5394
5519
  : `UKit playbook note: ${formatPlaybookTrace(trace)} (advisory).`;
5395
5520
  // Round 5: a delegated feature run adds its acceptance verdict — advisory text only.
@@ -5654,6 +5779,31 @@ export async function reconcileStaleContract(projectRoot, state) {
5654
5779
  } catch { return state; }
5655
5780
  }
5656
5781
 
5782
+ // One advisory line per task for a semantic-contract invariant violation (marker under the seal cache dir).
5783
+ async function takeInvariantAdvisory(projectRoot, payload, state, diagnostic) {
5784
+ const id = state?.taskInstanceId || 'unknown';
5785
+ const file = path.join(path.dirname(sealPath(projectRoot, payload)), `invariant-advisory-${sessionIdentity(payload)}.json`);
5786
+ const seen = await readJson(file, {}) || {};
5787
+ try { process.stderr.write(`[ukit-completion] semantic contract invariant diagnostic (self-healed, stored contract kept): ${JSON.stringify(diagnostic)}\n`); } catch { /* advisory */ }
5788
+ if (seen[id]) return null;
5789
+ seen[id] = Date.now();
5790
+ await fs.mkdir(path.dirname(file), { recursive: true });
5791
+ await writeJsonAtomic(file, Object.fromEntries(Object.entries(seen).sort((x, y) => y[1] - x[1]).slice(0, SEAL_MAX)));
5792
+ return 'UKit note: internal semantic-contract check disagreed; continuing with the task\'s stored contract (no obligations dropped).';
5793
+ }
5794
+
5795
+ // The playbook note is advisory telemetry: show it at most once per task (marker beside the seal cache).
5796
+ async function takePlaybookNoteOnce(projectRoot, payload, state) {
5797
+ const id = state?.taskInstanceId || state?.requestKey || 'unknown';
5798
+ const file = path.join(path.dirname(sealPath(projectRoot, payload)), `playbook-note-${sessionIdentity(payload)}.json`);
5799
+ const seen = await readJson(file, {}) || {};
5800
+ if (seen[id]) return false;
5801
+ seen[id] = Date.now();
5802
+ await fs.mkdir(path.dirname(file), { recursive: true });
5803
+ await writeJsonAtomic(file, Object.fromEntries(Object.entries(seen).sort((x, y) => y[1] - x[1]).slice(0, SEAL_MAX)));
5804
+ return true;
5805
+ }
5806
+
5657
5807
  async function runEvaluateStop() {
5658
5808
  const projectRoot = process.env.CLAUDE_PROJECT_DIR || process.cwd();
5659
5809
  gitMemo = new Map();
@@ -5668,7 +5818,7 @@ async function runEvaluateStop() {
5668
5818
  // malformed payload starts blocking again.
5669
5819
  await resetGateCrashCounter(projectRoot);
5670
5820
 
5671
- const state = await readRouteState(projectRoot, payload);
5821
+ let state = await readRouteState(projectRoot, payload);
5672
5822
  const ledger = await readExecutionLedger(projectRoot, payload) || {};
5673
5823
  if (state?.routePublicationIncomplete) {
5674
5824
  process.stdout.write(`${JSON.stringify({ decision: 'block', reason: 'UKit route publication incomplete: shared state and session route do not match; completion is unproven.' })}\n`);
@@ -5681,6 +5831,9 @@ async function runEvaluateStop() {
5681
5831
  // ending silently there is indistinguishable from a mid-run stall. Surface the loss so the
5682
5832
  // user sees WHY the run released. Sessions that were never routed (no ledger activity at
5683
5833
  // all) stay silent: there is nothing to report (silent-success carve-out).
5834
+ if (!state) {
5835
+ state = await recoverRouteStateFromLedger(projectRoot, payload, ledger);
5836
+ }
5684
5837
  if (!state) {
5685
5838
  const hasActivity = ledger.sourceSucceeded || ledger.writeAttempted
5686
5839
  || ledger.verificationAttempted || (ledger.receipts || []).length > 0;
@@ -5696,11 +5849,20 @@ async function runEvaluateStop() {
5696
5849
  // never heals a contract classified by an older classifier. Reconcile it from the task's own
5697
5850
  // prompt at the gate boundary (in memory; the stored route state is left untouched).
5698
5851
  const reconciled = await reconcileStaleContract(projectRoot, state);
5852
+ // Invariant violation = internal nondeterminism (the router legitimately mutates the stored contract over a task),
5853
+ // never a reason to trap the user: evaluate with the STORED contract (reconcile keeps it untouched, so accumulated
5854
+ // obligations such as release-publication stay enforced), keep the diagnostic, and advise once per task.
5855
+ let advisory = null;
5699
5856
  if (reconciled.semanticDiagnostic?.status === 'invariant-violation') {
5700
- process.stdout.write(`${JSON.stringify({ decision: 'block', reason: `UKit semantic contract invariant violation: unchanged authoritative task/prompt/engine produced contradictory contracts. No new operation or publication obligation has been accepted. ${JSON.stringify(reconciled.semanticDiagnostic)}` })}\n`);
5701
- return;
5857
+ try { advisory = await takeInvariantAdvisory(projectRoot, payload, state, reconciled.semanticDiagnostic); } catch { advisory = null; }
5702
5858
  }
5859
+ const emit = (obj) => process.stdout.write(`${JSON.stringify(advisory && !obj.systemMessage ? { ...obj, systemMessage: advisory } : obj)}\n`);
5703
5860
  let result = evaluateCompletion({ state: reconciled, ledger, cwd: projectRoot, phase });
5861
+ if (result.playbookAdvisory) {
5862
+ let first = true;
5863
+ try { first = await takePlaybookNoteOnce(projectRoot, payload, state); } catch { first = true; }
5864
+ if (!first) { const { playbookAdvisory, ...rest } = result; result = rest; }
5865
+ }
5704
5866
  if (result.continue && result.missingEvidence?.includes('release-publication')) {
5705
5867
  const progress = await noteStopProgress(projectRoot, payload);
5706
5868
  if (progress?.value?.reentrant === true) {
@@ -5795,7 +5957,7 @@ async function runEvaluateStop() {
5795
5957
  // blocker.
5796
5958
  if (result.gateRelease === 'handback-delivered') {
5797
5959
  // The one handback for this state was already shown: no message, but never a silent success either.
5798
- process.stdout.write(`${JSON.stringify({ outcome: 'blocked', complete: false, gateRelease: 'handback-delivered' })}\n`);
5960
+ emit({ outcome: 'blocked', complete: false, gateRelease: 'handback-delivered' });
5799
5961
  return;
5800
5962
  }
5801
5963
  if (!result.continue && (result.outcome === 'handback' || result.capped === true)) {
@@ -5818,7 +5980,7 @@ async function runEvaluateStop() {
5818
5980
  reason: result.reason,
5819
5981
  });
5820
5982
  } catch { /* advisory */ }
5821
- process.stdout.write(`${JSON.stringify({ decision: 'block', reason: result.reason })}\n`);
5983
+ emit({ decision: 'block', reason: result.reason });
5822
5984
  return;
5823
5985
  }
5824
5986
  if (result.capped || result.notify) {
@@ -5828,24 +5990,24 @@ async function runEvaluateStop() {
5828
5990
  // single line (evaluator stdout is parsed first-line-wins by the stop coordinator).
5829
5991
  const message = result.playbookAdvisory ? `${result.reason} ${result.playbookAdvisory}` : result.reason;
5830
5992
  process.stderr.write(`[ukit-completion] ${result.reason}\n`);
5831
- process.stdout.write(`${JSON.stringify({ systemMessage: message,
5993
+ emit({ systemMessage: advisory ? `${message} ${advisory}` : message,
5832
5994
  ...(result.outcome === 'blocked' || result.outcome === 'handback' ? { outcome: 'blocked', complete: false } : {}),
5833
- })}\n`);
5995
+ });
5834
5996
  return;
5835
5997
  }
5836
5998
  if (result.complete) {
5837
5999
  // A satisfied route stays a silent success — unless the routed playbook has
5838
6000
  // steps missing, where the trace advisory IS the one-line release message.
5839
6001
  if (result.playbookAdvisory) {
5840
- process.stdout.write(`${JSON.stringify({ systemMessage: result.playbookAdvisory })}\n`);
5841
- }
6002
+ emit({ systemMessage: advisory ? `${result.playbookAdvisory} ${advisory}` : result.playbookAdvisory });
6003
+ } else if (advisory) emit({});
5842
6004
  return; // silent success: route present, all evidence satisfied
5843
6005
  }
5844
- if (result.gateRelease === 'no-routable-contract') return; // Advisory release, never VERIFIED.
6006
+ if (result.gateRelease === 'no-routable-contract') { if (advisory) emit({}); return; } // Advisory release, never VERIFIED.
5845
6007
  // Defensive final else: no evaluation result may ever end a routed stop silently.
5846
6008
  const fallback = `UKit completion gate: the stop was evaluated without a decision (missing evidence: ${(result.missingEvidence || []).join(', ') || 'none'}). If work is unfinished, re-send the task in a new message.`;
5847
6009
  process.stderr.write(`[ukit-completion] ${fallback}\n`);
5848
- process.stdout.write(`${JSON.stringify({ systemMessage: fallback })}\n`);
6010
+ emit({ systemMessage: fallback });
5849
6011
  }
5850
6012
 
5851
6013
  async function main() {
@@ -1463,6 +1463,32 @@ export function isVerbatimOutputCommand(command) {
1463
1463
  return false;
1464
1464
  }
1465
1465
 
1466
+ // Field telemetry #11 (2026-11-20): a numerically ranked cluster list (~50 lines) came back
1467
+ // reordered with its middle dropped — the line picker lifts "important" lines ahead of the
1468
+ // rest, which destroys the order a ranked/sorted table IS. rtk-ai/rtk (#582) reports the
1469
+ // same lesson: summarising content whose structure is the information costs more turns than
1470
+ // it saves. A count-ranked table (≥ 8 lines led by a number, ≥ 60% of lines, sorted
1471
+ // monotonically) up to RANKED_TABLE_MAX_TOKENS passes through raw. The configured
1472
+ // outputMaxTokens budget still governs every other output.
1473
+ const RANKED_TABLE_MAX_TOKENS = 6000;
1474
+ const RANKED_LINE_RE = /^\s*(\d+(?:\.\d+)?)(?:\s|[:|,x×]|$)/;
1475
+ export function isPassThroughOutput(text) {
1476
+ const lines = String(text ?? '').split('\n').filter((l) => l.trim());
1477
+ if (estimateTokenCount(String(text ?? '')) > RANKED_TABLE_MAX_TOKENS) return false;
1478
+ const nums = [];
1479
+ for (const line of lines) {
1480
+ const m = RANKED_LINE_RE.exec(stripAnsi(line));
1481
+ if (m) nums.push(Number(m[1]));
1482
+ }
1483
+ if (nums.length < 8 || nums.length < lines.length * 0.6) return false;
1484
+ let asc = true; let desc = true;
1485
+ for (let i = 1; i < nums.length; i += 1) {
1486
+ if (nums[i] < nums[i - 1]) asc = false;
1487
+ if (nums[i] > nums[i - 1]) desc = false;
1488
+ }
1489
+ return asc || desc;
1490
+ }
1491
+
1466
1492
  function mergeDeep(base, override) {
1467
1493
  if (!override || typeof override !== 'object' || Array.isArray(override)) {
1468
1494
  return override === undefined ? base : override;
@@ -1558,7 +1584,8 @@ async function main() {
1558
1584
  }
1559
1585
 
1560
1586
  // 3.5.11: content reads, bounded pipelines and chained commands pass through raw.
1561
- if (isVerbatimOutputCommand(command)) {
1587
+ // 3.5.14 (#11): count-ranked tables pass through raw (their order is the content).
1588
+ if (isVerbatimOutputCommand(command) || isPassThroughOutput(stdout)) {
1562
1589
  process.exit(0);
1563
1590
  return;
1564
1591
  }
@@ -1,6 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import fsSync from 'node:fs';
3
3
  import path from 'node:path';
4
+ import os from 'node:os';
4
5
  import { spawnSync } from 'node:child_process';
5
6
 
6
7
  export const DEFAULT_SAFE_PATCH_CONFIG = {
@@ -80,6 +81,26 @@ export function resolveProjectFile(projectRoot, filePath) {
80
81
  };
81
82
  }
82
83
 
84
+ function osTempRoots() {
85
+ const roots = ['/tmp', '/private/tmp', os.tmpdir(), process.env.TMPDIR].filter(Boolean);
86
+ for (const r of [...roots]) { try { roots.push(fsSync.realpathSync(r)); } catch { /* absent root */ } }
87
+ return [...new Set(roots.map((r) => path.resolve(r)))].filter((r) => r !== path.parse(r).root);
88
+ }
89
+
90
+ /** True when an absolute target lies strictly inside an OS temp dir (scratch files; never project scope). */
91
+ export function isOsTempPath(filePath, projectRoot) {
92
+ const raw = String(filePath || '').trim();
93
+ if (!raw || !path.isAbsolute(raw)) return false;
94
+ const candidates = [path.resolve(raw), realpathNearest(path.resolve(raw))].filter(Boolean);
95
+ // A project that itself lives inside a temp root (sandboxes) gets no exemption for that root.
96
+ const home = projectRoot ? [path.resolve(projectRoot), realpathNearest(path.resolve(projectRoot))].filter(Boolean) : [];
97
+ const insideRoot = (c, root) => { const rel = path.relative(root, c); return rel && !rel.startsWith('..') && !path.isAbsolute(rel); };
98
+ return candidates.some((c) => osTempRoots().filter((root) => !home.some((h) => insideRoot(h, root) || h === root)).some((root) => {
99
+ const rel = path.relative(root, c);
100
+ return rel && !rel.startsWith('..') && !path.isAbsolute(rel);
101
+ }));
102
+ }
103
+
83
104
  function realpathNearest(absolute) {
84
105
  // Real path of the deepest existing ancestor + the not-yet-existing tail, so a Write
85
106
  // that creates a new file is judged by where it would actually land (symlinks resolved).
@@ -145,6 +166,7 @@ export function resolveEditTarget(projectRoot, filePath) {
145
166
  };
146
167
  }
147
168
  }
169
+ if (isOsTempPath(filePath, root)) error.osTemp = true;
148
170
  throw error;
149
171
  }
150
172
  }
@@ -112,7 +112,22 @@ function writeDecisionLine(payload) {
112
112
  * Emit the fixed fail-closed block for the deadline path, exactly once, synchronously.
113
113
  * Exported so the deadline behaviour is directly testable.
114
114
  */
115
+ // Field telemetry #2 (2026-11-20): a reentrant Stop (`stop_hook_active: true` — the host already continued
116
+ // the turn once for a Stop block) whose fail-closed evaluator fails or overruns AGAIN cannot be helped by a
117
+ // second block: the infrastructure, not the task, is failing. Claude Code's own default for a failed or
118
+ // timed-out hook is non-blocking. The FIRST failure still blocks fail-closed; the repeat releases with a
119
+ // visible "not verified" advisory (outcome blocked, never complete). Set from main() before evaluation.
120
+ let reentrantStop = false;
121
+ export function setReentrantStop(value) { reentrantStop = value === true; }
122
+ export function infrastructureReleaseReason() {
123
+ return 'UKit stop coordinator: the completion evaluator failed or ran out of time again on a re-entered stop, so this stop is released WITHOUT verification (not complete — completion is unproven). This is usually a busy machine or slow disk; tell the user the task state is unverified. Only if this repeats across turns, run: ukit install.';
124
+ }
125
+ function emitReentrantInfrastructureRelease() {
126
+ return writeDecisionLine({ systemMessage: infrastructureReleaseReason(), policyOwner: 'fail-closed', outcome: 'blocked', complete: false });
127
+ }
128
+
115
129
  export function emitDeadlineBlock() {
130
+ if (reentrantStop) return emitReentrantInfrastructureRelease();
116
131
  return writeDecisionLine({
117
132
  decision: 'block',
118
133
  reason: redactDeadlineReason(),
@@ -3254,6 +3269,21 @@ export async function runStopCoordinator({
3254
3269
  } catch {
3255
3270
  ownership = { status: 'UNKNOWN', reason: 'handoff provenance runtime unavailable' };
3256
3271
  }
3272
+ // Field-telemetry #5 (2026-11-20): an UNKNOWN ownership beside a terminal
3273
+ // cursor (`Phase: done`, not paused) has no run to protect. Emitting "report
3274
+ // BLOCKED and reconcile provenance" on every stop there produced ~2,500
3275
+ // advisories (BAGuide 1,680, CKit 283) and marked healthy stops BLOCKED.
3276
+ // OWNED cursors still go through evaluateHandoffCursor (ExitPredicate); only
3277
+ // the UNKNOWN advisory/blockedOutcome lane is quieted.
3278
+ if (ownership.status === 'UNKNOWN' && ownership.reason !== 'run cursor absent') {
3279
+ try {
3280
+ const cursorText = await fs.readFile(path.join(runRoot, 'docs/AI_HANDOFF/RUN.md'), 'utf8');
3281
+ const phase = /^Phase:\s*(\S+)/im.exec(cursorText)?.[1]?.toLowerCase();
3282
+ if (phase === 'done' && !/^Paused:\s*yes\b/im.test(cursorText)) {
3283
+ ownership = { status: 'NOT_OWNED', reason: 'terminal run cursor (Phase: done)' };
3284
+ }
3285
+ } catch { /* unreadable cursor keeps the strict UNKNOWN lane */ }
3286
+ }
3257
3287
  if (ownership.reason === 'run cursor absent') {
3258
3288
  try {
3259
3289
  const watchdogRuntime = await import('./task-watchdog.mjs');
@@ -3453,9 +3483,14 @@ async function main() {
3453
3483
  } catch {
3454
3484
  payload = {}; // malformed payload: forward the raw text to the ledger, which owns crash counting
3455
3485
  }
3486
+ setReentrantStop(payload?.stop_hook_active === true);
3456
3487
  const projectRoot = process.env.CLAUDE_PROJECT_DIR || payload?.cwd || process.cwd();
3457
3488
  const { skip, merged } = await runStopCoordinator({ projectRoot, payload, rawInput, now: Date.now() });
3458
3489
  if (skip || !merged) return;
3490
+ if (merged.decision === 'block' && merged.policyOwner === 'fail-closed' && reentrantStop) {
3491
+ emitReentrantInfrastructureRelease();
3492
+ return;
3493
+ }
3459
3494
 
3460
3495
  // Synchronous writes through the shared emission gate: the deadline timer can fire
3461
3496
  // between any two turns of the event loop, and an already-written decision must never
@@ -3540,6 +3575,7 @@ if (isDirectRun()) {
3540
3575
  main().catch((error) => {
3541
3576
  // Last-resort failure INSIDE the coordinator: still fail-closed, still redacted.
3542
3577
  process.stderr.write(`[ukit-stop-coordinator] ${error?.message || error}\n`);
3578
+ if (reentrantStop) { emitReentrantInfrastructureRelease(); return; }
3543
3579
  writeDecisionLine({ decision: 'block', reason: redactInfrastructureReason(), policyOwner: 'fail-closed' });
3544
3580
  });
3545
3581
  }
@@ -134,7 +134,7 @@ memory:
134
134
  # edit any value here and `ukit update` keeps it. The legacy shipped 350000 is migrated
135
135
  # only when UKit's install ledger proves UKit wrote it; `ukit uninstall` reverts just
136
136
  # UKit's own additions and keeps your edits. Auto-compact must still trigger BEFORE
137
- # context-hardcap-gate blocks tool calls.
137
+ # context-hardcap-gate emits its (non-blocking) advisory.
138
138
  compaction:
139
139
  enabled: true
140
140
  thresholdTokens: {{omp.compactionThresholdTokens}}
@@ -35,7 +35,7 @@
35
35
 
36
36
  ## Long-Run Continuity
37
37
  <!-- RULES: LONG-01 LONG-02 -->
38
- - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest to `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents. Then compact.
38
+ - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest to `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents, then **keep working** — never end the turn just to ask the user for `/compact`; the host auto-compacts and work resumes from disk.
39
39
  - After compact/handoff: continue from persisted disk state — never reread pre-compact context; delegate broadly, keep replies short.
40
40
  - A run ends only on completion evidence, a genuine blocker, or a user-only action — every stop names its reason.
41
41
 
@@ -35,7 +35,7 @@
35
35
 
36
36
  ## Long-Run Continuity
37
37
  <!-- RULES: LONG-01 LONG-02 -->
38
- - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest to `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents. Then compact.
38
+ - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest to `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents, then **keep working** — never end the turn just to ask the user for `/compact`; the host auto-compacts and work resumes from disk.
39
39
  - After compact/handoff: continue from persisted disk state — never reread pre-compact context; delegate broadly, keep replies short.
40
40
  - A run ends only on completion evidence, a genuine blocker, or a user-only action — every stop names its reason.
41
41
 
@@ -82,7 +82,7 @@ Next: <bước kế tiếp chính xác>
82
82
  - Subagent ghi **full log vào task file trên đĩa**, chỉ trả về orchestrator ≤10 dòng (executor) / ≤6 dòng (reviewer). Paste log ngược lại orchestrator là nguyên nhân số 1 làm run chết vì hết context.
83
83
  - Hết mỗi wave: commit, ghi cursor, **collapse** wave đó còn 1 dòng/task trong bộ nhớ làm việc, rồi chạy tiếp.
84
84
  - Yêu cầu `/compact` **chỉ** được đặt ở cuối command, giữa 2 cycle. Giữa cycle thì tuyệt đối không — state đã nằm hết ở git + `INDEX.md` + `RUN.md` nên compact ở ranh giới cycle không mất gì.
85
- - Vượt `compact.hardCapTokens` (mặc định 235k, trong `compact.contextWindowTokens` 250k) mà `RUN.md` còn run dở **hoặc ordinary routed task có session execution ledger còn thiếu completion evidence**: `context-hardcap-gate` cho thêm `compact.hardCapGraceCalls` (mặc định 10) tool call rồi mới chặn cứng. **Grace đó chỉ để hạ cánh** — hoàn tất edit/verification đang dở và ghi state resume; không mở task mới, không đọc thêm file, không spawn agent. Hết grace là chặn thật; budget chỉ reset khi ước lượng token thực sự giảm (có compact thật), không reset theo wave.
85
+ - Vượt `compact.hardCapTokens` (mặc định 235k, trong `compact.contextWindowTokens` 250k) : `context-hardcap-gate` KHÔNG BAO GIỜ chặn tool, chỉ phát một advisory mỗi cooldown. Compaction chỉ là lời nhắc: hạ cánh bước hiện tại, ghi các bước còn lại vào `docs/STATUS.md`, giao việc đọc rộng cho subagent, rồi tiếp tục làm; host tự auto-compact và việc resume từ disk (`RUN.md`/`docs/STATUS.md`).
86
86
  - Không hook nào gọi được `/compact` — đó là lệnh client-only. Nhưng từ 2.1.3, settings mặc định đặt `env.CLAUDE_CODE_AUTO_COMPACT_WINDOW` = `autoCompactWindowRatio` × `hardCapTokens` (mặc định 0.8 × 235k = 188000) và `env.CLAUDE_CODE_MAX_CONTEXT_TOKENS` = `contextWindowTokens` (250000), render lúc install, nên **client tự auto-compact trước khi gate chặn**. Đường thường: auto-compact chạy → `handoff-resume.sh` replay cursor cho handoff run hoặc tiêu thụ resume intent cho ordinary task → chạy tiếp, không cần người gõ gì. Grace window ở trên chỉ còn là lưới an toàn.
87
87
  - Sửa một trong hai số đó thì phải giữ `autoCompactWindow < hardCapTokens`. Đảo thứ tự là deadlock: gate chặn tool trước → transcript ngừng lớn → ngưỡng auto-compact không bao giờ tới. `tests/core/autoCompactWindow.test.js` khóa bất biến này.
88
88
 
@@ -32,7 +32,7 @@
32
32
 
33
33
  ## Long-Run Continuity
34
34
  <!-- RULES: LONG-01 LONG-02 -->
35
- - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest to `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents. Then compact.
35
+ - Near token-cap: **LAND one thing** end-to-end (edit + verify, ≤3 tool calls), **DEFER** the rest to `docs/STATUS.md` or bounded `docs/AI_HANDOFF/` tasks, **DELEGATE** broad work to subagents, then **keep working** — never end the turn just to ask the user for `/compact`; the host auto-compacts and work resumes from disk.
36
36
  - After compact/handoff: continue from persisted disk state — never reread pre-compact context; delegate broadly, keep replies short.
37
37
  - A run ends only on completion evidence, a genuine blocker, or a user-only action — every stop names its reason.
38
38
 
@@ -683,9 +683,9 @@
683
683
  "enabled": "B\u1eadt/t\u1eaft to\u00e0n b\u1ed9 helper compact c\u1ee7a UKit.",
684
684
  "tokenThreshold": "Ng\u01b0\u1ee1ng token chung cho runtime compact d\u00f9ng chung.",
685
685
  "contextWindowTokens": "Context window t\u1ed1i \u0111a UKit cho client d\u00f9ng (m\u1eb7c \u0111\u1ecbnh 250000, k\u1ec3 c\u1ea3 khi provider h\u1ed7 tr\u1ee3 1M). Render th\u00e0nh env.CLAUDE_CODE_MAX_CONTEXT_TOKENS \u2014 model alias gateway nh\u01b0 unic-opus kh\u00f4ng c\u00f3 trong b\u1ea3ng c\u1ee7a Claude Code n\u00ean n\u1ebfu thi\u1ebfu s\u1ed1 n\u00e0y client t\u1ef1 \u0111o\u00e1n 200k/1M v\u00e0 b\u1ecf qua budget UKit. Kh\u00f4ng khuy\u1ebfn kh\u00edch t\u0103ng.",
686
- "hardCapTokens": "Ng\u01b0\u1ee1ng c\u1ee9ng tuy\u1ec7t \u0111\u1ed1i (m\u1eb7c \u0111\u1ecbnh 235000 token \u01b0\u1edbc l\u01b0\u1ee3ng, n\u1eb1m trong contextWindowTokens 250000). Ch\u1ea1m/v\u01b0\u1ee3t ng\u01b0\u1ee1ng n\u00e0y th\u00ec context-hardcap-gate ch\u1eb7n Edit/Write/Bash \u2014 kh\u00f4ng ph\u1ea3i g\u1ee3i \u00fd n\u1eefa, l\u00e0 b\u1eaft bu\u1ed9c. Ph\u1ea3i \u2264 contextWindowTokens. env.CLAUDE_CODE_AUTO_COMPACT_WINDOW (.claude/settings.json) v\u00e0 compaction.thresholdTokens (.omp/config.yml) \u0111\u1ec1u \u0111\u01b0\u1ee3c SUY RA t\u1eeb s\u1ed1 n\u00e0y khi ch\u1ea1y ukit install.",
687
- "autoCompactWindowRatio": "Auto-compact ch\u1ea1y \u1edf bao nhi\u00eau ph\u1ea7n c\u1ee7a hardCapTokens (m\u1eb7c \u0111\u1ecbnh 0.8 \u2192 188000). Ph\u1ea3i < 1 \u0111\u1ec3 client t\u1ef1 compact TR\u01af\u1edaC khi context-hardcap-gate ch\u1eb7n tool; s\u1ed1 c\u00e0ng nh\u1ecf th\u00ec compact c\u00e0ng s\u1edbm.",
688
- "hardCapBlock": "N\u1ebfu true, hook context-hardcap-gate ch\u1eb7n c\u1ee9ng Edit/Write/Bash (exit 2) khi v\u01b0\u1ee3t hardCapTokens, cho t\u1edbi khi c\u00f3 compact th\u1eadt (PreCompact) reset l\u1ea1i b\u1ed9 \u0111\u1ebfm.",
686
+ "hardCapTokens": "Ng\u01b0\u1ee1ng c\u1ee9ng tuy\u1ec7t \u0111\u1ed1i (m\u1eb7c \u0111\u1ecbnh 235000 token \u01b0\u1edbc l\u01b0\u1ee3ng, n\u1eb1m trong contextWindowTokens 250000). Ch\u1ea1m/v\u01b0\u1ee3t ng\u01b0\u1ee1ng n\u00e0y th\u00ec context-hardcap-gate ch\u1ec9 nh\u1eafc (advisory, kh\u00f4ng bao gi\u1edd ch\u1eb7n tool); host t\u1ef1 auto-compact. Ph\u1ea3i \u2264 contextWindowTokens. env.CLAUDE_CODE_AUTO_COMPACT_WINDOW (.claude/settings.json) v\u00e0 compaction.thresholdTokens (.omp/config.yml) \u0111\u1ec1u \u0111\u01b0\u1ee3c SUY RA t\u1eeb s\u1ed1 n\u00e0y khi ch\u1ea1y ukit install.",
687
+ "autoCompactWindowRatio": "Auto-compact ch\u1ea1y \u1edf bao nhi\u00eau ph\u1ea7n c\u1ee7a hardCapTokens (m\u1eb7c \u0111\u1ecbnh 0.8 \u2192 188000). Ph\u1ea3i < 1 \u0111\u1ec3 client t\u1ef1 compact TR\u01af\u1edaC khi context-hardcap-gate nh\u1eafc; s\u1ed1 c\u00e0ng nh\u1ecf th\u00ec compact c\u00e0ng s\u1edbm.",
688
+ "hardCapBlock": "N\u1ebfu true, hook context-hardcap-gate nh\u1eafc (advisory systemMessage, kh\u00f4ng bao gi\u1edd ch\u1eb7n/exit 2) m\u1ed9t l\u1ea7n m\u1ed7i cooldown khi v\u01b0\u1ee3t hardCapTokens; false = t\u1eaft nh\u1eafc.",
689
689
  "hardCapGraceCalls": "S\u1ed1 tool call \u0111\u01b0\u1ee3c ph\u00e9p ch\u1ea1y ti\u1ebfp sau khi v\u01b0\u1ee3t hardCapTokens khi handoff run trong docs/AI_HANDOFF/RUN.md ho\u1eb7c ordinary routed task c\u00f3 session execution ledger c\u00f2n dang d\u1edf (m\u1eb7c \u0111\u1ecbnh 10). \u0110\u00e2y ch\u1ec9 l\u00e0 landing window: ho\u00e0n t\u1ea5t edit/verification \u0111ang d\u1edf v\u00e0 ghi state resume, kh\u00f4ng m\u1edf task m\u1edbi. H\u1ebft grace l\u00e0 ch\u1eb7n c\u1ee9ng nh\u01b0 c\u0169. Budget t\u00ednh theo m\u1ed7i \u0111\u1ee3t v\u01b0\u1ee3t cap, ch\u1ec9 reset khi \u01b0\u1edbc l\u01b0\u1ee3ng token th\u1eadt s\u1ef1 gi\u1ea3m (c\u00f3 compact th\u1eadt) \u2014 kh\u00f4ng reset theo wave.",
690
690
  "contextRotDetection": "Ph\u00e1t hi\u1ec7n context qu\u00e1 d\u00e0i/d\u1ec5 m\u1ee5c \u0111\u1ec3 gi\u1eef l\u1ea1i state quan tr\u1ecdng tr\u01b0\u1edbc khi AI nh\u1edb sai.",
691
691
  "askBeforeDrop": "Gi\u1eef th\u00e1i \u0111\u1ed9 th\u1eadn tr\u1ecdng tr\u01b0\u1edbc khi b\u1ecf context quan tr\u1ecdng. N\u1ebfu r\u1ee7i ro th\u00ec hand back cho main model.",