You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Saved scan logs include same-thread events emitted after scan completion #555
readScanLogs() uses a saved scan's completedAt timestamp to reject independent worker sessions that start after the scan, but it does not apply the same completion boundary to events inside sessions that were already selected.
A post-scan prompt runs on the same Codex thread after complete-scan, so its later events can appear in codex-security scans logs as if they belonged to the completed security scan.
Reproduction / evidence
Current upstream main at 37bf87a692fc72d41f7312cc48808d699d204fba does this in readScanLogs():
after the session set is selected, the event loop appends every event from each included session without checking completedAt.
The SDK scan lifecycle completes/persists the scan first, then, when postScanPrompt is configured, invokes the follow-up on the same thread through runPostScan.
A deterministic saved-log fixture is therefore:
root session starts at 12:00:00;
a scan event is timestamped 12:01:00;
saved scan completedAt is 12:02:00;
a same-thread post-scan event is timestamped 12:03:00;
readScanLogs() currently returns both events.
Expected behavior: the 12:03:00 event is outside the saved scan's lifetime and should not be projected as scan activity.
Root cause
The completion boundary is enforced only while deciding which independent sessions belong to a Deep scan. It is not enforced at the per-event projection boundary for root, child, or already-selected worker sessions.
Suggested fix
Parse a finite completedAt once for log projection and omit timestamped events strictly after that instant. Preserve existing behavior for running scans (completedAt: null) and for legacy events that do not carry a usable timestamp.
Add a focused regression with before/after completion events in the same root session.
Impact
This is history/observability correctness. scans logs can mix post-scan assistant/tool activity into the evidence shown for a completed scan, making the saved activity timeline extend beyond the scan record it claims to describe.
Related: open #1103 moves post-scan follow-ups into a separate thread. That addresses one source of these extra events, but doesn’t add a general completion cutoff to saved logs.
Activity
mldangelo-oai commentedon Oct 8, 2026
Related: open #1103 moves post-scan follow-ups into a separate thread. That addresses one source of these extra events, but doesn’t add a general completion cutoff to saved logs.