GeezerVison is showing github.com — fleet-queue: task_history foundation (Q1, Part of #14170) by dezren39 · Pull Request #14441 · developing-today/code
Conversation
dezren39
commented
Nov 24, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Part of #14170
Slice Q1 of the queue metadata/history design (doc/2026-11-24T07-23-14Z_design_queue-metadata-history). Not a closing PR; #14170 stays open.
What changed
task_history table + two indexes (SCHEMA 27 -> 30). Columns: event_id (UNIQUE), task_id, kind, from/to status, from/to priority, actor, session_id, model_provider/model_id, detail, source, created_at.
event() writes the history row in the same BEGIN IMMEDIATE batch as the events row for mapped lifecycle kinds. Other kinds are unchanged. Existing events rows are kept (health and timeline readers unaffected).
verb_enqueue writes an enqueued event (previously none).
verb_reprioritize writes its history row inside its existing batch, gated on the CAS update (changes() = 1). reprioritized is reserved as a history kind.
/history-backfill (source='backfill', INSERT OR IGNORE on event_id, reports census/inserted/skipped, idempotent) and /history-since (rows by id, optional task/since) in stacks_outbox.rs dispatch.
task_history is exempt from prune_events (default (b)).
Behaviour changes to review
- Kind mapping:
woken maps parked -> queued (wake returns the task to the queue, it does not claim it). This was caught by the remote oracle and corrected.
- Claim marks: history rows take actor/session/model from the event detail written by the transition itself (
with_marks), not from the task's current claim fields at read time. Existing events rows and audit_marks are unchanged.
- Event kind names unchanged: history maps the existing names (
claimed, parked, released, woken, blocked, unblocked, dep_unblocked, completed, cancelled, failed, task_revived, reprioritized, enqueued). No renames.
Atomicity (stated honestly)
The history write uses the BEGIN IMMEDIATE ... COMMIT batch pattern that verb_reprioritize already uses. Atomicity is verified only against the in-memory fake Turso pipeline harness (reprioritize_tests / task_history_tests). The live Turso backend was not exercised for transaction semantics in this PR.
Tests (remote, pinned ref)
Run via fleet queue dispatch --ref queue-q1-task-history --command 'cd pkgs/fleet && cargo test -p fleet-queue --features client,queue-broker', run 45421471336 on head aea7830973a:
fleet-queue --lib: 647 passed, 0 failed (includes the new oracles below).
scripted_lifecycle_history_is_one_to_one_with_transitions: enqueue -> claim -> park -> wake -> claim -> block -> unblock -> reprioritize -> claim -> complete; asserts one history row per mapped event, to_status equals the actual status after every verb, and actor/session/model/from-to priority on the rows. Passes.
backfill_reconciles_to_events_census_and_is_idempotent: census = inserted + skipped; second run inserts 0; history-since returns the rows. Passes.
Note: an earlier dispatch (run 45413627756 / 45415216606 / 45418584604) failed on oracle mistakes and was fixed in commits 76ac40a, 226e1e3, deb52a5 (enqueue packet shape, row envelope, woken mapping, completion disposition). An early run (45408999691) checked out origin/main, not this branch; its 645 count is not evidence for this branch.
Deferred (not in this PR)
- Status-changing UPDATE sites outside the oracle path are not dual-written yet: admin.rs (69,158,239,683,772,833,918,1242), claim.rs (348,423,813,1211,2139), lifecycle.rs (1845,1865,1981,2050), core.rs (1564,2087,2117), repair.rs 306, staleness.rs 457. These still write events only. Oracle covers enqueue, claim, park, wake, block, unblock, reprioritize, complete.
/reprioritize route stays with fleet queue: add a reprioritize verb — change a live task priority and auto-sync the GitHub priority category #14100; only the kind is reserved here.
- Criterion benchmark: none exists in fleet-queue. No latency measurement is recorded in this PR; claim latency is not evidenced.
- Live-backend atomicity check (see above).
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-24T15:27:03Z",
"session_id": "ses_e5df2374da2ffe1srQ8ohFwYx5",
"lane": null,
"host": "amd",
"worktree": "/home/user/wt-queue-q1",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/user/wt-queue-q1",
"repo": "developing-today/code",
"branch": "queue-q1-task-history",
"sha": "aea7830973a59f2cc8f2eb5752a7b263a5477a68"
},
"auth_subject": "oc-code-07",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Adds the task_history table (event_id UNIQUE, status/priority from-to,
actor, session, model marks, source) and two indexes; SCHEMA 27 -> 30.
event() writes the history row in the same BEGIN IMMEDIATE batch as the
events row for mapped lifecycle kinds; other kinds are unchanged.
verb_enqueue writes an enqueued event so the first transition is recorded.
Atomicity is the BEGIN IMMEDIATE batch pattern used by verb_reprioritize;
verified only by the fake harness until the remote run.
Drives enqueue, claim, park, wake, block, unblock, reprioritize and
complete through the real verbs on the fake pipeline harness and asserts
one history row per mapped event, to_status equal to the task's actual
status after each verb, and actor/session/model/priority on the rows.
…ow (#14170 Q1)
/history-backfill inserts one task_history row per mapped events row
without one (source='backfill', INSERT OR IGNORE on event_id) and
reports census, inserted and skipped. /history-since reads task_history
in id order, optionally per task and since a time. reprioritize writes
its history row in its existing BEGIN IMMEDIATE batch, gated on the
CAS update. Backfill and history-since tests added to the oracle module.
The first remote run on the real ref failed the oracle at enqueue
(packet must be a JSON object): enqueue takes a packet, not a task.
Use the packet shape from the enqueue tests and supply completion
evidence for the small_fix gate.
enqueue answers with the row envelope under "row", not "task".
The remote oracle caught the mapping: wake returns the task to the
queue (UPDATE status='queued'), it does not claim it. The oracle now
re-claims after wake and asserts the claimed row.
The small_fix completion gate requires result.disposition (checked_at,
source, issue, pulls, verdict); supply a merged_verified readback so
the scripted lifecycle reaches done.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 30 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6f0af485-9192-40f6-aa13-2e660dcd1c86
Commits
-
Reviewing files that changed from the base of the PR and between 680199a and aea7830.
Files selected for processing: 4
-
pkgs/fleet/crates/fleet-queue/src/turso_queue/claim.rs
pkgs/fleet/crates/fleet-queue/src/turso_queue/core.rs
pkgs/fleet/crates/fleet-queue/src/turso_queue/lifecycle.rs
pkgs/fleet/crates/fleet-queue/src/turso_queue/stacks_outbox.rs
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 24, 2026
|
Superseded by #14700, which carried this branch's Q1 task_history work forward onto current main (SCHEMA conflict resolved to 34 entries) and merged as f0c4321 after a remote cargo test -p fleet-queue --features client,queue-broker --lib run passed (660 passed, 0 failed). Closing this one.
Generated by Claude Code
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|