Skip to content

fix: resolve ZCE-6 F1-F4 concurrency and tool-summary defects with TLA+ specs - #18

Merged
kyomarshal merged 1 commit into
mainfrom
fix/zce6-formal-and-f1-f4
Nov 28, 2026
Merged

kyomarshal merged 1 commit into
mainfrom
fix/zce6-formal-and-f1-f4

Conversation

@KyoMio

@KyoMio KyoMio commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add TLA+ specifications, TLC configs, Mermaid statecharts, and line-level mapping in docs/formal/ for TurnRunnerQueue and PermissionGateToolSummary (ZCE-6).
  • Fix all 4 defects surfaced by formal modeling (F1–F4):
    • F1 (lib/runs.mjs, lib/run.mjs): Serialize stale lock reclamation via atomic .reclaim mutex with ENOENT vs dead .reclaim distinction, RECLAIM_STALE_MS = 5000 handoff guard, and ownership-verified releaseLockIfOwned.
    • F2 (lib/run.mjs): Track spawnPromise and close detached child process group via await clientRef?.close({ timeoutMs: 1500 }) on SIGINT/SIGTERM, guard queue/turn loops with signaled, and prevent double-cleanup in finally.
    • F3 (lib/tool-summary.mjs): Restrict inputOmitted backfill strictly to named tools (call.toolName && call.input === undefined && call.omitted).
    • F4 (lib/pending.mjs, lib/gate.mjs, lib/run.mjs): Add PENDING_ABORTED, abort(), and close() on pending gate, propagate PENDING_ABORTED cleanly past top-level catch, and reconnect after turn timeout (if (last.outcome === 'timeout') break).
  • Add regression tests in test/run.test.mjs, test/pending.test.mjs, and test/tool-summary.test.mjs.

Verification

  • npm test: 896/896 passing (sync-doc-version --check and check-boundaries.mjs green)
  • npm run verify: checkJs 0 errors across 7 target files
  • TLC model checking: 8/8 configs pass with 0 counterexamples (exit 0); 15/15 baseline & reverse mutations fail on expected invariants (exit 12)
  • Carbon R1 independent review: VERDICT: OK TO DELIVER

@kyomarshal
kyomarshal merged commit 6d503e0 into main Nov 28, 2026
3 checks passed
@kyomarshal
kyomarshal deleted the fix/zce6-formal-and-f1-f4 branch November 28, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants