Skip to content

feat(core): snapshot the workspace before a run's first change and add qq undo - #482

Merged
lg2m merged 12 commits into
mainfrom
feat/v0110-snapshots
Oct 27, 2026
Merged

lg2m merged 12 commits into
mainfrom
feat/v0110-snapshots

Conversation

@lg2m

@lg2m lg2m commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #481.

What changes for users

  • Snapshot. Before a run first changes files in a Git work tree, QQ records the working tree, including untracked files, as a hidden commit under refs/qq/snapshots/<run-id>. The trigger is the first edit, write, shell command that isn't provably read-only, external tool, or write sub-agent. The last 50 snapshots per repository are kept.
  • What isn't touched. The user's index, stash, branches and HEAD stay as they are.
  • When there is no snapshot. Runs outside Git get none. A failed snapshot logs a warning and the run continues.
  • qq undo. It restores the newest run's snapshot for the current directory. qq undo --list lists snapshots and qq undo NAME picks one.
    • It records the current state first and prints the qq undo NAME that reverses it.
    • It restores only files under the workspace. When HEAD has moved since the snapshot, it says so.
  • Not covered: ignored files, untracked files over 16 MiB (left in place on restore), anything outside the workspace, and remote effects. The CLI and permissions guides say so.

No wire or store changes. The trigger is a new field on an internal qq-core runtime event.

Verification

  • qq-core undo:: unit tests:
    • restoring edits, deletions and new files without touching the index or stash;
    • an undo that is itself undone;
    • a subdirectory workspace;
    • a commit made after the snapshot;
    • a repository with no commits;
    • outside Git;
    • skipping large untracked files;
    • pruning;
    • scratch-index cleanup.
  • sessions::tests::undo:
    • a scripted run is snapshotted before its first write, and restoring the snapshot brings back the user's state;
    • a read-only run takes no snapshot.
  • Real binary with the verify-qq fake provider: the run read a file, wrote a file and ran rm draft.txt && echo built > out.txt. qq undo restored tracked.txt, brought back draft.txt and removed out.txt. Running the printed qq undo NAME brought the changes back.
  • cargo xtask check passes.

Known gaps

  • Snapshot time on large repositories isn't measured. It's about the cost of git add -A with a copied index.
  • The TUI /undo command comes in a later PR.
  • xtask/src/legacy-sleeps.txt is renumbered because its entries are keyed by line and two new module lines shifted them.

lg2m added 3 commits October 26, 2026 14:32
Replace the core stabilization plan (rows 1-5 shipped) with the v0.1.10
plan: Auto in place with sandboxed writes and host network, long-running
shell commands, tool-call recovery, permission deletion and actionable
denials, prompt and skill fixes. Evidence comes from a live default-Auto
probe and a session-store recount for 2026-10-03..23.

Delete the seven dated research snapshots and the auth-providers plan
(PRs 1-3 merged; PR4/PR5 carried into the new plan), repointing links to
pinned blobs at 2cafa65. Mark ADR-0042 superseded by #476 and fix the
ADR-0064 index status. Correct stale reviewer, trust-prompt, Jev-routing
and soak-oracle claims in design, guide and runbook pages, and mark the
desktop/fleet plan deferred.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-27T09:22:46.293501Z f5e41fc New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 431d82c73a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved
Comment thread crates/qq-core/src/undo.rs Resolved
Base automatically changed from docs/v0110-plan to main October 27, 2026 05:14
@lg2m

lg2m commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f0b75bb24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved
Comment thread crates/qq-core/src/undo.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80927f3014

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved
Comment thread crates/qq-core/src/undo.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e023c2f178

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6168ecf086

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa4e16bf53

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved
Comment thread src/undo.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9075e981a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved
Comment thread crates/qq-core/src/undo.rs Resolved
Comment thread crates/qq-core/src/undo.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb48a15a85

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/qq-core/src/undo.rs Resolved
Comment thread src/undo.rs Resolved
@lg2m
lg2m added this pull request to stack #484 October 27, 2026 16:06
@lg2m
lg2m merged commit 1865254 into main Oct 27, 2026
9 checks passed
@lg2m
lg2m deleted the feat/v0110-snapshots branch October 27, 2026 16:36
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