Skip to content

refactor(codex): remove redundant app-server forwarding - #140451

Merged
steipete merged 2 commits into
mainfrom
steipete/deslop-tests-codex-production
Sep 6, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/deslop-tests-codex-production

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Related: #135868

What Problem This Solves

Codex app-server preparation contains private forwarding helpers and parses the same trusted communication twice. This is the maintainer-requested production deletion follow-up for concern C (stage 3) of the #135868 split.

Why This Change Was Made

Read the validated communication once, let the existing reviewer predicate normalize its provider, and call the canonical fingerprint operations directly. All public entrypoints, completion formats, validation, reviewer trust rules, fingerprint compatibility and cleanup ownership remain unchanged.

User Impact

No user-visible behavior change. Production shrinks by 26 lines (+9/−35); tests, tooling and docs are unchanged. No dependencies, configuration options or protocol changes.

Evidence

Deleted implementation Remaining owner and coverage
Two single-use notification field helpers and duplicate parsing native-subagent-notification.ts:43 parses once; the unchanged reader validates the assistant/commentary envelope, author/recipient/content types and trigger_turn: false. The nonempty-content guard and author/path match remain. native-subagent-notification.test.ts:153,196,209 covers extraction, mismatched authors and invalid envelopes; :39,62 retains both receipt formats.
Repeated provider normalization app-server-policy.ts:18 passes the provider to config-reviewer-policy.ts:74, which already trims and lowercases it. Its trust callees do not consume raw modelProvider. app-server-policy.test.ts:157,184,223,296,331 and config.test.ts retain provider, endpoint and effective-home trust behavior.
Private fingerprint forwarding helpers thread-fingerprints.ts:13,28 directly composes the same stabilization, sorting, serialization and hash. The complete-schema contract comment is retained. thread-fingerprints.test.ts:27,39,49,65 retains model-visible descriptions, literal property names and ordering stability. All raw/hashed compatibility readers remain.

Paths in the table are under extensions/codex/src/app-server/. Symbol searches show only the removed private definitions and the migrated callers. git log -S reaches e357203be57 for notification/provider helpers and b4b6afadd3c for fingerprint forwarding; no separate public contract was identified for these private layers. This does not claim removal of a legacy protocol contract.

Direct dependency inspection used sibling Codex tag rust-v0.153.4, commit 3d2ee51ca2d5db578f328aa75e20aa22c0197c9a: protocol.rs:804–840, core/src/agent/control.rs:612–663, and app-server-protocol/src/protocol/v2/item.rs:250–260. Both completion producers and optional message phase remain current contracts and are retained. Prior compression PRs #139937 and #139953 were read; this change leaves their distinct cleanup evidence untouched.

Five existing suites passed before and after: 242 cases, 29.68 s → 18.07 s. Final committed-branch independent review is scoped-clean through P2. No tests were changed or replaced with mocks.

The full selected changed-check plan passed on Blacksmith Testbox tbx_01m1w9h8fy0tz1qcmh7angtxfw (run 34060799199): all three source hashes matched, command duration 7m25s, exit 0, and lease stopped. Local lint preparation had refused ancestor node_modules/punycode in the nested checkout; no dependency or guard change was made to bypass that boundary. The wrapper exit/timing record is the delegated proof; successful cleanup may cancel the backing Actions run.

CI identified an additional ownership contract: .github/codeql/openclaw-boundary/queries/raw-socket-callsite-classification.ql:81 classifies the existing connectCodexAppServerUnixSocket owner. The proposed five-line socket-wrapper deletion was withdrawn; transport-websocket.ts is byte-identical to the base. The classification rule and all baselines are unchanged.

Final head a87d35adeea2f1e28d0198043bdb4691b1ea7310 passed exact-head CI run 34060782009, with the watcher reporting GREEN. ClawSweeper reviewed that head with no findings or before-merge/rank-up requests, including direct pinned Codex source inspection. Native review/prepare/merge landed it as bd6f54b8aba690eaa8f42b7c9d74b06641d679b2; GitHub state and main ancestry were verified.

Main's concurrent Proxyline dependency update was reported by the merge wrapper. After refreshing the local lockfile install once, post-merge checks covered all 399 retained MCP/Codex focused cases: three MCP deadline cases initially failed in the combined run and passed on one isolated rerun without changing assertions/timeouts; the remaining suites passed. The checkout is clean.

@steipete steipete self-assigned this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 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.

@steipete
steipete marked this pull request as ready for review September 6, 2026 21:13
? new WebSocket("ws://localhost/", {
...websocketOptions,
createConnection: () => connectCodexAppServerUnixSocket(unixSocketPath),
createConnection: () => net.createConnection(unixSocketPath),
@steipete
steipete force-pushed the steipete/deslop-tests-codex-production branch from 9d829a9 to a87d35a Compare September 6, 2026 21:20
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 5:25 PM ET / 21:25 UTC.

ClawSweeper review

What this changes

The Codex plugin removes private forwarding helpers, parses trusted subagent messages once, and reuses existing provider normalization and tool fingerprint operations without changing user-visible behavior.

Merge readiness

✅ Ready for maintainer review

This remains a useful, maintainer-requested cleanup that is absent from current main. The narrowed patch preserves existing behavior, and the previously flagged socket change has been withdrawn. No actionable correctness or security defect was found.

Priority: P3
Reviewed head: a87d35adeea2f1e28d0198043bdb4691b1ea7310

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving cleanup with retained contract coverage and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored refactor preserves reviewer selection, completion parsing and fingerprint behavior without materially changing authority; the external-contributor proof gate does not apply, and reported tests were treated only as supplemental evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored refactor preserves reviewer selection, completion parsing and fingerprint behavior without materially changing authority; the external-contributor proof gate does not apply, and reported tests were treated only as supplemental evidence.
Evidence reviewed 9 items Introduced scope and current-main comparison: The locally inspected merge-base delta matches the three supplied introduced files. Comparing those files with fetched main retains the same cleanup delta; transport-websocket.ts has no difference. The host-verified test merge also lists only these three files, excluding base-only exec-policy work.
Provider normalization remains canonical: The config barrel forwards through config-reviewer.ts to the predicate that already trims and lowercases modelProvider. Its trust callees consume configuration, model, process environment, home scope and launch arguments, not the raw provider field. Removing caller-side normalization preserves reviewer selection.
Notification validation and consumer ownership remain intact: The retained reader validates the assistant/commentary envelope, string author/recipient/content and trigger_turn=false before returning the parsed object. The changed caller retains nonempty content and author/path equality; the monitor still resolves children within their parent thread. Existing tests cover valid envelopes, spoofed user text, mismatched authors and both receipt formats.
Findings None None.
Security None None.

How this fits together

OpenClaw’s Codex plugin prepares agent sessions for the Codex app-server and processes native subagent completions. These helpers govern reviewer selection, tool-catalog identity for session reuse, and completion messages passed to the child-session lifecycle.

flowchart TD
  A[Model and process settings] --> B[Reviewer policy]
  C[Available tool schemas] --> D[Stable tool fingerprint]
  B --> E[Codex session preparation]
  D --> E
  E --> F[Codex app-server]
  F --> G[Trusted completion parser]
  G --> H[Child-session lifecycle]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -26. Total -26 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 3 9 35 -26
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 9 35 -26

Review metrics

None.

Technical review

Best possible solution:

Keep the simpler private call paths while retaining the existing validation, reviewer trust rules and fingerprint compatibility contracts.

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

Not applicable: this PR removes redundant private operations rather than repairing a reported runtime failure; source comparison supports behavioral equivalence.

Is this the best way to solve the issue?

Yes: the patch directly reuses existing owners without adding abstractions or changing public contracts, and preserves the socket wrapper required by classification tooling.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 270762e51d65.

Labels

Label changes:

  • add P3: This is a bounded internal cleanup with no intended user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored refactor preserves reviewer selection, completion parsing and fingerprint behavior without materially changing authority; the external-contributor proof gate does not apply, and reported tests were treated only as supplemental evidence.

Label justifications:

  • P3: This is a bounded internal cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored refactor preserves reviewer selection, completion parsing and fingerprint behavior without materially changing authority; the external-contributor proof gate does not apply, and reported tests were treated only as supplemental evidence.

Evidence

What I checked:

  • Introduced scope and current-main comparison: The locally inspected merge-base delta matches the three supplied introduced files. Comparing those files with fetched main retains the same cleanup delta; transport-websocket.ts has no difference. The host-verified test merge also lists only these three files, excluding base-only exec-policy work. (extensions/codex/src/app-server/app-server-policy.ts:18, a87d35adeea2)
  • Provider normalization remains canonical: The config barrel forwards through config-reviewer.ts to the predicate that already trims and lowercases modelProvider. Its trust callees consume configuration, model, process environment, home scope and launch arguments, not the raw provider field. Removing caller-side normalization preserves reviewer selection. (extensions/codex/src/app-server/config-reviewer-policy.ts:74, a87d35adeea2)
  • Notification validation and consumer ownership remain intact: The retained reader validates the assistant/commentary envelope, string author/recipient/content and trigger_turn=false before returning the parsed object. The changed caller retains nonempty content and author/path equality; the monitor still resolves children within their parent thread. Existing tests cover valid envelopes, spoofed user text, mismatched authors and both receipt formats. (extensions/codex/src/app-server/native-subagent-notification.ts:43, a87d35adeea2)
  • Fingerprint bytes and compatibility are preserved: Inlining composes the same stabilization, sorting, serialization and hashing operations. Legacy compatibility readers remain unchanged, and existing tests cover tool descriptions, nested descriptions, literal property names and ordering stability. No persisted format or public plugin API changes. (extensions/codex/src/app-server/thread-fingerprints.ts:28, a87d35adeea2)
  • Affirmative dependency contract: The changed notification parser consumes Codex app-server messages, and the retained fingerprint comment explicitly depends on Codex thread-start schema behavior. docs/plugins/codex-harness.md identifies Codex as the native session owner and pins managed app-server 0.153.4, making direct dependency inspection applicable. (extensions/codex/src/app-server/thread-fingerprints.ts:29, a87d35adeea2)
  • Pinned dependency source inspected: The sibling checkout is at the PR-cited commit; its backing cache remote verifies openai/codex ownership. Direct inspection confirmed InterAgentCommunication fields, completion production with trigger_turn=false, optional message phase, and dynamic tools passed into thread creation. These contracts are retained by the cleanup. (codex-rs/core/src/agent/control.rs:633, 3d2ee51ca2d5)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • pash-openai: 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.

@steipete
steipete merged commit bd6f54b into main Sep 6, 2026
109 checks passed
@steipete
steipete deleted the steipete/deslop-tests-codex-production branch September 6, 2026 21:32
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 6, 2026
* commit '294df333c58f2da104eccffc623ccb3c4d43d4d8': (1802 commits)
  fix: clear stale diagnostics after Gateway changes (#140426)
  fix: keep plugin catalogs intact after discovery timeouts (#140441)
  perf(tui): prepare session picker rows once per overlay (#140462)
  refactor(config): reuse environment substitution for write-back (#140460)
  refactor(discord): remove retired auto-presence templates (#140463)
  fix(ui): finish roster refreshes during session activity (#140459)
  fix(setup): match prepared credentials to the model provider (#140461)
  fix: keep MiniMax discovery on the selected credential (#140438)
  refactor(tests): remove unused parent context cache reset (#140456)
  fix: avoid repeated xAI OAuth refresh during discovery (#140434)
  perf(routing): reuse prepared event session targets (#140454)
  fix(media): keep deferred audio and extraction providers discoverable (#139231)
  refactor(codex): remove redundant app-server forwarding (#140451)
  fix(test): avoid false native polling timeouts (#140119)
  test(gateway): retain saved source in reload fixtures (#140453)
  fix(gateway): reduce repeated model work when listing sessions (#140414)
  fix(feishu): fall back to post mode over table limit (#136382)
  fix: use the bundle-compatible Proxyline runtime under Bun (#140411)
  refactor(trace): reuse the canonical usage counter type (#140444)
  refactor(node-host): share execution policy result fields (#140446)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
)

* refactor(codex): remove redundant app-server forwarding

* refactor(codex): retain classified Unix socket owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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