Skip to content

fix(session): synchronize the engine after foreign session import - #6369

Merged
Hmbown merged 1 commit into
Hmbown:mainfrom
AdityaVG13:fix/resume-import-engine-sync
Sep 20, 2026
Merged

Hmbown merged 1 commit into
Hmbown:mainfrom
AdityaVG13:fix/resume-import-engine-sync

Conversation

@AdityaVG13

@AdityaVG13 AdityaVG13 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #6367 (branch side closed by ffca963f9; this PR closes nothing).

/resume <file> and inline-JSON imports install a whole new conversation —
new session id plus transcript — but return a message-only result, so the
engine stays on the previous session's history and the next turn runs
against the wrong transcript. This carries the existing SessionSyncPayload
on ResumeImportReceipt (same shape as the /branch outcome) and maps it
to the SyncSession action in both import arms, reusing the shared
sync_session_action mapper — no new plumbing.

Also adds the missing unit test for rebranch_active_messages_stamped:
shared prefix keeps ids and stamps, the new suffix keeps live stamps, and
the replaced tail survives as a sibling branch.

Testing

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features --locked (warning-free under the CI allow list)
  • cargo test --workspace --all-features --locked — see note below

Targeted suites, all green on the remote worker (Spark):
session::resume:: 6 passed, stamped_rebranch 1 passed,
codewhale-command-contract --lib 59 passed,
lifecycle_portable_tests 8 passed.

Full-workspace note: the workspace run shows 8 failures, all in files this
diff does not touch, and all attributable to main-side churn or the remote
worker's headless environment:
route::export::golden_providers_export_matches_registry (golden stamped
pre-0.10.0; release prep moved the version),
unknown_model_under_zai_never_infers_deepseek_provider_authority
(provider-authority; zero references to the touched types),
clipboard_is_default_and_stdout_is_explicit and
command_clipboard_export_preserves_structure_and_redacts_secrets
(clipboard backend on a headless worker),
explicit_workspace_config_selects_its_route_without_locking_user_global
(area churned by the session-bound account-model feat on main),
system_prompt_prefix_never_leaks_private_content,
separate_predispatch_crashes_on_one_run_get_distinct_recovery_turn_ids,
launch_mcp_summary_opens_manager_by_click_and_keyboard (PTY).
The app-server crate was excluded on the rerun after its deterministic
failure so the remaining suites could execute; 46 suites passed.

Checklist

  • This PR adds a new layer/module/abstraction — it names or deletes the layer it replaces (N/A: single facet field, existing mapper)
  • Updated docs or comments as needed
  • Added or updated tests where relevant
  • Verified TUI behavior manually if UI changes (N/A: no UI change)
  • Harvested/co-authored credit uses a GitHub numeric noreply address (N/A: no harvested code)

No-Issue: Follow-up to the already closed #6367; synchronizes foreign session imports without closing another issue.

@AdityaVG13
AdityaVG13 requested a review from Hmbown as a code owner September 20, 2026 02:21
/resume <file> and inline-JSON imports install a new conversation without a SyncSession action, leaving the engine on the previous history; the next turn then runs against the wrong transcript. Carry the existing sync payload on ResumeImportReceipt (same shape as the /branch outcome) and map it to the SyncSession action in both import arms.

Also adds the missing unit test for rebranch_active_messages_stamped: the shared prefix keeps ids and stamps, the new suffix keeps live stamps, and the replaced tail survives as a sibling branch.

Follow-up to Hmbown#6367 (branch side closed by ffca963).
@AdityaVG13
AdityaVG13 force-pushed the fix/resume-import-engine-sync branch from bce89cd to f3bc804 Compare September 20, 2026 04:05
@Hmbown
Hmbown merged commit e7816e0 into Hmbown:main Sep 20, 2026
20 of 25 checks passed
@AdityaVG13
AdityaVG13 deleted the fix/resume-import-engine-sync branch September 20, 2026 05:23
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.

bug(/branch): the branch structure is discarded by the save path — abandoned branches and entry ids do not survive

2 participants