Skip to content

fix(sessions): restore valid modes when continuing imported history - #3439

Merged
kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:codex/fix-imported-session-mode
Oct 18, 2026
Merged

kev1n77 merged 1 commit into
GCWing:mainfrom
kev1n77:codex/fix-imported-session-mode

Conversation

@kev1n77

@kev1n77 kev1n77 commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix Unknown session mode: primary when sending the first message from a followed Codex/Zcode history or retrying a previously created native branch.

  • Register source views with the native Standard mode, keeping primary only as the model selector.
  • Project the known legacy imported primary shape to Standard when reading metadata and snapshots, including existing native branches.
  • Use the host's returned fork mode and correct retained failed-queue parameters while preserving valid user-selected modes.
  • Keep raw history and repair journals intact; recognize the retired placeholder during legacy history comparison without masking real mode/content edits.

Related: #3424. Rebased onto main after #3438 merged. This PR contains only the mode fix and its regression coverage.

Type and Areas

Type: Bug fix, regression tests, docs.

Areas: Rust session metadata and external-history compatibility; Web UI fork/submission and failed-message retry.

Motivation / Impact

The external-history registration path stored the model selector primary as the session mode. Fork creation succeeded, but the subsequent message was rejected by runtime mode admission. The frontend could also replay that stale value over a corrected branch, including from a failed queue entry.

New branches use a valid native mode. Existing imported records and branches remain readable without manual data edits, and their queued drafts can be retried after the application is rebuilt and restarted. Historical turns and provenance are retained, and unrelated custom modes or external runtime bindings are not treated as aliases.

Verification

Rebased onto upstream/main at 7e79a4840, which includes #3438. The compatibility projection runs through the shared metadata overlay used by cold reads, cache hits, and refreshed views. The legacy v1 fixture verifies corrected modes on cold and warm reads, one snapshot read, a shared history body, and unchanged snapshot/index bytes.

cargo test --locked -p openbitfun-core --no-default-features --features external-sources,git,product-search --lib -- external_session_import:: agentic::persistence::manager::tests session_fork_ agentic::persistence::session_branch::tests agentic::session::session_manager::tests::restore_session_ legacy_imported_primary_branches_resolve_real_turn_modes --quiet
cargo test --locked -p openbitfun-services-core --no-default-features --features local-storage --lib -- session::metadata_store::tests session::metadata::tests session::types::tests session::offline_import::tests --quiet
pnpm --dir src/web-ui exec vitest run --maxWorkers=50% src/flow_chat/components/ExternalHistoryNotice.test.tsx src/flow_chat/utils/externalHistory.test.ts src/flow_chat/services/flow-chat-manager/MessageModule.test.ts src/flow_chat/services/flow-chat-manager/PendingQueueModule.test.ts src/flow_chat/services/flow-chat-manager/SessionModule.test.ts src/flow_chat/store/FlowChatStore.test.ts src/flow_chat/components/modern/UserMessageItem.test.tsx src/flow_chat/hooks/useMessageSender.test.tsx
pnpm run check:web
git diff --check upstream/main...HEAD
node scripts/check-git-object-sizes.mjs --base upstream/main --head HEAD
  • Core: 139 passed, 4 ignored; storage: 57 passed; frontend: 443 passed across 8 files.
  • check:web, including TypeScript checking, passed after regenerating the unchanged upstream MiniApp CSS with node scripts/generate-miniapp-chat-styles.mjs for this Windows checkout's line endings. Normalized content was identical; the temporary generated-file change is excluded from the PR.
  • Tests cover real runtime mode admission, old snake-case payloads and round trips, unchanged source bytes, existing branches, pinned snapshots, failed-queue retry, explicit mode selection, older hosts omitting the fork mode, and legacy repair/edit detection.

Reviewer Notes

  • The compatibility projection requires recognized Codex/Zcode provenance and a source identity. It is not a global alias for primary.
  • The rebase conflict in deferred/tracking.rs is resolved by retaining mode normalization in overlay_view_metadata, preserving perf(sessions): page catalogs and share external history snapshots #3438's cache and paging behavior. Cold and warm legacy-snapshot regression coverage confirms the mode projection without rewriting stored history or the index.
  • No live desktop/model send, remote workspace, remote control, Peer Device Mode, or Detached Dispatch run was performed. Focused mode-admission and compatibility tests are not evidence of those end-to-end scenarios.
  • AI-assisted. Testing level: lightly tested, with focused automated coverage and no end-to-end run.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@kev1n77
kev1n77 force-pushed the codex/fix-imported-session-mode branch from d28be4c to df57dd7 Compare October 17, 2026 16:47
@kev1n77
kev1n77 merged commit 0880d34 into GCWing:main Oct 18, 2026
13 checks passed
@kev1n77
kev1n77 deleted the codex/fix-imported-session-mode branch October 18, 2026 06:38
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