Skip to content

fix: keep follow-up output separate from completed scans - #1151

Merged
mldangelo-oai merged 2 commits into
mdangelo/codex/pr939-split-27-sessionsfrom
mdangelo/codex/pr939-split-28-follow-up-output
Oct 4, 2026
Merged

mldangelo-oai merged 2 commits into
mdangelo/codex/pr939-split-27-sessionsfrom
mdangelo/codex/pr939-split-28-follow-up-output

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Part 28 of 46. Previous: #1150 · Next: #1152 · Stack index

Summary

Run post-scan instructions in a new thread with its own output directory and explicit context for the saved report. The follow-up receives read access to the scan and writes new output under artifacts/follow-up/<id>.

Changes

  • Give each follow-up its own working directory and permission profile. Preserve nested inherited denials while granting access to the follow-up output directory.
  • Supply completed-artifact context and the saved follow-up instructions to the new conversation.
  • Record follow-up sessions without replacing the original continuation. History recording remains optional and cancellation can interrupt a stalled write.

Testing

Local checks for the implementation:

  • Follow-up context, nested-denial and cancellation regressions passed on the implementation checkout.
  • Eight resumed follow-up variants passed after preserving the saved prompt with artifact context.

Checks against the complete stack passed: SDK and MCP typechecks, formatting, Ruff, the SDK build, portable plugin compatibility and its tests, focused recovery/accounting tests, and local-artifact package smoke using exact cached dependencies. The package check was not a clean registry install. See this PR’s Checks tab for CI results for its current commit.

Risk and rollout

postScanPrompt starts a fresh conversation with explicit saved-artifact context; it does not inherit earlier thread messages. Follow-up output paths change. Cancellation and permission failures remain visible to the caller; other follow-up errors are warnings. Fresh/resumed Deep Scan worker boundary coverage is included with part 39.

Public disclosure review

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

@mldangelo-oai

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 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 ⚠️ Failed 2026-10-04T17:35:21.560271Z a021eb3 Draft marked ready
🔒 Security Review ⚠️ Failed 2026-10-04T17:35:26.407830Z a021eb3 Draft marked ready
ℹ️ 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: 849fd6a6c8

ℹ️ 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/src/api.ts
Comment on lines +1723 to +1726
profile["filesystem"] = {
...(profile["filesystem"] as JsonObject),
[scanDir]: { ".": "read" },
[join(scanDir, output)]: { ".": "write" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve inherited filesystem denials for follow-ups

When a scan is launched with inheritedPermissions, this rebuilds the filesystem profile by spreading the inherited entries and then replacing any entry for scanDir or the follow-up path. An inherited denial or nested restriction covering the scan output is therefore discarded, and the follow-up receives read/write access that its parent explicitly withheld. Merge these grants without broadening inherited restrictions, or reject the follow-up when the required directory is denied.

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

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed at stack tip 835f0d1 with a synthetic inherited filesystem entry { [scanDir]: { '.': 'write', private: 'deny' } }. The initial scan completes, but the captured follow-up launch configuration contains only { [scanDir]: { '.': 'read' } }; private: 'deny' has been removed. This is a configuration-boundary probe, not an authenticated model test. The same whole-entry replacement is present at this PR's head. Preserve the nested denial when changing the default access and adding the follow-up output directory.

Comment thread sdk/typescript/src/api.ts Outdated
Comment on lines +1711 to +1712
recordPostScanThread = (threadId) =>
saveScanThread(threadId, undefined);

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 Keep the follow-up history write abortable

When the caller aborts after the follow-up emits thread.started, this explicitly removes the operation signal from set-scan-thread. Because runScanTurn awaits onThreadStarted, a workbench process waiting on a database lock or otherwise stalled cannot be canceled and blocks both stream processing and the completed scan's return. Pass the live signal while continuing to treat persistence errors as warnings so this optional history update cannot hold up the scan.

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

Useful? React with 👍 / 👎.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Fresh follow-up threads lose scan context, and the permission boundary lacks an end-to-end regression test.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Separates follow-up output from completed scan artifacts and preserves resume continuity.

Changes:

  • Creates isolated writable directories for follow-up sessions.
  • Records follow-up sessions without blocking on history-write failures.
  • Adds follow-up and resumed-scan regression tests.
File Description
sdk/​typescript/​src/​api.ts Implements isolated follow-up sessions and output permissions.
sdk/​typescript/​tests-ts/​api-post-scan.test.ts Tests follow-up failures and artifact isolation.
sdk/​typescript/​tests-ts/​api.test.ts Updates follow-up directory expectations.
sdk/​typescript/​tests-ts/​scan-resume.test.ts Tests follow-ups during resumed scans.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread sdk/typescript/src/api.ts Outdated
Comment on lines +1734 to +1739
return followUp
.startThread({
...threadOptions,
workingDirectory: join(scanDir, output),
})
.runStreamed(postScanPrompt, { signal });
Comment on lines +148 to +152
expect(options.config).toMatchObject({
permissions: {
codex_security_scan: {
filesystem: {
[scanDir]: { ".": "read" },
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-28-follow-up-output branch from 849fd6a to adbc041 Compare October 1, 2026 07:25

@faizan-oai faizan-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Holding approval: the follow-up permission rewrite removes nested inherited denials. With a synthetic inherited entry { [scanDir]: { '.': 'write', private: 'deny' } }, the follow-up receives { [scanDir]: { '.': 'read' } }; the private denial is gone. Reproduced at the current stack tip and traced to the same assignment in this PR. Details added to the existing thread.

@alandelong-oai alandelong-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.

Reviewed the follow-up isolation change at adbc0410e9a9fd298e493bd702b43b6f576f14f7 with three independent passes and root verification. Approval remains withheld for three existing findings:

Validation: 202 distinct focused tests pass, with five platform skips. Three initial failures were five-second timeouts; the affected cases and related resume tests all pass with the repository-prescribed 30-second timeout (nine passing tests). The permission probe observes launch configuration, not an authenticated model or sandbox write attempt.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-27-sessions branch from 592495a to 55817ec Compare October 1, 2026 23:44
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-28-follow-up-output branch from adbc041 to 67c083e Compare October 1, 2026 23:44

@alandelong-oai alandelong-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.

Three independent re-review passes and root reconciliation are complete for this restacked head.

The follow-up probes retain nested deny rules, supply saved-artifact context, and settle a stalled history write after cancellation.

Approval is for this change. Integrated-tip validation passed 1,357 SDK tests (31 skipped), 105 MCP tests (2 skipped), portable checks, types/builds and installed-package smoke. Other stack findings and known CI fixture failures still prevent the stack from being mergeable.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-27-sessions branch from 55817ec to 280c705 Compare October 2, 2026 00:36
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-28-follow-up-output branch from 67c083e to 267ecf0 Compare October 2, 2026 00:36

@alandelong-oai alandelong-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.

Re-reviewed the real PR diff at 267ecf0574ab518d4dc22a7d800d81f2dcae697f. The patch is unchanged from the prior three-pass review. I reconciled the inherited changes in touched files and retained the prior verified findings and tests.

No serious outstanding finding identified in this patch; prior conclusions remain consistent with the unchanged change or the current re-review.

Validation across touched paths at branch tip 06e75cfe: 1,356 SDK tests, 867 Python tests plus 100 subtests, and 108 MCP tests passed; builds, types, portable checks and installed-package checks passed. These are integration checks at the branch tip, not a claim that every intermediate PR or its CI is clean. Latest workflow runs for this unchanged head were verified successful at 2026-10-02 01:26 UTC. Earlier failed or canceled job records are superseded; this CI status correction does not alter the review decision.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-28-follow-up-output branch from 267ecf0 to bbd8b21 Compare October 2, 2026 01:37
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-27-sessions branch 2 times, most recently from 766fdfc to d712fa5 Compare October 2, 2026 01:56
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-28-follow-up-output branch from bbd8b21 to bcdf521 Compare October 2, 2026 01:56

@alandelong-oai alandelong-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.

Retained the three independent passes for the identical patch and reconciled inherited touched-file changes at bcdf521a6e41.

No actionable introduced finding survives the independent reviews and root reconciliation of this exact patch, touched-file changes, and current integration checks.

Current tip 355ec321 passed 75 report-projection tests, portable source checks, SDK build:ci and plugin build. The immediately preceding tip fec36f1d passed 1,360 SDK tests, 873 Python tests plus 100 subtests, 109 MCP tests, builds/types and the clean 600-entry installed-package check. Only report_projection.py and its test changed between those tips; SDK/MCP runtime files are byte-identical. Both descend from main 008a8b4d. These are integration checks, separate from own-head probes. No native Windows local run.

No serious outstanding finding introduced by this PR. Code review approval does not establish CI or merge readiness.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-27-sessions branch from d712fa5 to daea94c Compare October 2, 2026 02:47
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-28-follow-up-output branch from bcdf521 to 507421a Compare October 2, 2026 02:47

@alandelong-oai alandelong-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.

Retained the three independent passes for the verified identical patch and reconciled inherited touched-file changes at 507421a1a680.

No actionable introduced finding survives the independent reviews and root reconciliation of this exact patch and inherited changes in touched files.

Integrated tip 6ef8cbb8, based on 008a8b4d, passed 1,388 SDK tests, 879 Python tests plus 100 subtests, 109 MCP tests, portable checks, builds and the clean 600-entry installed-package check. These are branch-tip integration checks, separate from own-head probes; no local Windows execution was performed.

No serious outstanding finding introduced by this PR. Code approval is separate from CI and merge readiness.

@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-28-follow-up-output branch from 507421a to aec98a8 Compare October 2, 2026 03:52
@mldangelo-oai
mldangelo-oai force-pushed the mdangelo/codex/pr939-split-27-sessions branch from daea94c to 7cfc5e1 Compare October 2, 2026 03:52

@alandelong-oai alandelong-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.

Retained three prior independent passes for the verified identical patch and reconciled inherited touched-file changes at aec98a8d332b.

No actionable introduced finding survives the independent reviews and root reconciliation of this exact patch and inherited changes in touched files.

Branch tip 3e0083d9, based on 008a8b4d, passed 1,392 SDK tests, 881 Python tests plus 100 subtests, 109 MCP tests, builds, portable source checks and the 600-entry installed-package check. These are tip checks, separate from own-head probes. No local Windows run was performed. The tip excludes the dependency update merged separately in #1184; combined validation remains outstanding.

No serious outstanding finding introduced by this PR. Code approval is separate from CI and merge readiness.

Windows package-inspection attempt 1 failed with PluginPythonUnavailableError; its cause remains unproven. Attempt 2 is now running at the same head (04:19 UTC). The previous failure is historical, and this code approval does not establish CI or merge readiness.

Consolidate approved Deep Scan changes into the parent topic branch.
@mldangelo-oai
mldangelo-oai marked this pull request as ready for review October 4, 2026 17:34
@mldangelo-oai
mldangelo-oai merged commit f824b38 into mdangelo/codex/pr939-split-27-sessions Oct 4, 2026
1 check passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/pr939-split-28-follow-up-output branch October 4, 2026 17:34
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.

5 participants