Skip to content

fleet queue: preserve the holder’s deadline on early heartbeats - #13589

Open
dezren39 wants to merge 1 commit into
mainfrom
codex/fleet-13553-heartbeat
Open

dezren39 wants to merge 1 commit into
mainfrom
codex/fleet-13553-heartbeat

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Closes #13553. Part of #13272.

An early default heartbeat on a four-hour claim previously replaced its deadline with a fifteen-minute window. The Turso update now takes the later deadline, checks the observed claim at write time and returns the updated row. A SQLite trigger mirrors the effective deadline and heartbeat clock within that statement. The hosted fixture follows the same renewal policy. Updated the queue concept and command reference.

The SQLite fixture covers a repeated early renewal, a late renewal, stale claim updates and an injected mirror failure. The hosted test exercises both copies of the deadline. Verification runs and findings will be linked below. Rollout and production observations are separate.

{
  "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-23T18:10:08Z",
    "session_id": null,
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/worktrees/fleet-13553-heartbeat",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/worktrees/fleet-13553-heartbeat",
      "repo": "developing-today/code",
      "branch": "codex/fleet-13553-heartbeat",
      "sha": "84ffb4eeaf74e8e513cb2ca3d829aac4c31493b8"
    },
    "auth_subject": "agent-next-25-local",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Show it working
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

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 21 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: 34e72e74-d7f3-4e58-84ea-1b04a59fd49f
Commits

Reviewing files that changed from the base of the PR and between a5ed02d and 84ffb4e.

Files selected for processing: 9

  • pkgs/fleet/book/concepts/queue.md
  • pkgs/fleet/book/reference/queue-lifecycle.md
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/core.rs
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/heartbeat.sql
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/heartbeat_lease_mirror.sql
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/lifecycle.rs
  • pkgs/fleet/hosted-worker/src/queue.ts
  • pkgs/fleet/hosted-worker/test/queue.test.ts
  • pkgs/fleet/tests/test_heartbeat_lease.py
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T18:12:21.523027Z 84ffb4e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84ffb4eeaf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +38 to +42
for now, proposed, expected in [
("2026-01-01T00:05:00Z", "2026-01-01T00:20:00Z", initial),
("2026-01-01T00:05:00Z", "2026-01-01T00:20:00Z", initial),
("2026-01-01T03:55:00Z", later, later),
("2026-01-01T03:56:00Z", "2026-01-01T04:00:00Z", later),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add generated coverage for heartbeat invariants

The new heartbeat tests exercise fixed examples only, although deadline monotonicity, task/lease agreement, and rejection of changed claim identities are meaningful state-machine invariants. The repository's testing doctrine requires property/model-based coverage for these invariants; example tests alone do not satisfy that requirement. Add generated renewal sequences and claim mutations checked against a reference model, retaining these examples as regression cases.

AGENTS.md reference: AGENTS.md:L36-L39

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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.

fleet queue: an early heartbeat shortens the current holder’s lease

1 participant