Skip to content

docs(codex): document native compaction hooks - #70906

Closed
vincentkoc wants to merge 1 commit into
mainfrom
docs/codex-native-compaction-hooks
Closed

vincentkoc wants to merge 1 commit into
mainfrom
docs/codex-native-compaction-hooks

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • document Codex native PreCompact / PostCompact hooks as Codex-owned command hooks
  • clarify that OpenClaw before_compaction / after_compaction remain adapter-level plugin hook events
  • note that OpenClaw uses the app-server compaction item stream for plugin hook compatibility and does not double-fire hooks when Codex native hooks exist

Dependency

Validation

  • pnpm format:check -- docs/plugins/codex-harness.md docs/concepts/compaction.md
  • pnpm docs:list
  • pnpm check:changed

@vincentkoc vincentkoc self-assigned this Apr 24, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS maintainer Maintainer-authored PR labels Apr 24, 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jun 14, 2026
@clawsweeper

clawsweeper Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 3, 2026, 3:04 AM ET / 07:04 UTC.

Summary
The PR updates Codex compaction docs to distinguish native Codex PreCompact/PostCompact command hooks from OpenClaw adapter-level before_compaction/after_compaction plugin-hook observations.

PR surface: Docs +26. Total +26 across 2 files.

Reproducibility: not applicable. this is a documentation PR rather than a runnable bug report. The review path is source-backed docs consistency against current OpenClaw and sibling Codex source.

Review metrics: 2 noteworthy metrics.

  • Sibling Docs Drift: 1 conflicting runtime table row. The changed docs and runtime contract page would publish different Codex compaction-hook guidance that formatting checks will not catch.
  • Upstream Hook Provenance: 1 closed-unmerged PR, 1 merged implementation PR. The dependency-backed docs change should point reviewers at the landed Codex behavior instead of an abandoned upstream PR.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Update docs/plugins/codex-harness-runtime.md so the compaction intervention row matches the Codex-owned native hook boundary.
  • Replace the PR body dependency on openai/codex pull request 19060 with the merged openai/codex pull request 19905 provenance.
  • Refresh the draft branch against current main so reviewers can inspect the final merge result.

Risk before merge

  • [P1] Merging as-is would publish contradictory Codex compaction-hook guidance: the changed pages say native compact hooks are Codex-owned command hooks, while the runtime contract page still points to Codex pre/post compaction hooks as the future plugin veto/rewrite path.
  • [P1] The PR body still points reviewers at a closed-unmerged upstream dependency instead of the merged openai/codex pull request that currently proves the hook behavior.
  • [P1] GitHub reports the draft branch as CONFLICTING/DIRTY, so maintainers cannot rely on the current diff as the final merge result.

Maintainer options:

  1. Align Runtime Docs And Provenance (recommended)
    Update docs/plugins/codex-harness-runtime.md and the PR dependency note so every Codex compaction-hook page describes one current contract.
  2. Keep The Draft Paused
    Leave the maintainer-owned draft open until the branch is refreshed and the docs consistency issue is resolved.

Next step before merge

  • [P2] The PR is a protected maintainer-authored draft with a docs consistency blocker, stale PR-body provenance, and dirty merge state, so it needs author or maintainer refresh rather than automated cleanup.

Security
Cleared: Docs-only changes do not introduce code execution, dependency, workflow, secret, package, or supply-chain surface.

Review findings

  • [P2] Keep the runtime contract page in sync — docs/plugins/codex-harness.md:540-544
Review details

Best possible solution:

Refresh the draft, update the runtime contract page to match the Codex-owned native hook boundary, and cite the merged upstream Codex hook implementation before normal maintainer review.

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

Not applicable; this is a documentation PR rather than a runnable bug report. The review path is source-backed docs consistency against current OpenClaw and sibling Codex source.

Is this the best way to solve the issue?

No, not as-is. The clarification belongs in the right docs layer, but the maintainable solution also updates the sibling runtime contract page, replaces the stale upstream dependency reference, and refreshes the conflicted draft branch.

Full review comments:

  • [P2] Keep the runtime contract page in sync — docs/plugins/codex-harness.md:540-544
    The patch says Codex PreCompact/PostCompact are separate Codex command hooks that do not replace OpenClaw plugin hooks, but docs/plugins/codex-harness-runtime.md still says the future path for compaction intervention is adding Codex pre/post compaction hooks when plugins need veto or rewrite. That would publish two different contracts, so update the runtime page to match the Codex-owned native hook boundary.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8ed6c78b7891.

Label changes

Label justifications:

  • P3: This is a low-urgency docs clarification with no direct runtime, security, or data-loss impact.
  • merge-risk: 🚨 other: Merging as-is could publish contradictory Codex hook-contract documentation that normal CI does not settle.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required because this PR only changes files under docs/.
Evidence reviewed

PR surface:

Docs +26. Total +26 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 2 31 5 +26
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 31 5 +26

What I checked:

Likely related people:

  • vincentkoc: They authored this docs PR and the earlier upstream Codex compact-hook PR that the merged upstream implementation credits. (role: upstream hook originator and docs branch author; confidence: medium; commits: b67dc65cca04, 44dd1fc42ba8; files: docs/concepts/compaction.md, docs/plugins/codex-harness.md, ../codex/codex-rs/hooks/src/events/compact.rs)
  • pashpashpash: Merged OpenClaw pull request 70969 added native Codex hook notification projection and related docs boundary text. (role: adjacent native hook projection contributor; confidence: high; commits: 41c5ffc5d5f4; files: extensions/codex/src/app-server/event-projector.ts, extensions/codex/src/app-server/event-projector.test.ts, docs/plugins/codex-harness.md)
  • 100yenadmin: Merged OpenClaw pull request 70772 carried adjacent Codex harness seam and docs work referenced from this PR timeline. (role: adjacent harness-seam contributor; confidence: medium; commits: c13836804058; files: docs/plugins/codex-harness.md, extensions/codex/src/app-server/run-attempt.ts, src/agents/harness/types.ts)
  • eternal-openai: Merged openai/codex pull request 19905 added the native PreCompact and PostCompact implementation this PR documents. (role: upstream Codex hook implementer; confidence: medium; commits: 527d52df03a9; files: ../codex/codex-rs/hooks/src/lib.rs, ../codex/codex-rs/hooks/src/events/compact.rs, ../codex/codex-rs/app-server-protocol/src/protocol/v2/config.rs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed 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 Jun 20, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 3, 2026
@steipete

steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closing this stale docs draft rather than replaying it.

The upstream situation changed: openai/codex#19060 closed unmerged, while openai/codex#19905 later landed PreCompact and PostCompact. I verified the current contract directly in Codex be33f80bc65159c094ecd06bf155afa3061ce23d (codex-rs/protocol/src/protocol.rs, codex-rs/config/src/hook_config.rs, and codex-rs/hooks/src/events/compact.rs).

Current OpenClaw docs already preserve the important boundary: native Codex hook notifications are projected as codex_app_server.hook trajectory events and do not invoke OpenClaw plugin hooks; OpenClaw compaction lifecycle hooks remain adapter observations. The current native relay also does not bridge PreCompact or PostCompact. Replaying this old wording would mostly duplicate that guidance while leaving docs/plugins/codex-harness-runtime.md's compaction-intervention row inconsistent.

The durable contract should stay concise and source-owned; if OpenClaw later relays native compact hooks or exposes intervention semantics, that code change should update the runtime table with exact behavior. Thanks for starting the upstream work, @vincentkoc.

@steipete steipete closed this Jul 6, 2026
@shakkernerd
shakkernerd deleted the docs/codex-native-compaction-hooks branch October 19, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants