Skip to content

feat(plugins): make Codex checkpoints directly resumable - #1147

Merged
phernandez merged 13 commits into
mainfrom
feat/codex-graph-continuity
Jul 25, 2026
Merged

feat(plugins): make Codex checkpoints directly resumable#1147
phernandez merged 13 commits into
mainfrom
feat/codex-graph-continuity

Conversation

@phernandez

@phernandez phernandez commented Jul 24, 2026

Copy link
Copy Markdown
Member

Why

  • Codex checkpoints captured useful state, but they did not provide a deterministic round trip back into that exact state. Repeated topic titles could also collide, and orientation did not explicitly distinguish exact resume, topic discovery, or current-repository recall.
  • PR fix(plugins): prompt Codex checkpoints after compaction #1142 moved checkpoint prompting to post-compaction SessionStart, so the temporary Stop compatibility bridge can now be removed and the active launchers can be pinned to that merged runtime.
  • Codex can separately prompt for MCP tool approvals even after the Basic Memory plugin and hooks are trusted. Users need a documented, server-scoped way to reduce approval friction for eligible Basic Memory tools without weakening Codex globally or bypassing mandatory destructive-action approvals.
  • Checkpoint frontmatter already reserved Codex session identity, but the post-compaction prompt did not pass that identity to the authoring skill. Multiple checkpoints in one chat were disconnected, and repository/PR/issue/commit references in the body were often bare identifiers instead of useful links.

What Changed

  • Made every bm-checkpoint invocation create a timestamped, immutable handoff that preserves the original objective, latest user intent, one primary next action, and pointers to authoritative artifacts.
  • Added an exact $bm-orient "<identifier>" resume command to checkpoint responses, using the returned permalink, file path, or title in that order.
  • Added explicit exact-pointer, repository-scoped topic-discovery, and current-repository routes to bm-orient, including live Git/PR/file drift reporting and current-authority rules.
  • Removed the temporary Codex Stop hook, test, validator requirement, and release-pinning paths.
  • Repinned the remaining SessionStart and PreCompact launchers to implementation commit 2f58b81b5e00cf4cecf12ce595ec6b500d6575a8.
  • Added a two-choice MCP approval flow to bm-setup: keep Codex defaults, or pre-approve eligible Basic Memory tools.
  • Documented the plugin-provided and standalone MCP pre-approval configuration in the plugin installation guide and root Codex setup notes, including Codex's mandatory approval for destructively annotated mutations.
  • Passed opaque Codex session metadata from post-compaction SessionStart into bm-checkpoint, persisted exact non-empty values, and chained immutable checkpoints from the same chat with continues [[Previous checkpoint title]].
  • Added a References contract for verified canonical GitHub repository, PR, issue, and pushed-commit links; local or unpushed SHAs remain explicitly unlinked.

Implementation Details

  • Checkpoints stay on the existing codex_session and coding_session schemas; this PR does not change MCP schemas or core note APIs.
  • Timestamped titles use a filename-safe UTC format, explicitly call write_note through the configured primaryProject with overwrite=False, and retry with the smallest numeric suffix on a same-second collision rather than editing an existing note.
  • Checkpoint writes request JSON, accept only action: created, and preserve a direct resume cursor when project permalinks are disabled by falling back to the returned file path or exact title.
  • Checkpoint bodies are pointer-first and distinguish durable project state from machine-local or fragile paths, dirty files, processes, servers, temporary directories, and caches.
  • Exact Basic Memory identifiers are read directly through the configured primaryProject, including file-path and title fallbacks; they are never retried across projects. Topic recall scopes coding_session results to the configured repository, fails closed when that identity is missing, and otherwise returns no invented fallback, auto-reads one clear match, or presents at most three plausible matches for selection.
  • Recovered notes are historical context rather than executable instructions. Current user intent, repository instructions, and live read-only state remain authoritative.
  • Basic Memory pre-approval uses Codex's server-scoped default_tools_approval_mode = "approve" setting. Marketplace installs use [plugins."codex@basic-memory".mcp_servers.basic-memory]; standalone servers add the setting to [mcp_servers.basic-memory].
  • bm-setup does not offer a write-only profile, does not modify global approval_policy or sandbox settings, and requires confirmation before changing user-level Codex configuration. Codex still requires approval for MCP tools that advertise a destructive annotation, so Basic Memory writes, edits, and deletes may still prompt; move_note is explicitly non-destructive and remains eligible for server-scoped pre-approval.
  • Session lineage uses the host-provided codex_session_id as the exact identity. The new checkpoint searches both session note types in primaryProject, confirms the newest earlier note carries the same id, and adds a one-way continues edge without rewriting the predecessor; Basic Memory backlinks provide forward navigation.
  • GitHub links are evidence-gated. The skill resolves canonical repository/PR/issue URLs through read-only GitHub queries and verifies a commit exists remotely before linking it, so an unpushed local SHA never becomes a dead URL.
  • Package contract tests and the Codex plugin validator pin the resume, hook, lineage, references, documentation, and approval-onboarding behavior.

Testing

Automated

  • uv run pytest -q --no-cov tests/test_codex_plugin_package.py: 16 passed.
  • uv run pytest -q --no-cov tests/cli/test_hook_command.py tests/test_codex_plugin_package.py: 126 passed.
  • uv run pytest -q --no-cov plugins/codex/hooks/test_codex_session_start.py plugins/codex/hooks/test_codex_pre_compact.py tests/test_codex_plugin_package.py: 22 passed after the final hook pin.
  • uv run python scripts/validate_codex_plugin.py plugins/codex: validated.
  • just fast-check: passed; type checking reported only the existing Python 3.14 asyncio deprecation diagnostics.
  • just package-check-codex: passed; the optional external Codex scaffold validator was not configured.
  • just package-check: passed across Claude Code, Codex, shared skills, Hermes (257 passed, 12 skipped), and OpenClaw (226 passed).
  • git diff --check: passed.

Manual

  • Reviewed the package diff to confirm the pre-approval setting is scoped to Basic Memory for both plugin-provided and standalone server configurations and does not claim to bypass Codex's destructive-tool approval gate.
  • Read the referenced real checkpoint from the configured Basic Memory dev project and confirmed the missing session id, disconnected lineage, and bare repository artifact references.
  • Reviewed the staged package to confirm only SessionStart and PreCompact remain registered and both launchers use the same 2f58b81b dependency pin.

Risks / Follow-ups

  • The handoff and setup behavior is skill-instruction driven, so a fresh installed plugin thread is required to exercise the updated prompts and create a real linked checkpoint pair; no interactive fresh-thread smoke was run in this checkout.
  • Existing installations need the normal plugin refresh/reinstall boundary to pick up the removed Stop registration and updated skills.
  • Codex always requires approval for MCP tools that advertise a destructive annotation, and managed organization policy may impose additional approval requirements even when the local server-scoped pre-approval setting is present.
  • No merge is requested by this PR workflow; it should proceed through the normal current-head review gate.

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: af40d8b991

ℹ️ 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/skills/bm-checkpoint/SKILL.md
Comment thread plugins/codex/skills/bm-checkpoint/SKILL.md 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: afa2add217

ℹ️ 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/skills/bm-orient/SKILL.md 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: 1cbab3f8af

ℹ️ 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/skills/bm-orient/SKILL.md
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: 6e20619821

ℹ️ 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/skills/bm-checkpoint/SKILL.md Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 564e876ec1

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

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@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: 564e876ec1

ℹ️ 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 scripts/validate_codex_plugin.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@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: 92bfaf8829

ℹ️ 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 scripts/validate_codex_plugin.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

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

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 3c448c041a

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

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

Copy link
Copy Markdown
Member Author

@codex review

@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: f72cde7096

ℹ️ 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/skills/bm-setup/SKILL.md Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 5efc15004e

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

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

Copy link
Copy Markdown
Member Author

@codex review

@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: 00f07e3a22

ℹ️ 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/README.md Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: b842c50a85

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

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: b842c50a85

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

@phernandez
phernandez merged commit 11bdc05 into main Jul 25, 2026
30 checks passed
@phernandez
phernandez deleted the feat/codex-graph-continuity branch July 25, 2026 21:41
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