Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2d67bbc
feat(task-ledger): observe sensor execution in shadow
EffortlessSteven Aug 28, 2026
7f6e95f
fix(task-ledger): record process start after spawn
EffortlessSteven Aug 28, 2026
45fc50d
fix(task-ledger): allow empty sensor plans
EffortlessSteven Aug 28, 2026
56bf0f2
policy(ripr): receipt sensor ledger probes
EffortlessSteven Aug 28, 2026
efa122c
fix(task-ledger): clear stale empty-plan artifacts
EffortlessSteven Aug 28, 2026
3132020
policy(ripr): receipt stale artifact cleanup
EffortlessSteven Aug 28, 2026
dc097ad
fix(task-ledger): keep sensor evidence current
EffortlessSteven Aug 28, 2026
731d003
fix(task-ledger): observe sensor process completion
EffortlessSteven Aug 28, 2026
36e5da8
fix(task-ledger): preserve valid proposal pairs
EffortlessSteven Aug 28, 2026
ef5bdf2
fix(task-ledger): classify tokmd version drift
EffortlessSteven Aug 28, 2026
47b83aa
fix(task-ledger): terminalize sensor runner errors
EffortlessSteven Aug 28, 2026
962931d
policy(ripr): receipt final sensor ledger probes
EffortlessSteven Aug 28, 2026
6180088
docs(policy): attribute hosted sensor receipts
EffortlessSteven Aug 28, 2026
d5b0b42
fix(task-ledger): confirm sensor child termination
EffortlessSteven Aug 28, 2026
0f5985d
fix(task-ledger): stop after unconfirmed sensor exit
EffortlessSteven Aug 28, 2026
796537b
fix(task-ledger): reject stale setup receipts
EffortlessSteven Aug 28, 2026
c77c426
fix(runtime): prove sensor reap boundaries
EffortlessSteven Aug 28, 2026
3f7a7d7
test(task-ledger): distinguish stale setup receipts
EffortlessSteven Aug 28, 2026
6173dcf
policy(ripr): receipt final sensor lifecycle probes
EffortlessSteven Aug 28, 2026
aa297e5
revert: remove premature RIPR receipts
EffortlessSteven Aug 28, 2026
953eedb
fix(runtime): close sensor subprocess authority gaps
EffortlessSteven Aug 28, 2026
565005f
Merge remote-tracking branch 'origin/codex/955-sensor-task-ledger' in…
EffortlessSteven Aug 28, 2026
a4ebb28
chore: export exact PR source for bounded repair
EffortlessSteven Aug 28, 2026
50f332a
chore(ci): remove temporary source export
EffortlessSteven Aug 28, 2026
b6713a5
policy(ripr): reconcile final sensor lifecycle probes
EffortlessSteven Aug 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/REVIEW_LEDGER.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ src/work_queue.rs work_queue_task_from_sensor (#325 late-phase pending rule)
src/task_ledger_artifact.rs strict v1 replay, digest, and snapshot contract
<-> verifier require_task_ledger_artifacts (cross-language golden pinned by
self_test_task_ledger_contract)
src/sensor_task_ledger.rs production sensor shadow adapter and artifact writer
<-> src/sensors/mod.rs fast/late execution boundaries and status receipts
(focused sensor lifecycle tests plus dry-run CLI artifact inventory)
schema strings ub-review.<name>.vN in Rust
<-> exact strings the verifier pins
```
Expand Down
19 changes: 13 additions & 6 deletions docs/specs/UB-REVIEW-SPEC-0004-artifact-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,28 @@ receipt_routes.ndjson tool_gate_outcomes.ndjson
resource_leases.ndjson
```

Task-ledger A2.3 adds a dormant, optional pair before production task
instrumentation lands in #925:
Task-ledger A2.3 defines the strict pair, and A2.4 emits it for every planned
sensor in production shadow mode:

```text
task_ledger_events.ndjson ub-review.task_ledger_event.v1 lines
review/task_ledger_snapshot.json ub-review.task_ledger_snapshot.v1
```

Neither file is emitted by `run` yet, preserving the current production
tree. If either is present, the verifier requires both and requires strong
packet revision binding. Event records use contiguous caller order, a
`run` emits both after the late sensor phase joins when the resolved plan has
at least one sensor; a legitimately empty sensor plan omits the optional pair.
Every resolved sensor has one proposal. Runnable fast and late sensors record queued, admitted, setup,
process, receipt-attempt, and release events around the unchanged runner;
skipped and dry-run sensors terminate without fabricated process timing.
Sensor phase remains scheduling metadata in the linked sensor status receipt,
not a second lifecycle model. Event records use contiguous caller order, a
SHA-256 source-digest chain, strict transition replay, canonical LF-delimited
JSON bytes, and artifact-relative receipt references. The snapshot is only a
derived cache: the verifier recomputes it from the event stream and requires
byte equality. A structurally valid external receipt reference is a pointer,
not proof; #925 owns joining it to a produced receipt.
not proof; #957 owns joining it to every produced projection after #956 adds
the remaining proof and worker sources. The verifier therefore still permits
the pair to be absent in legacy/non-run packets during the shadow rollout.

`review/` (the compiled review surface):

Expand Down Expand Up @@ -679,6 +685,7 @@ named Rust test in src/main.rs. The schema column abbreviates
| tool-gate-outcomes.json + review/ mirror | stable | tool_gate_outcomes.v1; entries tool_gate_outcome.v1 | downstream automation; gate-check cross-check | required (require_tool_gate_outcome_artifacts) |
| work_queue.json | stable | work_queue.v1; tasks work_queue_task.v1 | downstream automation | required (require_work_queue_artifacts) |
| work_events.ndjson | stable | work_event.v1 lines | downstream automation | required (require_work_queue_artifacts) |
| task_ledger_events.ndjson + review/task_ledger_snapshot.json | experimental shadow coverage | task_ledger_event.v1 lines + task_ledger_snapshot.v1 derived replay cache; sensor sources complete, proof/worker sources pending #956 | downstream reconciliation | emitted by `run`; verified when present (require_task_ledger_artifacts) |
| events.ndjson | stable | none (ts/kind/payload; eight required kinds) | downstream automation | required (require_events) |
| running-summary.md | stable | five required headings | humans (GitHub step summary) | required (require_summary) |
| input/changed-files.txt, input/diff.patch, input/diff-context.json | stable | none | downstream automation | required (require_common_tree) |
Expand Down
11 changes: 0 additions & 11 deletions policy/allow.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ created = "2026-08-27"
review_after = "2026-09-27"
expires = "2026-11-27"

[[exception]]
id = "task-ledger-artifact-shadow"
kind = "rust-lint-suppression"
path = "src/task_ledger_artifact.rs"
lint = "dead_code"
owner = "ub-review/core"
reason = "A2.3 intentionally lands deterministic task-ledger persistence and verification before A2.4 instruments production task sources; remove this module-level expectation when #925 connects the writer."
created = "2026-08-27"
review_after = "2026-09-27"
expires = "2026-11-27"

[[exception]]
id = "non-rust-github-actions"
kind = "non-rust-file"
Expand Down
29 changes: 29 additions & 0 deletions src/lane_packets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ pub(crate) fn run_command_to_files(
stderr_path: &Path,
) -> Result<CommandStatus> {
let ambient = BTreeMap::new();
let mut ignore_spawn = || {};
run_command_to_files_inner(CommandRun {
root,
argv,
Expand All @@ -237,6 +238,7 @@ pub(crate) fn run_command_to_files(
stdout_path,
stderr_path,
quarantine_environment: false,
on_spawn: &mut ignore_spawn,
})
}

Expand All @@ -248,6 +250,29 @@ pub(crate) fn run_sensor_command_to_files(
timeout_sec: u64,
stdout_path: &Path,
stderr_path: &Path,
) -> Result<CommandStatus> {
let mut ignore_spawn = || {};
run_sensor_command_to_files_with_spawn_observer(
root,
argv,
env,
timeout_sec,
stdout_path,
stderr_path,
&mut ignore_spawn,
)
}

/// Run a sensor subprocess and notify the caller only after process creation
/// succeeds. The callback is observational and cannot suppress the child.
pub(crate) fn run_sensor_command_to_files_with_spawn_observer(
root: &Path,
argv: &[String],
env: &BTreeMap<String, String>,
timeout_sec: u64,
stdout_path: &Path,
stderr_path: &Path,
on_spawn: &mut dyn FnMut(),
) -> Result<CommandStatus> {
let ambient = std::env::vars().collect();
run_command_to_files_inner(CommandRun {
Expand All @@ -259,6 +284,7 @@ pub(crate) fn run_sensor_command_to_files(
stdout_path,
stderr_path,
quarantine_environment: true,
on_spawn,
})
}

Expand All @@ -271,6 +297,7 @@ struct CommandRun<'a> {
stdout_path: &'a Path,
stderr_path: &'a Path,
quarantine_environment: bool,
on_spawn: &'a mut dyn FnMut(),
}

fn run_command_to_files_inner(run: CommandRun<'_>) -> Result<CommandStatus> {
Expand All @@ -283,6 +310,7 @@ fn run_command_to_files_inner(run: CommandRun<'_>) -> Result<CommandStatus> {
stdout_path,
stderr_path,
quarantine_environment,
on_spawn,
} = run;
let Some((program, args)) = argv.split_first() else {
bail!("empty command");
Expand Down Expand Up @@ -310,6 +338,7 @@ fn run_command_to_files_inner(run: CommandRun<'_>) -> Result<CommandStatus> {
let mut child = command
.spawn()
.with_context(|| format!("spawn {program}"))?;
on_spawn();
let status = match child.wait_timeout(Duration::from_secs(timeout_sec))? {
Some(status) => status,
None => {
Expand Down
29 changes: 18 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ pub(crate) use revision_identity::RevisionRef;
mod revision_admission;
pub(crate) use revision_admission::*;
mod compiler_reconciliation;
mod sensor_task_ledger;
mod task_ledger;
mod task_ledger_artifact;
pub(crate) use compiler_reconciliation::*;
pub(crate) use sensor_task_ledger::*;
mod review_topics;
pub(crate) use review_topics::*;
mod impact_plan;
Expand Down Expand Up @@ -3733,6 +3735,16 @@ fn cmd_run(args: RunArgs) -> Result<RunCompletion> {
},
)?;

// A2.4 (#955): sensors are the first production TaskLedger source. The
// adapter observes the resolved plan and existing runner only; it owns no
// scheduling, command, or gate authority.
let revision_ref = RevisionRef::from_admission(&revision);
revision_ref
.validate()
.context("admitted revision reference")?;
let sensor_task_ledger =
SensorTaskLedger::initialize(&revision_ref, &plan, args.dry_run, &run_started)?;

let event_log = Arc::new(EventLog::open(&args.review.out.join("events.ndjson"))?);
let mut run_loop_tracker = RunLoopTracker::new();
event_log.append(
Expand Down Expand Up @@ -3783,6 +3795,7 @@ fn cmd_run(args: RunArgs) -> Result<RunCompletion> {
jobs,
fast.into(),
&event_log,
Some(&sensor_task_ledger),
)?;
}
if !late.is_empty() {
Expand All @@ -3793,7 +3806,7 @@ fn cmd_run(args: RunArgs) -> Result<RunCompletion> {
profile,
&event_log,
&run_started,
late,
LateSensorWork::new(late, Some(sensor_task_ledger.clone())),
)?);
}
}
Expand Down Expand Up @@ -3826,13 +3839,6 @@ fn cmd_run(args: RunArgs) -> Result<RunCompletion> {
args.review.out.join("running-summary.md"),
&preliminary_summary,
)?;
// A1.3 (#950): one immutable reference joins every stamped artifact
// (claim graph, gate outcome, delivery exact-head) to the admitted
// revision.
let revision_ref = RevisionRef::from_admission(&revision);
revision_ref
.validate()
.context("admitted revision reference")?;
let gate_outcome = write_review_artifacts(
&args.review.root,
&args.review.out,
Expand All @@ -3850,6 +3856,7 @@ fn cmd_run(args: RunArgs) -> Result<RunCompletion> {
run_started.elapsed(),
late_phase,
)?;
sensor_task_ledger.write_artifacts(&args.review.out)?;
Comment thread
EffortlessSteven marked this conversation as resolved.
Resolved
let summary = render_summary(&args.review.out, &plan, &diff)?;
fs::write(args.review.out.join("running-summary.md"), &summary)?;
if config.review.github_summary && !args.no_github_summary {
Expand Down Expand Up @@ -6061,8 +6068,8 @@ mod tests {
Config, DEFAULT_REVIEW_PROFILE, DiffClass, DiffContext, DiffFlags, EventLog, FailOnGate,
FollowUpOutputRecord, FollowUpQuestionTask, GateCheckArgs, GitHubReview,
GitHubReviewComment, IssueBrokerPlanEntry, IssueCandidate, IssueCandidateEvidence,
LaneModelOutput, LanePlan, LanguageMix, Limits, MinimaxPromptCache, ModelAssignment,
ModelCacheUsage, ModelCallOutcome, ModelEvidenceIssue, ModelLaneReceipt,
LaneModelOutput, LanePlan, LanguageMix, LateSensorWork, Limits, MinimaxPromptCache,
ModelAssignment, ModelCacheUsage, ModelCallOutcome, ModelEvidenceIssue, ModelLaneReceipt,
ModelLaneTaskResult, ModelMode, ModelOutputSinks, ModelProvider, ModelProviderPolicy,
ModelRunContext, Observation, ObservationInput, OpenCodeEndpointKindArg, Plan, PostArgs,
PostingMode, PrDecisionContext, PrThreadContext, Profile, ProfileArg, ProofBudget,
Expand Down Expand Up @@ -15314,7 +15321,7 @@ required_proof_unprooven = true
profile,
&event_log,
&run_started,
vec![late_sensor],
LateSensorWork::new(vec![late_sensor], None),
)?;
let gate_outcome = write_review_artifacts(
temp.path(),
Expand Down
Loading
Loading