Skip to content

[codex] Sync Codex update_plan calls to draft PRs#11

Merged
skulidropek merged 1 commit into
ProverCoderAI:mainfrom
skulidropek:issue-10
Jun 17, 2026
Merged

[codex] Sync Codex update_plan calls to draft PRs#11
skulidropek merged 1 commit into
ProverCoderAI:mainfrom
skulidropek:issue-10

Conversation

@skulidropek

Copy link
Copy Markdown
Member

Summary

  • import structured Codex update_plan function calls from ~/.codex/sessions as PR-syncable plan items
  • allow queued plan comments to post to open draft PRs
  • update integration coverage and README/changelog notes

Verification

Fixes #10

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 71233f99-c62b-405e-886b-944078a0118a

📥 Commits

Reviewing files that changed from the base of the PR and between 4ea21d6 and f5501ee.

📒 Files selected for processing (8)
  • README.md
  • changelog.d/20260617_codex_update_plan_import.md
  • changelog.d/20260617_sync_draft_prs.md
  • src/codex_history.rs
  • src/github.rs
  • src/main.rs
  • tests/integration/cli.rs
  • tests/integration/support.rs

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Structured plan updates from Codex are now imported and synced to pull requests
    • Plan comments now post to draft pull requests immediately instead of remaining queued
  • Bug Fixes

    • Fixed Codex history import to properly capture and queue structured plan updates
  • Documentation

    • Updated documentation clarifying MVP support, import behavior, and PR sync mechanics

Walkthrough

Two behavioral fixes are introduced: (1) the GitHub sync layer removes DraftPullRequest as a distinct outcome so open draft PRs now receive plan comments, and (2) the Codex history importer gains an event_plans helper that recognizes structured update_plan function-call events and converts their JSON arguments into CapturedPlan objects queued for PR sync. Tests, docs, and changelogs are updated accordingly.

Changes

Draft PR Comment Sync

Layer / File(s) Summary
SyncStatus enum and sync logic
src/github.rs, src/main.rs
SyncStatus drops the DraftPullRequest variant, PullRequest loses the is_draft field, and sync_to_pull_request removes the draft early-return so any OPEN PR (draft or not) proceeds to comment posting. print_sync_status removes the matching arm and adds {state} to the closed-PR message.
Draft PR tests and fake gh script
tests/integration/support.rs, tests/integration/cli.rs, changelog.d/20260617_sync_draft_prs.md
Fake gh script for draft PRs now accepts POST comment API calls and returns {"id":12345}; hook and sync integration tests updated to assert comment posting on draft PRs instead of prior queued/no-send behavior.

Codex update_plan Function Call Import

Layer / File(s) Summary
event_plans helper and update_plan parsing
src/codex_history.rs
Adds CapturedPlan to imports; replaces single-message extraction with event_plans that returns Vec<CapturedPlan> from either marked assistant messages or update_plan function-call JSON arguments converted to titled Markdown (# Codex Plan, optional explanation, ## Steps list). Events yielding zero plans are skipped early.
Import unit and integration tests
src/codex_history.rs, tests/integration/cli.rs, changelog.d/20260617_codex_update_plan_import.md
Adds update_plan_line JSONL test helper and a unit test asserting formatted title/content/timestamp; two new integration tests verify state backfill and PR comment posting for sessions containing structured update_plan calls.

README Documentation Updates

Layer / File(s) Summary
README behavior and safety docs
README.md
MVP bullet points, PR-comment discovery rule, queued-item lifecycle, and Safety section updated to cover draft PR posting, update_plan backfill, deduplication via state file, and explicit plan-artifact import constraints.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • ProverCoderAI/plan-to-git#3: Established the core plan-to-git MVP including the Codex history importer and GitHub sync logic that this PR directly extends.
  • ProverCoderAI/plan-to-git#8: Introduced explicit PR sync, SyncStatus, and sync_to_pull_request — the same code paths modified here to remove the draft short-circuit.

Poem

🐰 Hop hop, the draft PR waits no more,
Plans now post where drafts once sat before.
update_plan calls parsed line by line,
Steps and statuses formatted fine.
No more zero-plans in the queue's despair —
Every plan synced with bunny-born care! 🌿

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@skulidropek skulidropek marked this pull request as ready for review June 17, 2026 20:18
@skulidropek skulidropek merged commit 3b911f7 into ProverCoderAI:main Jun 17, 2026
9 of 10 checks passed
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.

Почему-то планы всё ранво не доходят до PR

1 participant