Repository navigation
Add /merge command for session context import - #1
Draft
RandyHaddad wants to merge 12 commits into
Draft
RandyHaddad wants to merge 12 commits into
RandyHaddad wants to merge 12 commits into
Conversation
RandyHaddad
force-pushed
the
codex/merge-command
branch
from
June 7, 2026 17:47
2c5320e to
170bbe4
Compare
Catches the branch up to openai/codex (was 387 commits behind). Resolved 5 conflicts: - core/src/lib.rs: keep both `mod merge;` and the BackgroundTerminalInfo re-export - rollout/src/recorder.rs: adopt upstream's generic `items.push(item)` (handles Merged) - state/src/extract.rs + thread-store/.../thread_metadata_sync.rs: handle both RolloutItem::Merged (this PR) and RolloutItem::InterAgentCommunication (upstream) - tui slash_commands test: keep both /merge and /import test cases Cross-variant exhaustiveness compile fixes to follow in a separate commit. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Compile fixes after merging 387 commits of openai/codex into the branch.
All mirror how the current compact code does it:
- ResponseItem::Message and ::Compaction gained id/metadata fields
- TurnContext.features -> turn_context.config.features
- ResponseItem::CompactionTrigger is now a struct variant {id, metadata}
- Prompt.personality field removed
- run_remote_compaction_request_v2 now takes &CodexResponsesMetadata
- build_v2_compacted_history now returns (Vec<ResponseItem>, usize)
- dropped deleted calls (start_next_auto_compact_window, advance_window_generation)
- added Merged / MergedContext match arms in upstream memories + tui code
Verified: cargo check --workspace --all-targets --keep-going passes (exit 0).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
- ISSUE-1: box RawPluginManifestHooks::Inline(Box<HooksFile>) to clear clippy large_enum_variant (warnings are -D in CI) - ISSUE-2/3: regenerate config + app-server schema/TS fixtures for the merge types (ThreadMergeStart, MergedContext, PreMerge/PostMerge, Merge turn kind) - ISSUE-4: update TUI hooks-browser + hooks-popup snapshots (PreMerge/PostMerge) - command_popup test: /merge now matches the "/m" prefix; add it to the expected presentation order (model, memories, merge, mention, mcp) Co-Authored-By: Claude Opus 4.8 <[email protected]>
fabianVagnoni
pushed a commit
that referenced
this pull request
Jun 18, 2026
## Stack 1. [1 of 3] Support long raw TUI goal objectives - openai#27508 2. [2 of 3] Support long pasted text in TUI goals - openai#27509 3. **[3 of 3] Support images in TUI goals** - this PR ## Why The first two PRs make goal definitions resilient to long text, but `/goal` still dropped image inputs from the composer. That meant a user could attach images while defining a goal and the resulting goal continuation would not have any useful reference to those images. Goal state still persists only objective text, so image inputs need to become paths or URLs that the agent can read later. ## What Changed - Extends TUI `GoalDraft` with local image attachments and remote image URLs. - Copies local goal images through the app-server filesystem layer into the managed goal attachment directory, then rewrites active image placeholders to file references. - Appends unplaced local images and remote image URLs to the objective as referenced image files or URLs. - Preserves goal image metadata through live `/goal` submission and queued `/goal` dispatch. ## Verification - Added goal materialization coverage for local image files and remote image URLs. - Added/updated TUI slash-command coverage showing `/goal` drafts include attached images instead of dropping them. ## Manual Testing - Attached an image by bracketed-pasting its local path into a live `/goal` composer. The `[Image #1]` placeholder became a server-host `image-1.png` reference, copied bytes matched exactly, and no attachment was written under the TUI's local home. - Deleted an image placeholder before submitting a small goal and verified no image was copied. - Attached PNG and JPEG files to the same goal. Placeholder order was preserved as `image-1.png` and `image-2.jpg`, and both remote copies matched their source bytes. - Tried extensionless, malformed-extension, and extension/content-mismatched paths; the composer rejected them as image attachments before goal dispatch rather than creating misleading managed image files. - Combined a local image, a large pasted block, and enough raw text to exceed 4,000 characters. The remote attachment directory contained the image, paste sidecar, and `goal-objective.md`; all embedded references used server-host paths and both payloads matched their sources. - Submitted an image replacement while a goal was active, verified no image was copied before confirmation, then canceled and confirmed the attachment count was unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For Humans
This PR adds
/merge: a way to bring the working state from another Codex session back into the current session.Codex already lets a user branch work through forked, resumed, and parallel sessions. The missing piece is the return path. When a side session has done real work, the main session has no structured way to absorb what happened there without a manual handoff.
Generated by Codex using GPT Image.
The command keeps the user in the current session, imports another session as background context, leaves the source session untouched, and records the import as a visible merge history item. It does not merge Git branches, files, or worktrees.
For Agents
Summary:
/mergeslash command for importing source-session context into the current target session.MergedItemcheckpoint with provenance and visible history markers.What changed:
Verification:
CARGO_NET_GIT_FETCH_WITH_CLI=true cargo check -p codex-protocol -p codex-config -p codex-hooks -p codex-core -p codex-app-server-protocol -p codex-app-server -p codex-tui -p codex-analyticsCARGO_NET_GIT_FETCH_WITH_CLI=true cargo test -p codex-core merge::testsCARGO_NET_GIT_FETCH_WITH_CLI=true cargo test -p codex-hooks generated_hook_schemas_match_fixturesCARGO_NET_GIT_FETCH_WITH_CLI=true cargo test -p codex-hooks loads_generated_hook_schemasCARGO_NET_GIT_FETCH_WITH_CLI=true cargo test -p codex-tui slash_mergeCARGO_NET_GIT_FETCH_WITH_CLI=true cargo test -p codex-app-server-protocol builds_visible_marker_from_merged_itemReview note:
This is an internal fork PR for Randy/Elie review before opening anything against
openai/codex.