fix: improve agent runtime correctness from upstream Pi#99949
Conversation
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes notedThis PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of
Security review is still recommended before merge when the dependency graph change is intentional. |
|
Codex review: stale review; fresh review needed. Summary Next step Review history (3 earlier review cycles)
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d4b19019c
ℹ️ 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".
| const canCompressSseBody = model.provider === "openai" && !sseHeaders.has("content-encoding"); | ||
| const compressedBody = canCompressSseBody ? compressRequestBodyZstd(bodyJson) : null; | ||
| if (compressedBody) { | ||
| sseHeaders.set("content-encoding", "zstd"); |
There was a problem hiding this comment.
Gate zstd compression to native ChatGPT
When models.providers.openai or an OpenAI model entry uses a custom baseUrl, the provider remains openai, so this branch now compresses the SSE request and sets content-encoding: zstd before the fetch goes to resolveCodexUrl(model.baseUrl). Generic ChatGPT-compatible relays and custom OpenAI base URLs previously received plain JSON unless they explicitly set an encoding, and many will reject or misread zstd bodies. Please restrict compression to the native ChatGPT backend (empty/default baseUrl or chatgpt.com) rather than the provider id alone.
Useful? React with 👍 / 👎.
17d92fa to
96be407
Compare
|
Land-ready proof for
No changelog entry: repository policy reserves |
|
Merged via squash.
|
* fix: improve agent runtime correctness * test: track agent tool temp directories * test: update helper routing expectation
Closes #99924
What Problem This Solves
The agent runtime snapshot internalized in #85341 had drifted behind several correctness fixes in current
earendil-works/pi. The gaps could lose untouched whitespace during fuzzy edits, truncate late descendant output, accept progress after tool completion, run split compaction summaries concurrently, miss provider overflow/retry signals, reject BMP inputs, and mishandle newer ChatGPT/Codex transport behavior.Why This Change Was Made
This adopts the audited fixes at OpenClaw's existing owner boundaries instead of importing Pi's architecture wholesale:
find, drains finite descendant output with an absolute deadline, and ignores late tool progress;@earendil-works/pi-tuifrom 0.78.0 to 0.80.3.No compatibility shim, parallel runtime path, config key, or environment variable was added. Pi model-registry, orchestrator/RPC, and project-trust changes were intentionally not adopted because OpenClaw owns those surfaces differently.
Direct dependency inspection:
../codex/codex-rs/codex-client/src/request.rs:180-225— zstd level 3 and content-encoding ownership.../codex/codex-rs/core/src/client.rs:1329-1337— compression requires Codex-backend auth and an OpenAI provider.../codex/codex-rs/features/src/lib.rs:1010-1014— compression is stable and default-enabled.../codex/codex-rs/codex-api/src/endpoint/responses_websocket.rs:156-161,578-588— 60-minute connection-limit code and retry mapping.../codex/codex-rs/core/tests/suite/client_websockets.rs:1521-1565— reconnect behavior.../codex/codex-rs/login/src/auth/default_client.rs:138-161— synchronous OS-specific user-agent generation.User Impact
Agent edits preserve unrelated formatting, long-lived/background commands retain their finite output without hanging forever, compaction and retry behavior are deterministic, BMP attachments work, the TUI picks up current upstream fixes, and ChatGPT sessions use the current Codex transport contract without changing custom relay request bodies.
Evidence
pnpm check:changed: all-project typecheck, core/extensions/scripts lint, lock/ownership guards, and runtime cycle check passed with no temp-directory warnings.pnpm build: passed; lazy runtime boundary and packaged surfaces verified.blacksmith-testbox, leasetbx_01kwpawtc0xts08q74g94skyqy(silver-lobster), initial run 28703395131.REAL_TOOL_SCENARIO_OK edit find bash bmp.gpt-5.5:LIVE_OPENAI_API_OK input=28 output=12.Provided authentication token is expired. Please try signing in again.The transport behavior is covered by focused tests and the direct Codex source contract above; this remains the explicit live-proof gap..agents/skills/autoreview/scripts/autoreview --mode local --prompt-file /tmp/openclaw-pi-autoreview.md --stream-engine-outputreturned no findings andpatch is correctat 0.93 confidence.AI-assisted implementation and review; maintainer-directed upstream audit and landing workflow.