Skip to content

refactor(agents): share external harness session and attempt machinery - #152181

Merged
sjf-oa merged 12 commits into
mainfrom
sjf/external-harness-refactor
Sep 22, 2026
Merged

sjf-oa merged 12 commits into
mainfrom
sjf/external-harness-refactor

Conversation

@sjf-oa

@sjf-oa sjf-oa commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

Additional native agent backends need OpenClaw's existing session and attempt guarantees. Moving reusable coordination out of the Codex adapter lets those backends share binding, rollback, cancellation, and tool-execution behavior.

Change

Codex delegates coordination to focused, production-private harness SDK entrypoints:

  • Native sessions share binding transactions, renewable leases, mutation/deletion fences, generation admission, predecessor adoption, and initialization/deletion rollback.
  • Attempts share execution and settlement deadlines, cancellation, terminal freeze, and lifecycle/event publication.
  • Tool execution shares correlated execution promises and argument/start snapshots, including late-completion detachment.

The AgentHarnessV2 and supported public SDK remain unchanged. Core retains canonical session identity, active-run authority, and tool-effect ownership. Codex retains its protocol, record codec, auth/model configuration, supervision/permissions, queue selection, retention, and native cleanup. No new backend or configuration option is added.

The existing Codex binding codec, v1 active/cleared row envelopes, namespace, keys, SQLite schema/version, retention policy, and public initialization handle remain unchanged. The moved initialization ownership map and coordination state are process-local; no storage migration is introduced.

Compatibility

The updated Codex plugin must ship with the matching host release containing its new private entrypoints. Installing it against an older host that lacks those entrypoints is unsupported. This PR does not publish either package independently.

Validation

Validated head: 056b3b12e00756b3881e6690dbc63840aded151e, pre-refactor comparison baseline 429d97b8fa036b55ef565b9432dcc2ba9e394728.

  • Current-head CI and the security-review CI gate passed. Fresh independent review found no actionable P0-P2 defect.
  • Canonical formatting passed all 27 matched changed files; SDK export registration and whitespace checks passed. The generated SDK export ordering correction is a separate commit.
  • Real separately installed package execution and session continuity proof passed on native Linux/arm64 Docker. Ordinary real npm installation selected trusted compiled global Codex code against matched host artifacts. Four actual API-backed native commands and four Gateway root turns completed successfully. The upgrade preserved the session/binding/thread/runtime fingerprint, all original transcript rows, and the original native turn/item bytes. Independent read-only audit confirmed stored commands, outputs, replies, and files.

The real E2E used the configured default model, normal Gateway dispatch, actual native authentication and app-server, with no mocks, fake services, or model overrides. Existing Gateways and running tests were preserved.

The proof covers a copied-state matched-package upgrade, not zero-downtime upgrade or incompatible package pairs. It records the native-volume recovery, unresolved bind-backed install and child-inspection guard failures, and the parent control container's later OOM exit. The upgraded Gateway remained healthy through verification and was intentionally stopped after E2E completion. Sustained memory stability is unverified. See the linked proof for exact outcomes and artifact digests.

The separate plugin suite has a Telegram fixture failure in unchanged code: AssertionError: expected undefined to deeply equal Any<Function>. Its affected test and runtime owners match the comparison baseline; no unrelated repair or blind rerun was made.

ClawSweeper final review, revision 13 at this exact head, accepts the completed trusted package/continuity evidence. It records sufficient proof, no correctness or security findings, and no remaining before-merge requirements.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex size: XL maintainer Maintainer-authored PR scripts Repository scripts labels Sep 18, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 7:27 PM ET / 23:27 UTC (Revision 13).

ClawSweeper review

What this changes

Moves Codex session coordination, cancellation, deadlines, lifecycle events, and tool-execution bookkeeping into shared private host helpers while retaining backend-specific policy.

Merge readiness

✅ Ready for maintainer review

The refactor remains useful, and the new trusted-package continuity evidence resolves the previous review blocker. No actionable introduced correctness or security defect was found.

Priority: P2
Reviewed head: 056b3b12e00756b3881e6690dbc63840aded151e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent extraction with strong native package-continuity evidence and no remaining actionable review findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): Exact-head Linux/arm64 proof exercises the shared session and attempt owners through ordinary Gateway dispatch and a genuinely installed, trusted Codex package: four native commands completed across a matched-package upgrade with original session identity and transcript/native record bytes preserved. This resolves the prior separate-package gap and verifies compatibility without a storage migration; the disclosed environment failures and broader untested scenarios do not negate that result.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): Exact-head Linux/arm64 proof exercises the shared session and attempt owners through ordinary Gateway dispatch and a genuinely installed, trusted Codex package: four native commands completed across a matched-package upgrade with original session identity and transcript/native record bytes preserved. This resolves the prior separate-package gap and verifies compatibility without a storage migration; the disclosed environment failures and broader untested scenarios do not negate that result.
Evidence reviewed 11 items Pinned introduction and parentage: Reviewed the merge-base-to-head introduction. The original head's recorded immediate parent is 497c334; 429d97b is the comparison baseline, despite the proof prose calling it the actual parent. The stale test merge was not used to attribute removal of main-branch behavior.
Session extraction preserves existing fences: Compared the original binding implementation with its delegated lifecycle operations: generation checks, exact-token renewal, expiry handling, conditional deletion, rollback, and backend retention policy remain equivalent. The change relocates existing authority checks without expanding the principals or operations they authorize.
Stored and public contracts remain intact: The binding record codec, namespace metadata, and public harness types have no introduced changes. Initialization ownership remains process-local, and the same stored v1 binding envelopes and retention values are used.
Findings None None.
Security None None.

How this fits together

OpenClaw's agent harness connects admitted Gateway runs to native backends. The shared helpers coordinate session bindings and attempt lifecycles, while the Codex plugin handles native protocol requests and projects results back into OpenClaw.

flowchart TD
  A[Gateway agent request] --> B[Host run authority]
  B --> C[Shared session coordination]
  C --> D[Codex protocol adapter]
  B --> E[Shared attempt lifecycle]
  E --> D
  D --> F[Native Codex execution]
  F --> G[Transcript and reply]
  E --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +448, Tests +39, Docs +47, Config +14, Other +4. Total +552 across 33 files.

View PR surface stats
Area Files Added Removed Net
Source 23 1333 885 +448
Tests 3 46 7 +39
Docs 3 47 0 +47
Config 2 15 1 +14
Generated 0 0 0 0
Other 2 4 0 +4
Total 33 1445 893 +552

Review metrics

Metric Value Why it matters
Private host surface 2 new private entrypoints; 0 new user configuration options The documented package coupling is limited to official harness runtime helpers.
Production versus test growth Production TypeScript net +442 lines; tests and test support net +39 The stated justification is reusable coordination for additional harnesses while removing the corresponding Codex-local implementations.

Stored data model

Persistent data-model change detected: serialized state: extensions/codex/src/app-server/session-initialization.ts, unknown-data-model-change: extensions/codex/src/app-server/session-initialization.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep one shared coordination implementation behind private host entrypoints, preserve backend policy in Codex, and ship the plugin with its matching host.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a refactor rather than a reported behavioral defect; the supplied native execution and upgrade evidence exercises the preserved behavior.

Is this the best way to solve the issue?

Yes. Extracting coordination through focused private helpers removes competing implementations while leaving protocol, persistence format, retention, and execution policy with their existing owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 370e17484d58.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded runtime architecture improvement supporting additional harnesses, without an established urgent user regression.
  • merge-risk: 🚨 compatibility: The updated official Codex plugin requires matching private host exports; that release coupling is documented in the maintainer request and covered by successful matched-package upgrade proof.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): Exact-head Linux/arm64 proof exercises the shared session and attempt owners through ordinary Gateway dispatch and a genuinely installed, trusted Codex package: four native commands completed across a matched-package upgrade with original session identity and transcript/native record bytes preserved. This resolves the prior separate-package gap and verifies compatibility without a storage migration; the disclosed environment failures and broader untested scenarios do not negate that result.
  • proof: sufficient: Contributor real behavior proof is sufficient. Exact-head Linux/arm64 proof exercises the shared session and attempt owners through ordinary Gateway dispatch and a genuinely installed, trusted Codex package: four native commands completed across a matched-package upgrade with original session identity and transcript/native record bytes preserved. This resolves the prior separate-package gap and verifies compatibility without a storage migration; the disclosed environment failures and broader untested scenarios do not negate that result.

Evidence

What I checked:

  • Pinned introduction and parentage: Reviewed the merge-base-to-head introduction. The original head's recorded immediate parent is 497c334; 429d97b is the comparison baseline, despite the proof prose calling it the actual parent. The stale test merge was not used to attribute removal of main-branch behavior. (056b3b12e007)
  • Session extraction preserves existing fences: Compared the original binding implementation with its delegated lifecycle operations: generation checks, exact-token renewal, expiry handling, conditional deletion, rollback, and backend retention policy remain equivalent. The change relocates existing authority checks without expanding the principals or operations they authorize. (extensions/codex/src/app-server/session-binding.ts:376, 056b3b12e007)
  • Stored and public contracts remain intact: The binding record codec, namespace metadata, and public harness types have no introduced changes. Initialization ownership remains process-local, and the same stored v1 binding envelopes and retention values are used. (extensions/codex/src/app-server/session-binding-record.ts, 056b3b12e007)
  • Previous proof blocker resolved: The captured proof at refactor(agents): share external harness session and attempt machinery #152181 (comment) covers this exact head using ordinary installation from a real isolated npm registry, catalog-trusted compiled Codex code, and matched host artifacts on Linux/arm64. Four API-backed native commands and Gateway turns completed; the upgrade preserved session, binding, thread, fingerprint, all 13 original transcript rows, and original native turn/item bytes. Independent stored-state inspection checked commands, exits, stdout, replies, and files. This satisfies the previous review's concrete separate-package execution and continuity request. (056b3b12e007)
  • Proof scope and matched-package contract: The maintainer request retains the matched host/plugin release requirement: the updated plugin needs the new private host entrypoints and is not being published independently. The successful copied-state upgrade does not establish incompatible-package support, zero-downtime updates, failure-path cleanup, or sustained memory stability. The disclosed bind-backed install failure, child-inspection guard failures, and later parent-container OOM do not establish a regression introduced by this extraction; the candidate remained healthy. (package.json:905, 056b3b12e007)
  • Dependency contract applies: The changed Codex attempt owner still delegates native interruption to interruptCodexTurnAndWaitBestEffort, and the proof depends on real Codex app-server execution and thread/read results. These are affirmative reasons to inspect the Codex implementation; its protocol and native cleanup remain adapter-owned. (extensions/codex/src/app-server/run-attempt-turn-state.ts:97, 056b3b12e007)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-18T23:18:06.570Z sha 4e28b27 :: blocked before merge. :: none
  • reviewed 2026-09-20T22:30:26.142Z sha 774ed87 :: blocked before merge. :: none
  • reviewed 2026-09-20T23:47:02.521Z sha 25944a5 :: blocked before merge. :: none
  • reviewed 2026-09-21T00:09:44.015Z sha 25944a5 :: blocked before merge. :: none
  • reviewed 2026-09-21T00:43:59.741Z sha 25944a5 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:23:17.451Z sha 056b3b1 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:33:00.735Z sha 056b3b1 :: blocked before merge. :: none
  • reviewed 2026-09-22T21:42:28.561Z sha 056b3b1 :: blocked before merge. :: none

@sjf-oa sjf-oa changed the title refactor(agents): share external harness binding and deadline lifecycle refactor(agents): share external harness session and attempt machinery Sep 18, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 18, 2026
@sjf-oa
sjf-oa force-pushed the sjf/external-harness-refactor branch from 436c2cf to 4e28b27 Compare September 18, 2026 22:27
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 18, 2026
@sjf-oa

sjf-oa commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

Actual native Docker evidence for 25944a5828f94c9e6dbb0e3558ecf5753fbc7c31, compared with its pinned parent d5dee8fed1203d94cb47ca98da301269a1e5e976.

Real flow Result
Parent’s canonical packaged host PASS: two real native command turns, persisted replies and a reusable binding
Candidate with the parent’s complete copied state PASS: exact session ID, binding key, native thread, runtime fingerprint, canonical transcript prefix and native turn prefix retained; two additional commands completed
Independent fresh candidate host PASS: two native commands and exact replies persisted with binding reuse
Separate genuine managed npm-pack Codex installation/loading PASS: tarball bytes, compiled global plugin selection, active harness and new SDK import resolution verified
Separate unpublished npm-pack native execution/upgrade BLOCKED: both parent and candidate hit the unchanged trusted-plugin-state guard; no provenance or trust bypass

All six native command turns were inspected independently with real thread/read: completed native command items, successful exits and exact outputs, completed native turns, exact final replies and root Gateway settlement. The copied state used eight read-only online SQLite backups; its copied Gateway owner lease expired normally before the new candidate container started. Existing Gateways remained running.

The whole installed host runtime trees match the actual canonical tarballs (8,880 parent files; 8,893 candidate files). Separate Codex runtime matches all 137 artifact files; all 95 candidate SDK import paths resolve inside the actual packed host. This proves resolution and compiled plugin loading, not independent evaluation of every SDK module. New host/private-runtime exports and the official plugin require an aligned release. No packages were published.

Sanitized artifact and observed native-turn manifest
{
  "sourceSha": "25944a5828f94c9e6dbb0e3558ecf5753fbc7c31",
  "baseSha": "d5dee8fed1203d94cb47ca98da301269a1e5e976",
  "architecture": "linux/arm64",
  "nativeCodexVersion": "0.154.0",
  "artifacts": [
    {
      "stage": "base",
      "name": "openclaw-base.tgz",
      "sha256": "19f1b839003f985eaadcede5dfc140ae907d8d5781183268ccbe517bd3b97ed6"
    },
    {
      "stage": "base",
      "name": "openclaw-codex-2026.9.4.tgz",
      "sha256": "64d4e63e508143d3119a5bfba3aa0773915c0bc8763f8943030d7a4c4ece8f9c"
    },
    {
      "stage": "candidate",
      "name": "openclaw-candidate.tgz",
      "sha256": "308b81619147cd02595f7c96af83e363c8a20bc1de01f4b219395edf524db231"
    },
    {
      "stage": "candidate",
      "name": "openclaw-codex-2026.9.4.tgz",
      "sha256": "9c399e791b7fdba7c830d2f24a78a14a945acb4c34ac01b1ef35588824c5604e"
    }
  ],
  "stages": [
    {
      "stage": "base",
      "status": "PASS",
      "startedAt": "2026-09-21 00:47:59 Europe/London",
      "finishedAt": "2026-09-21 00:48:17 Europe/London",
      "sourceSha": "d5dee8fed1203d94cb47ca98da301269a1e5e976",
      "imageId": "sha256:09c4c2e485f4df24f8c4d968581c9e2130a923d56a5ae5005889f2e87dcdad00",
      "hostRuntimeFilesVerifiedAgainstActualTarball": 8880,
      "pluginOrigin": "bundled",
      "pluginRuntimeState": "active",
      "binding": {
        "sessionId": "8a1b8fa5-f7cd-468e-992e-d94508187651",
        "bindingKey": "session-key:main:lnaCGjXmJgyjzz0iVrHz6xJuhgGaqJwuc6R3ecBbAcM",
        "threadId": "01a0c138-5753-7ee3-8ed5-4a59e3dbf162",
        "runtimeFingerprintSha256": "f6e9da270129209a9b7016440a189433168329c970f7ada9033d46e6409eca7a"
      },
      "canonicalHistory": {
        "rowCount": 9,
        "prefixSha256": "85ca7650a18863a670fb17b38f181520fc8feb844e9867100394b9426053621b",
        "lastSeq": 8
      },
      "nativeTurns": {
        "threadId": "01a0c138-5753-7ee3-8ed5-4a59e3dbf162",
        "turnIds": [
          "01a0c138-57a2-7331-aa6f-49bedfa11d26",
          "01a0c138-68b5-7670-b68b-8ba51e03f50a"
        ],
        "completedPrefixSha256": "a02ca5d13e751f5c0660315191fabe98dc74adc5744004c63110b097f749feab"
      },
      "actualNativeCommandTurns": [
        {
          "status": "PASS",
          "runId": "d94df870-baa5-482a-aa77-cdc66691a01b",
          "nativeTurnId": "01a0c138-57a2-7331-aa6f-49bedfa11d26",
          "nativeStatus": "completed",
          "successfulCommandIds": [
            "exec-3aa6dc8b-b755-42df-ad0a-45cb4ca0786c"
          ],
          "exactOutputSha256": "58564565608fde1bb02cdab27725e29bdbeeb5de1562776c2b517d816043cf9a",
          "gatewaySettlementStatus": "ok",
          "gatewayEndedAtRecorded": true
        },
        {
          "status": "PASS",
          "runId": "72796035-878a-4f61-a52f-a4048ab0128f",
          "nativeTurnId": "01a0c138-68b5-7670-b68b-8ba51e03f50a",
          "nativeStatus": "completed",
          "successfulCommandIds": [
            "exec-064410fa-bb10-4eea-a30a-b7c886220a3f"
          ],
          "exactOutputSha256": "58564565608fde1bb02cdab27725e29bdbeeb5de1562776c2b517d816043cf9a",
          "gatewaySettlementStatus": "ok",
          "gatewayEndedAtRecorded": true
        }
      ]
    },
    {
      "stage": "candidate",
      "status": "PASS",
      "startedAt": "2026-09-21 00:54:22 Europe/London",
      "finishedAt": "2026-09-21 00:54:36 Europe/London",
      "sourceSha": "25944a5828f94c9e6dbb0e3558ecf5753fbc7c31",
      "imageId": "sha256:4459f7ca2423e51d3d28b73ed166c8a043310e52e68651b35ab4b077ac6725a8",
      "hostRuntimeFilesVerifiedAgainstActualTarball": 8893,
      "pluginOrigin": "bundled",
      "pluginRuntimeState": "active",
      "binding": {
        "sessionId": "8a1b8fa5-f7cd-468e-992e-d94508187651",
        "bindingKey": "session-key:main:lnaCGjXmJgyjzz0iVrHz6xJuhgGaqJwuc6R3ecBbAcM",
        "threadId": "01a0c138-5753-7ee3-8ed5-4a59e3dbf162",
        "runtimeFingerprintSha256": "f6e9da270129209a9b7016440a189433168329c970f7ada9033d46e6409eca7a"
      },
      "canonicalHistory": {
        "rowCount": 17,
        "prefixSha256": "76cdb95991498405466c60a007d028df44a10e998b59e2106aea2c24c4e41f39",
        "lastSeq": 16
      },
      "nativeTurns": {
        "threadId": "01a0c138-5753-7ee3-8ed5-4a59e3dbf162",
        "turnIds": [
          "01a0c138-57a2-7331-aa6f-49bedfa11d26",
          "01a0c138-68b5-7670-b68b-8ba51e03f50a",
          "01a0c13e-1f53-7ec0-8768-7b2fa292d6ff",
          "01a0c13e-33fe-7492-a66e-bd36e6123d9b"
        ],
        "completedPrefixSha256": "0d2230f1042941177315978a5fe9eaca6edef38f61b4a4f77c3a0c7de4dbe910"
      },
      "actualNativeCommandTurns": [
        {
          "status": "PASS",
          "runId": "b08f2624-2f2e-4d3a-8673-4c75dc46794a",
          "nativeTurnId": "01a0c13e-1f53-7ec0-8768-7b2fa292d6ff",
          "nativeStatus": "completed",
          "successfulCommandIds": [
            "exec-dac2bdec-4073-46d5-915f-0963089d7c65"
          ],
          "exactOutputSha256": "76bbae79099910a7f43d26d3447bd66133897f5f126af2d26865805cbad21967",
          "gatewaySettlementStatus": "ok",
          "gatewayEndedAtRecorded": true
        },
        {
          "status": "PASS",
          "runId": "bdb8dfb9-5c9d-41b9-a7cf-ff8290b3e16d",
          "nativeTurnId": "01a0c13e-33fe-7492-a66e-bd36e6123d9b",
          "nativeStatus": "completed",
          "successfulCommandIds": [
            "exec-7bac92bd-17c3-423d-8941-40935dc6579e"
          ],
          "exactOutputSha256": "76bbae79099910a7f43d26d3447bd66133897f5f126af2d26865805cbad21967",
          "gatewaySettlementStatus": "ok",
          "gatewayEndedAtRecorded": true
        }
      ]
    },
    {
      "stage": "fresh",
      "status": "PASS",
      "startedAt": "2026-09-21 00:49:31 Europe/London",
      "finishedAt": "2026-09-21 00:49:53 Europe/London",
      "sourceSha": "25944a5828f94c9e6dbb0e3558ecf5753fbc7c31",
      "imageId": "sha256:4459f7ca2423e51d3d28b73ed166c8a043310e52e68651b35ab4b077ac6725a8",
      "hostRuntimeFilesVerifiedAgainstActualTarball": 8893,
      "pluginOrigin": "bundled",
      "pluginRuntimeState": "active",
      "binding": {
        "sessionId": "a4ab71df-a711-4af3-90e3-eb6e2a05bf05",
        "bindingKey": "session-key:main:ptY3bqJjon-n0rwggvhkxhTePnQibB8voIuSmWfEnEs",
        "threadId": "01a0c139-cd8a-72c2-9af9-2eb21fde49c2",
        "runtimeFingerprintSha256": "f6e9da270129209a9b7016440a189433168329c970f7ada9033d46e6409eca7a"
      },
      "canonicalHistory": {
        "rowCount": 9,
        "prefixSha256": "1cc34363fb87b93331ab231ff441a093b06c0ee399fb404eefb314bda1070318",
        "lastSeq": 8
      },
      "nativeTurns": {
        "threadId": "01a0c139-cd8a-72c2-9af9-2eb21fde49c2",
        "turnIds": [
          "01a0c139-cdcf-7331-86d6-c8caf844df42",
          "01a0c139-df0b-7fa2-b671-297a83a233c0"
        ],
        "completedPrefixSha256": "91e1352bf3f668a8c39d2557bc0ce757484c195c093c7309ee8528eb75071c3a"
      },
      "actualNativeCommandTurns": [
        {
          "status": "PASS",
          "runId": "c052e9fd-426d-4c23-b33e-da2b8aea77bc",
          "nativeTurnId": "01a0c139-cdcf-7331-86d6-c8caf844df42",
          "nativeStatus": "completed",
          "successfulCommandIds": [
            "exec-0d6764e5-eefe-4fc3-9d78-5afaa25d010c"
          ],
          "exactOutputSha256": "52c79d52b5b8b9d61cce8b6b1e4d16612256a6a883ff63bd507940a928f61c4e",
          "gatewaySettlementStatus": "ok",
          "gatewayEndedAtRecorded": true
        },
        {
          "status": "PASS",
          "runId": "df14ffbc-4b86-4230-8984-f8f4d1bb8ff2",
          "nativeTurnId": "01a0c139-df0b-7fa2-b671-297a83a233c0",
          "nativeStatus": "completed",
          "successfulCommandIds": [
            "exec-1cbf37cc-b311-48c1-9495-742bc2d0b858"
          ],
          "exactOutputSha256": "52c79d52b5b8b9d61cce8b6b1e4d16612256a6a883ff63bd507940a928f61c4e",
          "gatewaySettlementStatus": "ok",
          "gatewayEndedAtRecorded": true
        }
      ]
    }
  ],
  "limitations": [
    "Isolated copied-state bundled host upgrade, not the published updater driver or in-place zero-downtime upgrade.",
    "Separate genuine npm-pack installation and compiled loading/import resolution succeeded, but unpublished local artifacts cannot execute trusted plugin state.",
    "No mocks or fake services are used as native Docker proof. Existing hosted CI fixture coverage is separate."
  ],
  "separatePlugin": [
    {
      "stage": "base",
      "sourceSha": "d5dee8fed1203d94cb47ca98da301269a1e5e976",
      "selectedPluginOrigin": "global",
      "hostRuntimeFilesVerified": 8880,
      "pluginRuntimeFilesVerified": 137,
      "sdkImportResolutionsInsideActualHost": 93,
      "gatewayPluginState": "active",
      "nativeExecution": "BLOCKED",
      "rawPolicyError": "openSyncKeyedStore is only available for trusted plugins in this release.",
      "policyReason": "origin-path"
    },
    {
      "stage": "candidate",
      "sourceSha": "25944a5828f94c9e6dbb0e3558ecf5753fbc7c31",
      "selectedPluginOrigin": "global",
      "hostRuntimeFilesVerified": 8893,
      "pluginRuntimeFilesVerified": 137,
      "sdkImportResolutionsInsideActualHost": 95,
      "gatewayPluginState": "active",
      "nativeExecution": "BLOCKED",
      "rawPolicyError": "openSyncKeyedStore is only available for trusted plugins in this release.",
      "policyReason": "origin-path"
    }
  ]
}

@sjf-oa

sjf-oa commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please re-review 25944a5828f94c9e6dbb0e3558ecf5753fbc7c31 using the updated PR body and sanitized actual Docker artifact/native-turn manifest.

Generated SDK declarations, canonical extension package-boundary generation/compile/canary, full host/UI/bootstrap/postbuild packaging, separate Codex compilation/packing, final-head production types/lint/dependencies and the extension test import guard have passed. Real native ARM64 Docker evidence now covers canonical parent artifacts, final-head fresh setup, and continuation of a complete isolated copied parent state. Six actual native commands and six root turns settled; the upgrade retained exact session/binding/thread/runtime-fingerprint identity and both earlier transcript/native-turn byte prefixes.

The Codex v1 record codec, durable namespace/keys, SQLite schema/version, retention and public initialization handle are unchanged. Existing lease tokens/expirations remain durable; the moved initialization ownership map is process-local. Please assess the data-model compatibility flag against this source and real upgrade evidence.

The separately packed official plugin installs, selects compiled global code, activates, and resolves its new SDK imports against the real packed candidate host. Actual native execution is still blocked by the unchanged policy for unpublished local npm-pack artifacts: openSyncKeyedStore is only available for trusted plugins in this release. Both parent and candidate reproduce that guard. No trust/provenance records were rewritten, and bundled execution is not presented as proof of separate-plugin trusted execution or its upgrade.

Exact-head hosted Codex fixture validation is pending; it is separate from real Docker E2E. Ordinary exact-head branch CI has failures outside the repaired checks, reported in the body with attribution limits.

The maintainer explicitly requested keeping this PR’s old base and leaving merging blocked. Conflicts remain intentionally unresolved. This request authorizes review only; it does not authorize rebase, autofix, CI source repair, or automerge. Please report remaining substantive findings and concrete proof gaps.

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@sjf-oa
sjf-oa force-pushed the sjf/external-harness-refactor branch from 25944a5 to 8fbade4 Compare September 22, 2026 21:01
@sjf-oa
sjf-oa force-pushed the sjf/external-harness-refactor branch from 8fbade4 to 497c334 Compare September 22, 2026 21:09
@sjf-oa

sjf-oa commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review current head 056b3b12e00756b3881e6690dbc63840aded151e, based on 429d97b8fa036b55ef565b9432dcc2ba9e394728.

Maintainer authorization supersedes the earlier integration hold: resolve integration, make CI green, obtain review, and merge only when ClawSweeper is satisfied. The PR is mergeable. The harness implementation remains unchanged by the rebase; newer main behavior is preserved. A separate commit regenerates the canonical SDK export ordering found by CI. Fresh independent review found no actionable P0–P2 findings, formatting passed, and export-registration checking passed.

Current CI: https://github.com/openclaw/openclaw/actions/runs/35785453404

The separate plugin suite targets the same exact source: https://github.com/openclaw/openclaw/actions/runs/35785479074 . Its current Telegram fixture failure is in unchanged code; no unrelated repair has been made.

The matched host/plugin packaging requirement is retained: updated Codex must ship with a host containing its private entrypoints. This PR does not publish the plugin independently. Earlier bundled Docker execution/continuity evidence remains historical. Fresh genuine private-registry installation and native binding continuity proof are being prepared but are not complete; please keep that gap explicit.

This is a review request only. Do not autofix or merge. Significant requested logic changes require maintainer approval; testing, formatting, and documentation follow-ups can be handled directly.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@sjf-oa

sjf-oa commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Real separately installed package execution and session continuity: PASS

Tested the pre-refactor comparison baseline 429d97b8fa036b55ef565b9432dcc2ba9e394728 and PR head 056b3b12e00756b3881e6690dbc63840aded151e with aligned openclaw and @openclaw/codex 2026.9.5 artifacts in native Linux/arm64 Docker. Each Codex package was published to an isolated real npm registry and installed through the ordinary plugin installer. The installed registry, selected compiled entrypoint, official catalog trust decision, tarball integrity, host SDK imports, and every packed runtime file were verified against the actual artifacts. No provenance or trust records were rewritten.

Actual API-backed turns used the ordinary Gateway agent and agent.wait flow, the configured default model, and the real native Codex app-server. No mocks, fake services, or per-turn model overrides were used.

Phase Local execution time, America/Los_Angeles Result
Parent packages 2026-09-22 16:03:15 to 16:03:32 Two completed native commands, exit 0, exact stdout, two distinct final replies
Refactored packages, copied existing session 2026-09-22 16:17:52 to 16:18:07 Two more completed native commands, exit 0, exact stdout, two distinct final replies

The parent command created a real file; its follow-up read and validated it. After the package upgrade, the first command validated that original file before creating a new one; the final follow-up validated the new file. All four Gateway root turns settled successfully. Independent native thread/read inspection confirmed completed execution rather than relying on assistant claims.

The authoritative session ID, binding key, native thread, and nonempty runtime fingerprint were unchanged. All 13 original canonical transcript rows retained their exact byte prefix; the upgraded session has 21 rows. Both original native turn IDs and their complete stored prefix were preserved, followed by the two new turns. The runtime fingerprint SHA256 remained d40a4552852dcf1a3355dd264fa638612a78cb56709a74e11b60dde4202b4e33.

An independent read-only audit of the actual running candidate databases confirmed the original two native turn rows and eight native item rows, including raw item JSON, exactly match the parent. It independently decoded all four stored command arguments, checked completed status, exit 0 and exact stdout, matched the four distinct native replies to canonical replies, checked both real files, and confirmed the native thread remains active.

State capture used read-only SQLite backup, included committed WAL data, checked all nine databases, and preserved stored leases until natural expiry. The native-volume transfer checked 17,949 regular files and 46 symlink targets and owners. All file bytes and file/directory permissions matched. The 46 ordinary symlinks adopted Linux's fixed 0777 permission representation; each metadata change was recorded separately, consistent with Linux symlink semantics.

Artifact and execution digests
Artifact Parent SHA256 Refactored SHA256
Host tarball 7f66c353be797e04106cfd7806eae20319792a73a0248d008487b35ca718d1c2 d0625a46746ce61fe5501c0a436b201fa7816ac208ea29f0b9037fa963764676
Codex tarball 5eb5f38dc817855a051e4c5cc3b426b997e2221587e77c9626b36ce3d694b724 374ef6244d72b5f8c6aa5929386141d1b8ce6907fa6c457bd653af43bd905b57
Actual proof receipt acc6998f95077520cb4f8a8e6c80409467eab8f9fa6294196df31fd83ffdeab2 92f568b060835e583b6492de632fac96932b0ebea7dcd99a6049eb266a15928f

The artifact comparison covered 9,509 parent and 9,515 refactored host runtime files, plus 143 Codex runtime files in each phase. The actual native Linux/arm64 executable SHA256 was 9b7c1c7abdc26fc3c4f47c77656a8e9121def5483dbae830ef1ee561758448a9.

Native command Exact requested command SHA256 Exact stdout SHA256
Parent write 69b497d8141c8532a70bea4c82ab4c45843b8cf9b4b2bd2c04bf7b541cac2f1f 813fbd60aeda5f6207bd64822efeb1b798dc587bf9d38f042729b719f176ea66
Parent read 2b58ad5160a5d3bc6db7888568ddc06d9de56964542ad813f718d261003cafc7 3ecd04a6f532e128674bf1cde23aea62fd0e0ff27cd2a2b324a41e7621447abf
Upgraded write 046a00d6059603f23ecafeb86832c1c3deeedb64a548f75a91ad6e7ef798ce85 7d8bbb904d1cfbd1d8c24d1c6d2f8e39eea443b67c7e36de6bc1e86114ea5873
Upgraded read b3a66c49c7557b20eb1dfb5ace9dff190b8ef16b0e1af12a44f8051e0213a702 0ee38bd7000ee2a87cc8b709b429e9d7a56a3d1d4b1c9defd1e2be08853e4b88

Limits: this proves a matched host/plugin upgrade in copied isolated state, not in-place zero-downtime upgrade, incompatible package pairs, public package publication, initialization-failure cleanup, or deletion compensation. The first candidate installation on a macOS bind stopped with Failed to publish managed npm project: Error: install directory changed: /home/node/.openclaw/npm/projects. Its cause remains unresolved; the successful candidate used a native Docker volume with the same guard intact. Earlier child-spawned CLI inspections reported Plugin source changed while preparing its reload; retry after the edit finishes. This proof uses genuine separately captured supported CLI inspections bound to each actual container, image, source revision, command exit, timestamp, and report digest; live registry/artifact/runtime and native execution checks still ran. Neither limitation was fixed or suppressed in product code.

After its successful proof and state capture, the parent control container exited at 2026-09-22 16:17:47 America/Los_Angeles; Docker reported OOMKilled: true and ExitCode: 137. The candidate remained healthy and its stored continuity audit passed. This run does not establish sustained memory stability.

@sjf-oa

sjf-oa commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review head 056b3b12e00756b3881e6690dbc63840aded151e using the updated body and completed real separately installed package execution and existing-session continuity evidence.

Both required CI gates passed. Ordinary installation from a genuine isolated npm registry selected catalog-trusted compiled Codex code against the actual matched packed host. Native Linux/arm64 Docker completed four actual API-backed commands and four root turns. The upgrade retained session/binding/thread/runtime-fingerprint identity, original transcript bytes, and both original native turn/item records. Independent read-only verification of the running candidate databases confirmed exact commands, exit codes, stdout, distinct replies, and real files. No mocks, fake services, model overrides, forced lease expiry, or provenance/trust rewrites were used.

The proof explicitly records native-volume recovery, unresolved bind-backed install and child-inspection guard failures, and the control container's later OOM exit. The candidate remained healthy. It does not claim in-place zero-downtime upgrade, incompatible package-pair coverage, or sustained memory stability. Matched host/plugin release requirements remain documented; no product logic changed for the proof.

This is a review-only request. Do not autofix or merge. The maintainer will approve any significant requested logic change; routine testing, formatting, and documentation follow-ups can be addressed directly. Merge remains conditional on your satisfaction.

@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@sjf-oa
sjf-oa merged commit 488019c into main Sep 22, 2026
241 checks passed
@sjf-oa
sjf-oa deleted the sjf/external-harness-refactor branch September 22, 2026 23:32
@sjf-oa

sjf-oa commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit '7d7f977ccfc1ac177526232e4f4960febd010015': (91 commits)
  test: avoid unused target setup in package profile fixtures (#155972)
  fix(worktrees): batch snapshot metadata reads
  test(plugin-state): distinguish borrowed and foreign lifecycle owners
  refactor(agents): share external harness session and attempt machinery (#152181)
  chore(i18n): refresh native locales (#156006)
  chore(test): retain Doctor fixture settlement diagnostics (#155944)
  perf(codex): reuse unchanged inference request bytes (#155987)
  perf(test): prepare snapshot ownership subprocess imports (#155973)
  perf(test): consolidate channel registry coverage (#155014)
  fix(runtime): preserve Node worker dependencies and cleanup diagnostics (#155292)
  perf(test): prepare worktree GC child runtime (#155928)
  fix(ui): open browser cards after delayed panel renders (#153253)
  fix(update): retain the running updater by hard link instead of copying the package (#155977)
  feat(decisions): add explicit evaluation and Labs opt-in foundation (#155134)
  fix(state): preserve lifecycle custody across worker dispatch
  improve: reuse shared tooling fixtures and defer legacy updater proof (#155731)
  improve(ui): reduce real-Gateway test preparation (#155979)
  perf(state): move session RPC SQL off the Gateway main thread (#155740)
  docs(freebsd): explain native Codex runtime limits (#155980)
  fix(qa): count Code Mode nested tool activity as transcript tool evidence (#155976)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
openclaw#152181)

* refactor: share external harness session coordination

* refactor(agents): keep shared session helpers behind private runtime SDK

* refactor(agents): share native session admission and attempt execution

* refactor(agents): sync private attempt runtime exports

* style(agents): format shared harness extraction

* refactor(agents): simplify shared harness extraction

* style(agents): format simplified harness helpers

* fix(agents): align shared harness checks and fixtures

* style(agents): format receiver-independent initializer

* fix(agents): preserve extension fixture boundaries after extraction

* style(test): format shared initializer fixture setup

* fix(plugin-sdk): sync generated harness runtime export ordering

---------

Co-authored-by: Sarah Fortune <[email protected]>
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex extensions: xai maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants