Skip to content

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

Open
mldangelo-oai wants to merge 25 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 25 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 newly registered scans. Share
    history, findings, feedback, and rerun lineage through saved scan-level
    evidence and verified current ownership.
  • Recheck the same canonical ownership before a saved workspace, prompt-driven
    scan, or Deep Scan rejoins existing task state. Preserve owner-compatible
    exact-target legacy history without assigning it a generation.
  • Use one request-local ownership cache and a fixed-size repository predicate.
    Preserve the original requester, unavailable-history reporting, direct sealed
    findings, and separately authorized explicit artifact comparisons.
  • Keep automatic latest-scan matching in durable completion order while
    preserving explicit history and manual comparison ordering.
  • Preserve published migrations 1 through 30 and the append-only migration 31
    contract. Keep its one-time supported-layout repair and existing records.
  • Use paired standalone plugin version 0.1.31, keep npm at 0.1.14, retain
    the Windows-safe Python test launcher, and hide explicitly internal types
    from the public package declarations.

Testing

On a2f5676dcef1c70a855ce672b0016cb4987bcd07:

  • Identity-cache tests: 21 passed. Existing Deep Scan continuation-ownership
    tests: 9 passed.
  • Types, formatting, Ruff, Python 3.10 syntax, and diff checks passed.
  • Source comparison confirms the identity algorithm, schema, generation
    writers, completion order, and history-read code are unchanged by the
    follow-up.
  • Build, package creation, installed-package smoke, and strict NodeNext
    TypeScript consumer passed. The package check validated 226 entries and 106
    bundled plugin files, including the CLI and nested worker.
  • Normal and seed-12345 full Bun 1.3.14 suites each passed 1,404 tests, with 14
    skipped and zero failures.
  • Three fresh whole-PR native review passes and an independent verifier found
    no issues on this exact head.

Risk and rollout

Saved task execution now stops when the canonical owner or saved generation no
longer matches. Read-only sealed history and the supported exact-target legacy
fallback remain available. No historical generation is promoted from a target
record or another scan.

Migration 31 retains indexed scan-generation evidence and database completion
order. Older writers continue to store NULL. The separate historical-findings
work keeps migration 32 and scan-rowid decision checkpoints. No migration is
renumbered, and no npm or plugin release is published by this PR.

Public disclosure review

The source, commit metadata, description, and current 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 on lines +240 to +241
if focus_scan_id is not None:
available.sort(key=_scan_completion_order)

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 Sort every matching batch by completion order

When overlapping scans finish in a different order from when they started, scans match --all calls this command without --after-scan-id, so this condition skips the completion-order sort and retains the SQL's started_at order. The command can consequently save a later-completed scan as the before side of an earlier-completed scan, reversing new/resolved semantics and persisted match direction. Sort available by _scan_completion_order for the all-scans path as well.

AGENTS.md reference: sdk/typescript/AGENTS.md:L23-L23

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. I checked the call sites and the existing compatibility test. Post-scan matching supplies --after-scan-id and uses completion order. The explicit scans match --all command omits it and retains the pre-existing start-time order. The history test deliberately covers both orders.

I am preserving that behavior in this repair. Changing --all direction would be a separate compatibility decision. The follow-up only sends the existing Python test fixture through stdin so Windows can launch it.

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

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.

3 participants