Skip to content

fix(workbench): share scan history across linked worktrees - #456

Open
mldangelo-oai wants to merge 30 commits into
mainfrom
mdangelo/codex/share-linked-worktree-scan-history
Open

fix(workbench): share scan history across linked worktrees#456
mldangelo-oai wants to merge 30 commits into
mainfrom
mdangelo/codex/share-linked-worktree-scan-history

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Keep saved scans, findings, and reviewer decisions associated with verified Git
worktrees, including after a worktree is removed or its old path is reused.

Changes

  • Record repository generation and scope on new scans. Share history, findings,
    feedback, and rerun lineage through saved scan evidence and verified ownership.
  • Recheck ownership before rejoining saved scan tasks. Keep compatible legacy
    history target-local without assigning it a generation.
  • Preserve archived scan output when preparation or registration fails.
  • Use completion order for automatic post-scan matching and finding confirmation.
    Preserve the existing ordering of explicit history and scans match --all.
  • Append migration 33 without changing published migrations 1–32. Keep the
    supported prerelease repair and preserve historical records.
  • Merge current main, update stale stdin fixtures, and remove duplicate identity
    queries and production helpers used only by tests. Keep main's shorter README.
  • Refresh the paired bundled plugin version to 0.1.87; keep npm at 0.1.20.
    This PR does not publish a release or add public CLI flags.

Testing

Local first-pass verification on aabc44a547a30ed9cd71b472c69699ef971f16fa:

  • Reproduced both stale comparison-fixture failures before fixing them.
  • Identity, migration, history, findings, and feedback tests: 48 passed.
  • Types, formatting, build, and Ruff checks passed.
  • Python 3.10 syntax checks passed for all nine changed Python modules.
  • Compared migration definitions against main: migrations 1–32 are unchanged;
    migration 33 is the only addition.
  • Full seed-12345 suite: 1,958 passed, 30 skipped, one failure because the
    sandbox denied ps in the process-group test. That exact test passed when
    rerun outside the sandbox. No other failures were reported.

After merging main 01bd062, 237 affected tests passed with three platform
skips. Types/models, formatting, build, migration-prefix validation, static
package checks and the full installed-package smoke test passed. Real cache
upgrades from 0.1.60 and 0.1.68 matched all 118 installed files and preserved
credentials. The README keeps both shared-worktree guidance and main's Windows
state-recovery instructions without the repetitive command example.

CI is not awaited; its new-head results remain a separate verification step.
Native Windows execution and the full suite were not repeated after this refresh.

  • Final main refresh (fd98a90): package 0.1.21 includes the MCP launcher-permission fix; feature source and bundled payload are unchanged. Types/model generation, formatting, build, 28 focused package/report/launcher tests, static artifact verification and full installed-package smoke passed, including MCP initialization. CI was not awaited.

Risk and rollout

Saved task execution stops if the current checkout owner or saved generation no
longer matches. Sealed history and compatible exact-target legacy history remain
available. A target record or another scan never promotes historical scans into
a repository generation.

Migration 33 adds scan-generation evidence and database completion order. Older
writers continue to store NULL generation values. Tests cover legacy migration
repair, removed and replaced worktrees, explicit comparisons, feedback scope,
and archive recovery. No release is published by this PR.

Public disclosure review

The source, commit metadata, description, and public PR surface have been
reviewed. Existing automated review comments contain access-restricted report
references, so the second attestation remains unchecked.

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

@github-actions github-actions Bot added the bug Something isn't working label Aug 15, 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: eef22c38a6

ℹ️ 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 sdk/typescript/_bundled_plugin/scripts/workbench_target_state.py Outdated

Copy link
Copy Markdown
Collaborator Author

@codex review

Copy link
Copy Markdown
Collaborator Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 20b170e3ca

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 20b170e3ca

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 20b170e3ca

ℹ️ 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 sdk/typescript/_bundled_plugin/scripts/workbench_target_state.py Outdated
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_native_indexes.py Outdated
Comment thread sdk/typescript/_bundled_plugin/scripts/workbench_target_state.py Outdated
wholley-oai
wholley-oai previously approved these changes Aug 15, 2026

@wholley-oai wholley-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I took a cursory glance and have Codex reviewing more thoroughly, but on first pass this looks fine so I'm ok with providing an unblocking stamp.

Comment thread sdk/typescript/src/cli.ts Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: 4f1eb91dcb

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@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: 4f1eb91dcb

ℹ️ 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 sdk/typescript/_bundled_plugin/scripts/workbench_target_state.py Outdated
@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: e895dde338

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Security review completed. No security issues were found in this pull request.

Reviewed commit: e895dde338

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Preserve the published finding-publication migrations and append repository identity at version 31. Normalize the known pre-release identity migration, reuse one identity-schema capability check, and align saved-history tests with the integrated behavior.
Advance the paired standalone plugin version so existing staged marketplaces load the linked-worktree history helpers. Leave the npm package release version unchanged.
Use recorded checkout ownership before falling back to live repository identities. Preserve matching persisted identities for removed worktrees and retain verified same-origin comparisons.
ianw-oai
ianw-oai previously approved these changes Aug 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head c7f733d281c254299bc5d3c1d008c30d774fa14e.

@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: c7f733d281

ℹ️ 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 sdk/typescript/_bundled_plugin/scripts/workbench_scan_history.py

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head 2d9965ea6bfbfa16ca5f893caf993805a8302979. The additive follow-up sends the existing Python test fixture through stdin so Windows can launch it. Production source and the bundled payload are unchanged. Focused tests, both full suites, package checks, and the fresh local review gate passed.

Copy link
Copy Markdown
Collaborator Author

@codex security review

Please review the current head 2d9965ea6bfbfa16ca5f893caf993805a8302979.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 2d9965ea6b

ℹ️ 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".

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current head a2f5676dcef1c70a855ce672b0016cb4987bcd07.

Copy link
Copy Markdown
Collaborator Author

@codex security review

Please review the current head a2f5676dcef1c70a855ce672b0016cb4987bcd07.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: a2f5676dce

ℹ️ 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".

@kmbroai kmbroai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed head a2f5676dcef1c70a855ce672b0016cb4987bcd07 for correctness, necessity, and simplification.

Necessity and ownership model

Sharing history across linked worktrees is useful, but it must not equate clones merely because they advertise the same remote or attach an old checkout's decisions to a replacement directory. Persisting generation evidence on each new scan is the important part of this change. Keeping legacy scans target-local instead of retroactively inventing that evidence is the correct conservative boundary.

I traced generation construction, registration, active-scan rejoin checks, history predicates, grouped finding counts, feedback reuse, and the migration. The current generation includes the Git/common object-store directory instances and relative scope; mutable description text and unconditional Windows case folding no longer determine identity. A recreated component directory is accepted when its Git generation and scope remain verified, while a replaced root remains rejected. The earlier product findings in those areas are addressed at this head.

[P2] Make the recreation regression deterministic

The checked-in five-suite run produced 32 passes and 1 failure. workbench-repository-identity.test.ts:860 expected ownerChanged to be true, but it was false. The fixture deletes the old directory, creates one unrelated directory to try to consume its inode, then recreates the target. The allocator is free to reuse the original inode anyway; that extra mkdir is not an identity guarantee.

In a separate test-only copy, I replaced the three delete/consume sequences with renames that retain the old directory inodes, leaving the product code unchanged. The recreated-directory case then passed all 18 assertions, including accepting the recreated component and rejecting the recreated worktree root. Use that deterministic fixture rather than retries or assuming allocator behavior. This is a test defect, not evidence that the repaired component-recreation logic still fails.

Simplification and integration

Land one repository-scope abstraction and make #275 consume it. Maintaining this generation model alongside the browser PR's independent inode/ownership-epoch discovery would create contradictory history semantics. Keep archive rollback and completion-order changes separable where practical; they enlarge an already substantial migration. Preserve the documented distinction between completion-ordered automatic matching and the pre-existing explicit match --all order rather than silently changing that compatibility behavior.

Request-local identity caching and a fixed-size generation predicate are good choices. Do not add a mutable global alias cache or infer durable identity from a remote URL. Linux focused checks and the deterministic fixture ran with cached dependencies; native Windows/macOS and live scan execution were not verified.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 24, 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 Completed 2026-08-27T08:19:18.086788Z 1959ec9 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.

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review the current head d451c7d.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: d451c7d9d9

ℹ️ 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".

@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: aabc44a547

ℹ️ 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 on lines +831 to +832
if verify_ownership:
state.require_owner()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Rebind identities that have no scan history

When creating or saving a workspace, ensure_security_target binds the repository identity before any scan exists; if that repository is then reinitialized at the same path, this unconditional ownership check rejects every subsequent workspace or scan even though there are no scan records to protect. Allow the stored identity to be replaced when no scan references the target or path, and retain the mismatch rejection once history exists.

AGENTS.md reference: AGENTS.md:L9-L9

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants