Skip to content

fix(control): self-heal invalid native helper pairs - #90

Draft
LogicDuke wants to merge 2 commits into
repair/pr84-f1-control-anchor-ownerfrom
repair/pr85-helper-lifecycle-reconstruction
Draft

fix(control): self-heal invalid native helper pairs#90
LogicDuke wants to merge 2 commits into
repair/pr84-f1-control-anchor-ownerfrom
repair/pr85-helper-lifecycle-reconstruction

Conversation

@LogicDuke

@LogicDuke LogicDuke commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Final coherent D062 helper-lifecycle reconstruction for PR #85.

Evidence refreshed for exact head 134b513 (see "Current exact state"
below). The earlier "First reconstruction commit" block is retained as history
and is superseded by the canonicalization commit.

Current exact state (authoritative)

  • base: aaa7ddc4b625ca4aa5d192585daa4ce824a72be6
  • head: 134b513e15a056d037cc51b794d72c1a9891a4b4
  • PR commits: 2
  • cumulative changed files: 7
    (.github/workflows/ci.yml, package.json, and the five files of the latest
    repair commit below)
  • exact-head CI: CI #279, run ID 34122017059, head 134b513…, SUCCESS
  • state: OPEN / Draft / unmerged

Latest mechanism-repair commit (canonical provenance)

  • commit: 134b513e15a056d037cc51b794d72c1a9891a4b4
  • parent: aa2ae22bc4090195e03c39bb96b6bc50e62616d1
  • subject: fix(control): canonicalize helper provenance lifecycle
  • patch SHA256: BD63236A244AD3E538652C71EFCCAB61190708716799E49E55BDBE445DD03AF2
  • patch bytes: 39063
  • files (5):
    • tools/control-owner/provenance-format.mjs
    • tools/control-owner/build.mjs
    • tools/control-owner/ensure-helper.mjs
    • tools/control-owner/ensure-helper.d.mts
    • tests/control/launch-lifecycle.test.ts

Note: the 7 cumulative PR changed files are NOT the latest repair commit's
validated five-file patch — .github/workflows/ci.yml and package.json were
changed by the first reconstruction commit and are unchanged by 134b513.

Finding status

Codex "Reject truncated provenance modules"

  • original classification: CURRENT / P2 at aa2ae22…
  • current classification at 134b513…: FIXED
  • evidence: canonical whole-file byte equality replaced regex/field-extraction
    acceptance; the exact truncated-module witness is now INVALID → rebuild/
    self-heal; the real Windows supported path self-heals; fresh independent
    validation passed; exact-head CI #279 SUCCESS.
  • The existing GitHub review thread is OUTDATED but remains unresolved; it is
    intentionally not resolved or replied to in this evidence-refresh step.

Fresh independent validation (at 134b513)

  • PASS_PR90_CANONICAL_PROVENANCE_FRESH_INDEPENDENT_VALIDATION
  • lifecycle representation: FALSE_VALID_SET == EMPTY (accepted set is the
    singleton encodeProvenance(SHA256(helper))), proven by exhaustive truncation
    at every byte offset and exhaustive single-byte mutation, plus duplicate/extra/
    format variants;
  • exact Codex truncated-provenance witness → INVALID → rebuild/self-heal;
  • duplicate-field witness → INVALID → rebuild/self-heal;
  • the canonical provenance bytes are exactly the ES module the unchanged runtime
    imports (format factored out verbatim), so LIFECYCLE_VALID ⇒ runtime-consumable;
  • protected authority/runtime files unchanged (src/control/control-store.ts,
    src/control/control-runtime.ts, agentbridge-win-owner.c, and the six D062
    files) — 0-diff;
  • full suite: 2054 passed / 1 skipped;
  • typecheck PASS; lint PASS; build PASS; git diff --check PASS.

Mechanism invariant (circuit-breaker record)

This was the final permitted predicate redesign on PR #90. No third regex /
field-extraction refinement is allowed.

LIFECYCLE_VALID  IFF  actualProvenanceBytes == encodeProvenance(SHA256(actualHelperBytes))

One side-effect-free canonical encoder (tools/control-owner/provenance-format.mjs)
is the single producer used by both build.mjs (publish) and ensure-helper.mjs
(accept). Provenance atomic publication (temp + rename) is included as defense-in-
depth only; canonical equality is the correctness mechanism. The runtime's own
import() + hash-before-exec verification is unchanged and remains the final
security authority (no trust transfer from the lifecycle gate).

If this invariant is later falsified on a supported path (a pair equal to the
canonical bytes that the unchanged runtime still rejects):
STOP — no local predicate patch — escalate to the pre-agreed JSON provenance
redesign
.


History — original findings and reconstruction lineage

Supersession history:

Original CURRENT P2:

  • supported Windows launch did not guarantee the native helper and generated
    provenance existed before control-channel verification.

PR #89 CURRENT P2:

  • both helper and provenance could exist but be mutually inconsistent;
  • existence-only fast path skipped rebuild;
  • runtime then returned HELPER_HASH_MISMATCH;
  • control channel remained unavailable until manual recovery.

First reconstruction commit (SUPERSEDED by 134b513 above):

  • head: aa2ae22bc4090195e03c39bb96b6bc50e62616d1
  • 1 commit / 5 changed files
  • patch SHA256: CEDC0605F0B5CED7139EC6F29DA45D96516E1A37928D313934206B57DA0D432A (24657 bytes)
  • This head introduced the provisioning gate but validated provenance by
    field-extraction; the truncated-module witness (Codex P2) motivated the
    canonicalization commit 134b513.

Quarantine

  • F1 FIXED and untouched;
  • F2 FIXED and untouched;
  • F3 FIXED and untouched;
  • atomicity residual DUPLICATE/resolved/untouched;
  • effective-rights P3 remains CARRY_OBLIGATION/untouched;
  • PR fix(control): provision native helper before launch #89 remains CLOSED/unmerged and is evidence only.

Authority

PR #90 remains Draft. This evidence refresh grants no Ready authority and
no merge authority. Human merge authority is preserved.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CepCzSGN8rDhJGx69N81NU

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CepCzSGN8rDhJGx69N81NU
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: f0fef806-e41e-4d67-a5c1-7d2900d0d8cc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LogicDuke
LogicDuke marked this pull request as ready for review September 7, 2026 11:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T12:53:53.728683Z 134b513 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa2ae22bc4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/control-owner/ensure-helper.mjs Outdated
Comment on lines +85 to +86
const filenameMatch = /filename\s*:\s*["']([^"']*)["']/.exec(text);
const sha256Match = /sha256\s*:\s*["']([^"']*)["']/.exec(text);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject truncated provenance modules

If build.mjs is interrupted after writing the sha256 line but before the closing object/module syntax, these regexes still extract a matching filename and digest, so validateHelperPair returns valid and every subsequent launch skips rebuilding. The runtime then fails to import that syntactically invalid module in defaultLoadProvenance, leaving the control channel unavailable until manual recovery—the partial-provisioning state this gate is intended to self-heal. Validate the complete generated module shape rather than accepting fields found anywhere in its text.

Useful? React with 👍 / 👎.

@LogicDuke
LogicDuke marked this pull request as draft September 7, 2026 11:36
@LogicDuke
LogicDuke marked this pull request as ready for review September 7, 2026 12:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 134b513e15

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


note(`helper/provenance pair not valid (${before.reason}); rebuilding via build.mjs.`);
try {
execFileSync(process.execPath, [buildScript], { stdio: ['ignore', 'inherit', 'inherit'] });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize concurrent helper rebuilds

When two supported Windows launches encounter the same missing or invalid pair, both can pass the initial check and invoke build.mjs concurrently. Those builders share and delete the same dist/control/native/obj directory and executable (build.mjs lines 133–136), so one process can remove or lock the other's compiler outputs and cause that launch to exit even if the other rebuild succeeds. Serialize provisioning with a lock and revalidate after acquiring it, or build in isolated temporary locations before publishing.

Useful? React with 👍 / 👎.

@LogicDuke
LogicDuke marked this pull request as draft September 7, 2026 16:59
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.

1 participant