pi-goal-list-loop-audit 0.26.5 → 0.26.6

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.
@@ -917,6 +917,8 @@ export function isAutoCommitPaused(cwd: string): boolean {
917
917
  /** Suppress the heartbeat when work shipped very recently — a session
918
918
  * that just committed is transitioning, not stalled. Pure; the tick
919
919
  * gathers the timestamps. */
920
+ /** @deprecated v0.26.6: no longer called by the heartbeat (self-sustaining
921
+ * under ledger writes / auto-commit daemons). Kept for API compatibility. */
920
922
  export function shouldSuppressHeartbeatForRecentShip(args: {
921
923
  nowMs: number;
922
924
  lastShippedAtMs: number | null;
@@ -930,6 +932,10 @@ export function shouldSuppressHeartbeatForRecentShip(args: {
930
932
  /** Best-effort "when did work last ship" for a repo: newest of the HEAD
931
933
  * commit time and the .pi-glla state file mtime. Null when unknown. */
932
934
  export function lastShippedAtMs(cwd: string): number | null {
935
+ // v0.26.6: the .pi-glla/active.jsonl MTIME term was REMOVED — the
936
+ // heartbeat's own ledger writes refreshed it every 15s, which made the
937
+ // 0.25.0 ship-suppression self-sustaining (darklord: 9.1h / 2,184
938
+ // suppressed ticks). Only a real git commit counts as a ship now.
933
939
  let best: number | null = null;
934
940
  try {
935
941
  const out = execSync("git log -1 --format=%ct", { cwd, stdio: ["ignore", "pipe", "ignore"] })
@@ -940,12 +946,6 @@ export function lastShippedAtMs(cwd: string): number | null {
940
946
  } catch {
941
947
  /* not a git repo or no commits */
942
948
  }
943
- try {
944
- const mtime = fs.statSync(path.join(cwd, ".pi-glla", "active.jsonl")).mtimeMs;
945
- if (best === null || mtime > best) best = mtime;
946
- } catch {
947
- /* no state file yet */
948
- }
949
949
  return best;
950
950
  }
951
951
 
@@ -38,7 +38,6 @@ import {
38
38
  classifyImpossibleReason,
39
39
  extractPendingTasks,
40
40
  isFullAuditObjective,
41
- lastShippedAtMs,
42
41
  resolveEffectiveAggressiveSettings,
43
42
  appendAuditLog,
44
43
  computeListDepth,
@@ -52,7 +51,6 @@ import {
52
51
  crossRecommendMode,
53
52
  formatListDepth,
54
53
  shouldEscalateStall,
55
- shouldSuppressHeartbeatForRecentShip,
56
54
  mergeSettings,
57
55
  parseListImport,
58
56
 
@@ -240,6 +238,10 @@ let heartbeatNudges = 0;
240
238
  // refire's own noteActivity, which is what made the hegemon zombie spin
241
239
  // self-sustaining (619 refires / 23.5h / zero turns).
242
240
  let consecutiveStalls = 0;
241
+ // v0.26.6: precise replacement for the removed ship-recency suppression —
242
+ // set while complete_goal's isolated audit runs, so the heartbeat never
243
+ // refires into an in-flight completion.
244
+ let completionAuditInFlight = false;
243
245
  let heartbeatTimer: NodeJS.Timeout | null = null;
244
246
 
245
247
  function noteActivity(real = false): void {
@@ -381,18 +383,16 @@ function heartbeatTick(): void {
381
383
  notifyExternal(ctx, msg);
382
384
  }
383
385
  if (!fire) return;
384
- // v0.25.0 (contract item 27): a session that SHIPPED in the last 5
385
- // minutes (commit or ledger write) is transitioning, not stalled
386
- // suppress the refire so rapid iteration isn't interrupted.
387
- if (
388
- shouldSuppressHeartbeatForRecentShip({
389
- nowMs: Date.now(),
390
- lastShippedAtMs: lastShippedAtMs(ctx.cwd),
391
- })
392
- ) {
393
- appendLedger(ctx.cwd, "heartbeat_suppressed", { reason: "recent ship (<5m)" });
394
- return;
395
- }
386
+ // v0.26.6: the 0.25.0 "recent ship (<5m)" suppression was REMOVED. It fed
387
+ // lastShippedAtMs, which read the state-file MTIME and the heartbeat's
388
+ // own suppressed-tick ledger writes refreshed that mtime every 15s,
389
+ // making the suppression self-sustaining forever (field-observed in
390
+ // darklord: 2,184 suppressed ticks over 9.1h after a post-compaction
391
+ // send failure; the completed list item never closed). Under an
392
+ // auto-committing daemon the git-head term self-sustains too. The legit
393
+ // windows are already covered precisely — busy mid-turn, pending
394
+ // messages, scheduled timers — plus the audit-in-flight flag below.
395
+ if (completionAuditInFlight) return;
396
396
  noteActivity();
397
397
  consecutiveStalls++;
398
398
  appendLedger(ctx.cwd, "heartbeat_refire", { nudgesSoFar: heartbeatNudges, consecutiveStalls });
@@ -1894,13 +1894,20 @@ function registerAgentTools(pi: any, ctx: ExtensionContext): void {
1894
1894
  // retry with backoff before we report "auditor infrastructure error
1895
1895
  // (retried once)". Neither attempt is a verdict on the work.
1896
1896
  const auditStartMs = Date.now();
1897
- const { result, retriedOnce } = await runWithInfraRetry(runAudit, {
1898
- onRetry: (err) => {
1899
- latestAuditProgress = { label: `infra error (${err.slice(0, 40)}) — retrying once`, lastEventAt: Date.now() };
1900
- refreshUI(ctx);
1901
- appendLedger(ctx.cwd, "audit_infra_retry", { goalId: state.goal?.id, error: err.slice(0, 200) });
1902
- },
1903
- });
1897
+ completionAuditInFlight = true;
1898
+ let result: Awaited<ReturnType<typeof runAudit>>;
1899
+ let retriedOnce = false;
1900
+ try {
1901
+ ({ result, retriedOnce } = await runWithInfraRetry(runAudit, {
1902
+ onRetry: (err) => {
1903
+ latestAuditProgress = { label: `infra error (${err.slice(0, 40)}) — retrying once`, lastEventAt: Date.now() };
1904
+ refreshUI(ctx);
1905
+ appendLedger(ctx.cwd, "audit_infra_retry", { goalId: state.goal?.id, error: err.slice(0, 200) });
1906
+ },
1907
+ }));
1908
+ } finally {
1909
+ completionAuditInFlight = false;
1910
+ }
1904
1911
  const auditDurationMs = Date.now() - auditStartMs;
1905
1912
  latestAuditProgress = null;
1906
1913
  // Audit history: record REAL verdicts only — a non-empty report is the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-goal-list-loop-audit",
3
- "version": "0.26.5",
3
+ "version": "0.26.6",
4
4
  "description": "Goal. Loop. Audit. Done. — a pi-coding-agent extension that supervises long-running work, with isolated auditor on each completion. Beat bamboozling by design: the auditor runs in a fresh session with no extensions, no skills, no editor — only the read tools needed to verify your goal.",
5
5
  "license": "MIT",
6
6
  "author": "dracon",