Skip to content

fix(headless): make real-run archive emit failures fatal (OPS-001) - #145

Merged
cursor[bot] merged 1 commit into
cursor/adversarial-review-base-256afrom
cursor/ops-001-archive-emit-256a
Jul 8, 2026
Merged

fix(headless): make real-run archive emit failures fatal (OPS-001)#145
cursor[bot] merged 1 commit into
cursor/adversarial-review-base-256afrom
cursor/ops-001-archive-emit-256a

Conversation

@ravidsrk

@ravidsrk ravidsrk commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Closes OPS-001 from the adversarial review (c6c486).

Real headless runs could exit 0 while leaving no .fleet/runs/<id>/ audit trail when archive emission failed. Dry-run cleanup remains non-fatal.

Changes

  • Fatal emit failure on real runs; keep dry-run cleanup non-fatal
  • Propagate emit rc over runtime rc when emit fails
  • Tests for both paths + timeout archive still works

Base

Merges into cursor/adversarial-review-base-256a (mission BASE).

Open in Web Open in Cursor 

Greptile Summary

This PR makes real headless archive emission failures fail the run. The main changes are:

  • Real runs now return the archive emit exit code when archive creation fails.
  • Dry-run archive cleanup still treats emit failures as non-fatal warnings.
  • Tests cover fatal real-run emit failures, non-fatal dry-run failures, and kept archive behavior.

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is narrow, preserves dry-run behavior, and adds tests for the affected success and failure paths. No runtime bugs were identified in the changed code.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex executed the headless OPS-001 archive path tests and reported 2 tests passed in 1.40s with exit code 0.
  • T-Rex executed the headless timeout archive regression tests and reported 1 test passed in 2.75s with exit code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
scripts/run-mission-headless.sh Makes archive emission failures fatal for real headless runs while preserving non-fatal dry-run cleanup behavior.
tests/test_headless_auth_timeout.py Adds coverage for fatal real-run archive emit failures and non-fatal dry-run emit failures.
tests/test_headless_trace.py Adds end-to-end headless trace tests for real-run and dry-run archive emit failure behavior.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Runtime as Headless runtime
participant Runner as run_runtime_emit
participant Emitter as emit_headless_trace_archive
participant Archive as .fleet/runs archive

Runner->>Runtime: run_with_timeout(command)
Runtime-->>Runner: runtime_rc + captured transcript
Runner->>Emitter: "emit archive(cleanup=0, transcript)"
Emitter->>Archive: create audit trail
alt emit succeeds
    Archive-->>Emitter: archive path
    Emitter-->>Runner: "rc=0"
    Runner-->>Runner: return runtime_rc
else real-run emit fails
    Archive-->>Emitter: error
    Emitter-->>Runner: emit_rc
    Runner-->>Runner: return emit_rc
end
Note over Emitter: cleanup=1 dry-run failures warn and return 0
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Runtime as Headless runtime
participant Runner as run_runtime_emit
participant Emitter as emit_headless_trace_archive
participant Archive as .fleet/runs archive

Runner->>Runtime: run_with_timeout(command)
Runtime-->>Runner: runtime_rc + captured transcript
Runner->>Emitter: "emit archive(cleanup=0, transcript)"
Emitter->>Archive: create audit trail
alt emit succeeds
    Archive-->>Emitter: archive path
    Emitter-->>Runner: "rc=0"
    Runner-->>Runner: return runtime_rc
else real-run emit fails
    Archive-->>Emitter: error
    Emitter-->>Runner: emit_rc
    Runner-->>Runner: return emit_rc
end
Note over Emitter: cleanup=1 dry-run failures warn and return 0
Loading

Reviews (1): Last reviewed commit: "fix(headless): fail real runs when archi..." | Re-trigger Greptile

Co-authored-by: Ravindra Kumar <ravidsrk@gmail.com>
@cursor
cursor Bot merged commit 1b01047 into cursor/adversarial-review-base-256a Jul 8, 2026
1 of 2 checks passed
@cursor cursor Bot mentioned this pull request Jul 8, 2026
5 tasks
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.

2 participants