Skip to content

fix: report the latest distill outcome without timestamp ties - #135

Merged
puretensor merged 1 commit into
mainfrom
codex/review-ptask-distill-outcome-order
Oct 15, 2026
Merged

puretensor merged 1 commit into
mainfrom
codex/review-ptask-distill-outcome-order

Conversation

@puretensor

Copy link
Copy Markdown
Owner

Title: fix: report the latest distill outcome without timestamp ties

Severity: med

Failure scenario: record a successful distill.run at 12:00:00.100000Z, then distill.failed at 12:00:00.200000Z. GET /metrics reports pt_distill_last_run_ok 1 even though the latest run failed. The query truncates both timestamps to whole seconds and treats the tie as success, suppressing the current-failure signal.

Select the latest recorded outcome by the journal's monotonic id. This preserves the no-failures default, reports the later failure, and clears the gauge on a subsequent successful run.

Regression: crates/ptask-server/tests/distill_outcome_order.rs drives the actual HTTP router over a disposable SQLite database, covering the initial state, success followed by failure within one second, and subsequent recovery.

Exact red/green command (same command before and after the fix):

env PATH=/usr/bin:/bin:$HOME/.local/bin:$HOME/.cargo/bin:/home/puretensorai/.local/bin CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}" RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" CARGO_TARGET_DIR="$PWD/target" HOME="$(mktemp -d)" cargo test -p ptask-server --locked --test distill_outcome_order

Against unchanged origin/main production code: test result: FAILED. 0 passed; 1 failed (gauge 1 instead of 0). With this fix: test result: ok. 1 passed; 0 failed.

Gate: ran cargo fmt --all -- --check && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace --locked. Formatting passes. Clippy has only the two recorded baseline clippy::nonminimal_bool errors in crates/ptask-cli/tests/terminal_safety.rs:78 and crates/ptask-cli/src/ui.rs:946 (exit 101). Existing assertions are unchanged. The separately executed cargo test --workspace --locked passes (exit 0). All runs use an isolated HOME, restricted PATH, and CARGO_TARGET_DIR=$PWD/target; no native-ml feature build.

…135, worker: codex gpt-6.1-sol)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hgmcKdqHGU2isq8wv1ypU
@puretensor
puretensor force-pushed the codex/review-ptask-distill-outcome-order branch from bb8d396 to 922daad Compare October 15, 2026 08:16
@puretensor
puretensor merged commit 24aaad9 into main Oct 15, 2026
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.

1 participant