Skip to content

[Engine] Fix a crash on restore: resume at the mounted depth, not the prompt's prefix (1/4 of #7648) - #7650

Open
giphoo wants to merge 1 commit into
Niko1221:mainfrom
giphoo:pr/7648-resume-at-mount-depth
Open

giphoo wants to merge 1 commit into
Niko1221:mainfrom
giphoo:pr/7648-resume-at-mount-depth

Conversation

@giphoo

@giphoo giphoo commented Dec 2, 2026 •

Copy link
Copy Markdown

Part 1/4 of #7648 — the smallest and most urgent piece: a real crash on the restore path.

Problem and result

Before: when a restore lands at a checkpoint depth (a fork, or a partial mount), the engine asks for a checkpoint of exactly the common-prefix length. If none exists, it answers ERR restoring a conversation checkpoint failed and exits.

After: the engine resumes at the depth actually mounted, and treats a partial mount as a live state. The failing case no longer occurs.

Background

Long agent conversations that alternate between sessions need the on-disk conversation cache. When a restore lands at a checkpoint depth (a fork, or a partial mount), the engine can exit.

The bug

Two admissions ask the restored image for a checkpoint of exactly the common-prefix length. When the image's live state is longer than the prompt (a fork reading a prefix), no such checkpoint exists, so the engine answers ERR restoring a conversation checkpoint failed and exits.

This happens on the native path too — it is not specific to our additions.

The fix

  • Resume at the depth actually mounted (incoming->live.ids.size()), not at the prompt's common prefix;
  • Treat a partial mount as a live state at its depth, so the admission mounts it as one.

Review focus

  • The resume depth is now the mounted depth, not the prompt's LCP;
  • A partial mount is treated as a live state;
  • No new switches, no behavior change when the bug does not trigger.

Validation

  • Full engine build on the PR tree (upstream main + this patch): rc=0, zero errors;
  • The failing case before the patch (ERR restoring a conversation checkpoint failed) no longer occurs.

Fixes part 1/4 of #7648. Parts 2–4 follow in order.

…common prefix (Niko1221#7648)

Two admissions asked the restored image for a checkpoint of exactly the common-prefix
length.  When the image's live state is longer than the prompt (a fork reading a prefix
of it), that length is no checkpoint's depth: the lookup found nothing and the engine
ended with "ERR restoring a conversation checkpoint failed".

- SSD tier: the resume lands on the deepest checkpoint at or below the prefix; with
  none, the prompt is read from 0 rather than mounting a state the request overwrites.
- Borrowing a parked conversation whose match was its live state: the borrow mounts
  that state, so the resume is a live mount.  A checkpoint match keeps its depth,
  which is a checkpoint.

Fixes Niko1221#7648.
@github-actions github-actions Bot added the needs-format Title or template does not follow CONTRIBUTING.md yet label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Thanks for the pull request. To keep the tracker readable, every item needs an area prefix in the title and the parts of the pull request template filled in. This one is missing:

  • Fill in "Problem and result": what triggered the change, and how it behaves before and after.

Edit the pull request (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

@github-actions github-actions Bot removed the needs-format Title or template does not follow CONTRIBUTING.md yet label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Thanks, this follows the format now.

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