Repository navigation
refactor(agents): share external harness session and attempt machinery - #152181
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 7:27 PM ET / 23:27 UTC (Revision 13). ClawSweeper reviewWhat this changesMoves 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 Review scores
Verification
How this fits togetherOpenClaw'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
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +448, Tests +39, Docs +47, Config +14, Other +4. Total +552 across 33 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
436c2cf to
4e28b27
Compare
|
Actual native Docker evidence for
All six native command turns were inspected independently with real 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"
}
]
} |
|
@clawsweeper re-review Please re-review 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 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. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
25944a5 to
8fbade4
Compare
8fbade4 to
497c334
Compare
|
@clawsweeper re-review Please review current head 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. 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. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Real separately installed package execution and session continuity: PASSTested the pre-refactor comparison baseline Actual API-backed turns used the ordinary Gateway
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 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 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
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
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 After its successful proof and state capture, the parent control container exited at 2026-09-22 16:17:47 America/Los_Angeles; Docker reported |
|
@clawsweeper re-review Please review head 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. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* 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) ...
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]>
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:
The
AgentHarnessV2and 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 baseline429d97b8fa036b55ef565b9432dcc2ba9e394728.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.