Skip to content

feat(scans): persist observed file reads in scan history - #1866

Open
wholley-oai wants to merge 11 commits into
mainfrom
dev/wholley/codex/observed-files-read
Open

wholley-oai wants to merge 11 commits into
mainfrom
dev/wholley/codex/observed-files-read

Conversation

@wholley-oai

@wholley-oai wholley-oai commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

codex-security scans show reports how many distinct repository paths appeared in identifiable source excerpts in the scan's saved tool output. The JSON field is observedFilesRead, with count and observedAt. Review receipts continue to describe completed review.

Changes

  • Use registered execution threads and their in-window descendants. Preserve the final scan turn and exclude unrelated work in a shared conversation or an independent Deep comparison.
  • Stream the retained events. Recognize literal single-file reads and unambiguous search excerpts. Skip context output, suppressed filenames, binary match notices and paths whose attribution is ambiguous.
  • Persist observations separately from review receipts. Migration 73 supports clean databases and the original version-58 preview, including databases subsequently opened by main. Keep prior observations and their timestamps.
  • Display start and update times in scan history and document how to interpret the count.

Testing

  • All 112 focused Bun cases passed across observation extraction, CLI history, log selection, navigation and rendering. All five CLI observation cases passed again after correcting the test fixture's JSON array type.
  • All 77 Node workbench database tests passed. The combined Python schema, migration and observed-file suites passed 209 cases on Linux, with one Windows-only case skipped. Replayed a database created by the original preview directly and through main with both native SQLite clients. All four paths retained the recorded row and timestamps after a second open. The five Deep Scan cases that exercise the version-53 downgrade fixture also passed after that fixture dropped both migration-73 objects.
  • A synthetic 44.7 MB rollout delivered all 20,001 events to the collector, retained zero raw events in the reader and produced one unique file.
  • Corrected the progress-poll test double to handle the final full history read. All 16 targeted progress and warning tests passed. Applied the inventory fixture correction from #2678 and verified both cases.
  • SDK type checking, package build, formatting, both Ruff checks, portable plugin source checks and all nine source-check tests passed.
  • The full local SDK suite on the final source tree passed 13,035 tests, with 171 skipped and one todo (seed 1734593026). During integration, the run with seed 12345 reported ten runtime-path failures. All ten passed on targeted reruns with Bun and Python outside the enclosing checkout.
  • All 65 Source CI jobs passed on the final head, including Linux, macOS and Windows. Source CI

Risk and rollout

Unmeasured scans have a null count. A measured zero means the retained output contained no qualifying source excerpts. Opaque scripts and searches with ambiguous output can undercount. Older preview paths remain in the database when the original logs are gone. Optional observation failures leave the scan outcome intact. This PR covers the observed-read diagnostic discussed in #70.

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.

The third attestation is open because some historical workflow artifacts were not inspected.

@wholley-oai wholley-oai self-assigned this Oct 22, 2026
@github-actions github-actions Bot added the enhancement New feature or request label Oct 22, 2026

@mldangelo-oai mldangelo-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 full diff, persistence/migration changes, scan lifecycle integration, saved-log attribution, and associated tests at c31b87e. Found one reproducible attribution issue below. The analyzer and saved-log suites passed (44 tests); renderer and CLI observation suites could not load because the local dependency environment lacks string-width and strip-ansi. This is a comment-only review, not an approval.

Comment thread sdk/typescript/src/observed-files.ts Resolved
@wholley-oai
wholley-oai marked this pull request as ready for review October 23, 2026 20:54
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-11-16T06:25:24.493336Z ceb8bb1 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.

@wholley-oai
wholley-oai force-pushed the dev/wholley/codex/observed-files-read branch from 8869b41 to a4a39f3 Compare October 27, 2026 01:08

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

The saved count can include files that the selected scan never showed to the model. The two cases below reproduced with synthetic sessions and local command output. Please cover both before persisting this metric.

The schema upgrade also needs a test using a database created by this PR. I opened such a database on current main (schema 72), then simulated appending this PR’s two SQL statements under a new version. SQLite rejected the first statement with duplicate column name: observed_files_read_at. Main already uses version 58 for a different migration. When integrating main, preserve its migration history and verify both a clean upgrade and an upgrade from the preview database with observations already present.

Comment thread sdk/typescript/src/scan-logs.ts Resolved
Comment thread sdk/typescript/src/observed-files.ts Resolved

This branch has not been deployed

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants