Skip to content

fix(plugins): prompt Codex checkpoints after compaction#1142

Open
phernandez wants to merge 15 commits into
mainfrom
fix/codex-checkpoint-session-start
Open

fix(plugins): prompt Codex checkpoints after compaction#1142
phernandez wants to merge 15 commits into
mainfrom
fix/codex-checkpoint-session-start

Conversation

@phernandez

@phernandez phernandez commented Jul 22, 2026

Copy link
Copy Markdown
Member

Why

PR #1138 used a PreCompact-to-Stop request handshake so Codex could author
durable checkpoints instead of promoting lifecycle telemetry into graph notes.
A real reinstall showed that request files accumulated while later compactions
produced no checkpoint notes: Stop is not a reliable post-compaction entrypoint.

Codex does provide a deterministic entrypoint after compaction: SessionStart
runs again with the compact trigger, and the resumed model has the compacted
working context needed to write a useful handoff. Checkpoints should happen by
default without a plugin-authored security scan second-guessing the model's
Basic Memory write.

What Changed

  • Prompt codex:bm-checkpoint from post-compaction SessionStart and keep
    checkpointOnCompact enabled by default; an explicit JSON false opts out.
  • In the new runtime, keep PreCompact limited to local lifecycle-envelope
    capture and retire Stop coordination. The bundled plugin temporarily keeps
    the old Stop shim registered while its scripts remain on the previous
    durable runtime, so checkpoints continue during the two-PR pin rollout.
  • Remove the Codex checkpoint privacy/redaction gate from the checkpoint,
    setup, and status skills.
  • Remove checkpointPrivacyReview, redactKeys, and redactPaths from the
    Codex plugin contract. Ignore the retired privacy-review toggle, while
    preserving existing redaction lists only for local lifecycle envelopes.
  • Default checkpoint folders to codex/<repo-dir>, decisions to
    codex/decisions, and lightweight memories to codex/remember.
  • Keep the SessionStart and PreCompact shims pinned to durable merged runtime
    c28159d2077158c4f596fb62f351e6e9012b95a5. After this PR merges, a
    dependency-only follow-up will pin all shims to its durable merge commit and
    remove the Stop bridge, matching the established fix(plugins): author Codex checkpoints after compaction #1138/fix(plugins): pin Codex hooks to merged runtime #1140 rollout.

Implementation Details

Codex ignores PreCompact stdout. After compaction, _session_start() recognizes
the Codex compact trigger and prefixes the normal Basic Memory orientation
brief with the deliberate checkpoint instruction. The prompt remains available
when graph orientation is temporarily unavailable.

The checkpoint skill now moves directly from evidence gathering to writing the
durable handoff. There is no optional privacy-review branch and no fail-closed
plugin instruction that can block write_note. Codex config still merges user
settings followed by project overrides. checkpointPrivacyReview is discarded
after resolution. Existing redactKeys and redactPaths lists remain available
only to the separate local lifecycle-envelope capture path, so removing the
checkpoint gate does not weaken an existing inbox deny rule.

This removal is scoped to the Codex plugin's model-authored checkpoint gate.
Core lifecycle-envelope handling and the separate Claude plugin behavior are
unchanged.

Testing

Automated

  • BASIC_MEMORY_ENV=test LOGFIRE_IGNORE_NO_CONFIG=1 uv run pytest -q --no-cov plugins/codex/hooks tests/cli/test_hook_command.py tests/test_codex_plugin_package.py
    — 132 passed.
  • just fast-check — passed; type checking reported nine existing Python 3.14
    asyncio deprecation warnings.
  • just package-check-codex — passed after restoring the durable hook pin.
  • just package-check — passed across Claude Code, Codex, shared skills,
    Hermes, and OpenClaw; Hermes reported 257 passed / 12 opt-in integration
    skips and OpenClaw reported 226 passed.
  • BASIC_MEMORY_ENV=test LOGFIRE_IGNORE_NO_CONFIG=1 just doctor — passed.
  • git diff --check — passed.
  • git merge-base --is-ancestor c28159d2077158c4f596fb62f351e6e9012b95a5 origin/main
    — passed.

Risks / Follow-ups

  • Existing Codex redaction config no longer affects model-authored checkpoints,
    but continues to protect lifecycle envelopes for backward compatibility.
  • Checkpoint prompting depends on Codex continuing to emit SessionStart with
    trigger = "compact"; package tests distinguish that event from startup.
  • Existing private checkpoint-request files from older installs remain inert
    on disk rather than being deleted during upgrade.
  • The merged implementation must be followed by the dependency-only hook
    repin before installed marketplace shims execute the new runtime; that
    follow-up also removes the temporary Stop bridge.
  • A marketplace reinstall/restart/compaction smoke should be performed after
    that repin lands.

Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5aa5728829

ℹ️ 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".

Comment thread src/basic_memory/cli/commands/hook.py
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53136dd728

ℹ️ 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".

Comment thread plugins/codex/hooks/session_start.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 911b511589

ℹ️ 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".

Comment thread src/basic_memory/cli/commands/hook.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d1c5509f6

ℹ️ 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".

Comment thread plugins/codex/hooks/session_start.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b559421212

ℹ️ 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".

Comment thread plugins/codex/hooks/hooks.json Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant