Repository navigation
Conversation
CompletionRouter stored a record's full result (text, omitted_chars and artifact reference) for as long as the record existed, so a delivered or withdrawn child's output stayed in the store until compact(retain) dropped the record. Hosts that delete a parent expect its content to go away with it, and the only workaround was a short retention in a boot-time compact. Add CompletionRecord::settle, which moves a record to a terminal state, bumps updated_at and empties result, and use it on every settling path: mark_delivered, tombstone, cancel_parent and mark_failed. The task id, parent key, status, attempts and timestamps stay, which is all dedupe, tombstones and compaction read. mark_failed still hands the full record to the host's give-up policy and stores only the emptied copy. Cover it in the router tests (delivered, tombstoned and cancelled records keep their bookkeeping but no result; the give-up writer sees the full result; dedupe and the tombstone guard still hold) and in the driver store tests (the persisted document carries no text or artifact, and settled records reopen with their state and stay deduped). Update the tasks README, which still described the removed JSONL completion log. Closes tinyhumansai#354
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(tasks): drop a completion's result once the record settles. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete What changedThis iteration continues the fix(task) work on the completions subsystem of the tinyagents-tasks crate: `types.rs` documents that `result` is emptied once a record settles and adds a `pub(crate) settle` helper; `router.rs` routes `tombstone`, `cancel_parent` and `mark_delivered` through `settle`, and reworks `mark_failed` to take the result out via `std::mem::take` before storing the settled record and restoring it on the returned value, with updated doc comments for those methods and for `compact` (which frees the dedupe entries too, so the retention window must outlive any child's usefulness to its parent). The README's driver-store section is rewritten to describe the document store and result-dropping on settle, replacing the removed-JSONL-log prose, and the changelog gains an unreleased entry. The critique lane's summary reports 1 finding while its `findings` list is empty, so that finding cannot be characterised from the evidence. Relative to the prior reviewed head, no trusted push delta was available (latest_push_delta unavailable), and cached prompt differences cannot be treated as a proven delta; the visible changes include driver-test refactors to use shared `COMPLETIONS`/`task_id_key` helpers, an added `finished_at` stagger for deterministic claim ordering, persisted-document field-name changes (`record.result` → top-level `result`, `taskId` → `task_id`, `parentKey` → `parent_key`), removal of a stale blank line between changelog entries, and a `restart_recovery_note` assertion dropped from one router test — all consistent with the whole-pull-request diff but not independently confirmed as new in this push. Features
Tests
FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
There was a problem hiding this comment.
tinysweeper found nothing blocking. Approving.
$0.0087 · 319,155 in / 14,796 out · 36,480 cached (11%) · ladder/vectors-oai3, glm-5.3-flash · 549 embedded
critique: $0.0047 · 153,741 in / 9,837 out · 32,000 cached (21%) · glm-5.3-flash
security: $0.0005 · 49,838 in / 381 out · 0 cached (0%) · glm-5.3-flash
tests: $0.0023 · 78,378 in / 1,523 out · 0 cached (0%) · glm-5.3-flash
description: $0.0003 · 28,309 in / 904 out · 4,480 cached (16%) · glm-5.3-flash
Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…md,crates/tinyagents-tasks/src/ Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
This reverts commit b073bb4. Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ests.rs Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ests.rs Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ests.rs Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…ests.rs Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
…on/Cargo.toml,crates/tinyagents Auto-committed-on: cuttlefish Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Summary
CompletionRouterkept a record's fullresult(text,omitted_charsand the artifact reference) for as long as the record existed, so a delivered child's output, or the withdrawn completions of a deleted parent, sat in the store untilcompact(retain)dropped the record. The only workaround was a short retention in a boot-time compact.This adds
CompletionRecord::settle(crate-private), which moves a record to a terminal state, bumpsupdated_atand emptiesresult, and uses it on every settling path:mark_delivered→Deliveredtombstone→Tombstonedcancel_parent→Tombstonedfor every withdrawn pending recordmark_failed→GaveUp; the returned record still carries the full result for the host's give-up policy, only the stored copy is emptiedThe task id, parent key, status, attempts and timestamps stay, which is all that dedupe, tombstones and compaction read.
The issue describes a JSONL completion log; that store has since been replaced by
DriverCompletionStore, which upserts one document per task id, so there is no growing log to compact on a size threshold. I left that part out: the per-task document now holds the emptied record, andcompact(retain)remains the way to drop the dedupe entries. The tasks README still described the removed JSONL log, so itsCompletionStorebullet now describes the driver store and the new settle behaviour.API Or Behavior Changes
Behaviour change, no public API change: a settled
CompletionRecordread back from aCompletionStore(get,list) hasresult == CompletionResult::default(). Pending records and the recordsmark_failedreturns are unchanged.RecordOutcome/TombstoneOutcomesemantics (dedupe after delivery, suppression after tombstone or cancel, survival across a reopen) are unchanged and covered by the existing tests.Tests
New in
crates/tinyagents-tasks/src/completions/router_tests.rs:a_delivered_record_keeps_its_bookkeeping_but_not_its_resulttombstone_and_cancel_parent_drop_the_withdrawn_resultthe_give_up_writer_gets_the_full_result_and_the_store_does_notNew in
crates/tinyagents-tasks/src/completions/driver_tests.rs:a_settled_record_is_persisted_without_its_result(asserts on the raw persisted document for delivered, tombstoned, gave-up and cancelled records)settled_records_reopen_without_their_result_and_stay_deduped(SQLite reopen)Commands run locally:
cargo fmt --checkcargo clippy -p tinyagents-tasks --all-targets --all-features -- -D warningscargo test -p tinyagents-tasks(112 passed)cargo test -p tinyagents-orchestration completion(37 passed; the subagent driver is the router's in-tree consumer)cargo clippy --all-targets -- -D warnings(full workspace not run locally)cargo build --all-targets/--all-features(full workspace not run locally)cargo test/cargo test --all-features(full workspace not run locally)Documentation
crates/tinyagents-tasks/src/README.md:CompletionStorebullet rewritten for the driver store and the settle behaviour;mark_failedbullet notes the returned-vs-stored result.CHANGELOG.md: new unreleased entry.CompletionRecord::result,tombstone,cancel_parent,mark_delivered,mark_failedandcompact.Closes #354
Summary by CodeRabbit