Skip to content

Bridge S6: instruction work-item lifecycle — work_state/work_task_id + fleet bridge work (#14372) - #14430

Merged
developing-today-fleet[bot] merged 5 commits into
mainfrom
felix/14372-bridge-work-lifecycle
Nov 24, 2026
Merged

developing-today-fleet[bot] merged 5 commits into
mainfrom
felix/14372-bridge-work-lifecycle

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Implements bridge build-out slice S6 (#14372, design §4.6). Left unmerged for Felix's review.

What changed

Worker (pkgs/message-bridge/worker)

  • fleet_message and note_message gain work_state TEXT / work_task_id INTEGER — additive migrations in the from_addr pattern; null reads as received.
  • One shared lifecycle model (messages.js): states received -> acted | queued -> done, forward only, re-marking the current state a no-op; queued must name the queue task id.
  • Agent verbs, own rows only: POST /fleet/<token-or-cred>/work {agent, id, state, task_id?} and POST /notes/work {id, state, task_id?}. With a per-agent credential (S3), naming another agent or another agent's row is the plain 404; the store lookup is scoped to the caller's own mailbox/inbox on every path.
  • Owner pipeline (S2) projects work_state/work_task_id on all three surfaces and gains a work_state filter (the stuck-at-received view). Per-recipient independence on group sends: one row per recipient, each with its own state. Connector instructions store no fields (design §6 limit): the pipeline derives received/acted from read state.
  • Batch linkage uses the fleet rows' own batch field (S1's bridge_distribution is not on main yet).

Fleet CLI (pkgs/fleet)

  • New verb fleet bridge work [--agent A] --state acted|queued|done [--task ID] ID... (agent token family; queued without --task is a usage error).
  • The task-it-or-queue-it rule stands verbatim-identical in three carriers: fleet-bridge WORK_RULE (the verb's help), the book (reference/bridge.md, quoted), and the woken-agent text the intake ladder hands out with a pushed command (fleet-agent next.rs push rung, which also gains the three work follow-up commands). A CLI test pins the help text to the constant.
  • Book updated in-slice: reference/bridge.md (new fleet bridge work section + rule) and concepts/bridge.md (verb row + lifecycle paragraph).

Deliberate readings of the design (flagged for review)

  • The lifecycle is settable only by the receiving agent (design §4.6 + the issue's first acceptance line), so there is no owner-side set route; the owner side is read-only through the pipeline.
  • received -> done directly is refused: the design's graph passes through acted or queued. (First remote run caught my rank-based shortcut allowing it; fixed in bdf9e34.)

Verification (remote only)

New dependencies: none. pkgs/id/rust-toolchain.toml untouched.

Closes #14372

{
  "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-24T14:53:36Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch/workspace/issue-14372/wt",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch/workspace/issue-14372/wt",
      "repo": "developing-today/code",
      "branch": "felix/14372-bridge-work-lifecycle",
      "sha": "bdf9e34f21039f98f76ca5d71592fd18c2a170c1"
    },
    "auth_subject": "felix",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

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

felix added 2 commits November 24, 2026 14:22
…eet bridge work (#14372)

fleet_message and note_message gain work_state/work_task_id (additive
migrations, null reads as received). The receiving agent moves its own
copy forward only — received -> acted | queued -> done — through
POST /fleet/<cred>/work and POST /notes/work; queued names the queue
task it became. A per-agent credential marks only its own rows, every
refusal the plain 404. The owner pipeline projects the fields on all
three surfaces (connector instructions derive received/acted from read
state) and gains a work_state filter. fleet bridge work is the CLI
verb; the task-it-or-queue-it rule stands verbatim in the verb help,
the fleet book, and the intake ladder's pushed-command text.
…in work tests (#14372)

workTransitionError now spells out the design's transitions
(received -> acted | queued -> done) instead of a rank comparison,
which let received -> done skip the middle. Two work tests read a
response body twice (assert message + json); read once.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: 2da3582d-5cf1-4e59-9bc2-02f49c85d5aa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Worker verification complete: run 45415315197 concluded success; log verifies Target HEAD bdf9e34f21039f98f76ca5d71592fd18c2a170c1 and the full suite at 90 tests / 90 pass / 0 fail, including the six new lifecycle tests by name (ok 85–90: fleet lifecycle + pipeline steps; forward-only transitions; per-recipient independence on one batch; credential cross-agent 404; notes-surface lifecycle; connector received/acted via read state).

Still in flight: fleet crates run 45413492007 (cargo test -p fleet-bridge -p fleet-agent).

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Status note (2026-11-24 ~15:18Z): the fleet-crates run 45413492007 (cargo test -p fleet-bridge -p fleet-agent) is still in its Execute step ~80 minutes after dispatch — far past this workspace's usual remote build time, with no partial log available for an in-progress job. The worker half of this slice is fully verified (90/90, run 45415315197). The run's conclusion and counts will be posted here when it lands; if it ends in a timeout or an environment failure rather than test failures, the crates should be re-dispatched rather than treated as verified.

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Correction to the status note above: run 45413492007 has since concluded cancelled (after ~85 min in its Execute step) — an environment outcome, not a test result. The fleet crates are therefore not yet verified. Re-dispatched as two narrower runs on head bdf9e34: 45425438462 (cargo test -p fleet-bridge --lib) and 45425456672 (cargo test -p fleet-agent --lib). Results will be posted here when they land.

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Fleet-crate verification, partial: fleet-bridge run 45425438462 concluded success — log verifies Target HEAD bdf9e34f21039f98f76ca5d71592fd18c2a170c1, 19 passed / 0 failed, including the new tests by name: work_marks_the_agents_own_rows_and_names_the_queue_task, work_help_carries_the_task_it_or_queue_it_rule (plus the extended help/usage-error tests).

fleet-agent run 45425456672 (cargo test -p fleet-agent --lib) is still in its Execute step ~55 min after dispatch at the time of this note — the same executor slowness that got the combined run 45413492007 cancelled. Its result remains outstanding; the fleet-agent change in this PR is additive (the PUSH_WORK_RULE text, a rule field and three work follow-ups on the push rung). Everything else in the slice is verified: worker 90/90 (run 45415315197), fleet-bridge 19/19.

…rk-lifecycle

# Conflicts:
#	pkgs/message-bridge/worker/src/fleet.js
#	pkgs/message-bridge/worker/src/messages.js
#	pkgs/message-bridge/worker/src/notes.js
felix added 2 commits November 24, 2026 17:45
…rk-lifecycle

# Conflicts:
#	pkgs/fleet/crates/fleet-bridge/src/lib.rs
#	pkgs/fleet/crates/fleet-bridge/src/tests.rs
#	pkgs/message-bridge/worker/README.md
…rk-lifecycle

# Conflicts:
#	pkgs/fleet/book/reference/bridge.md
#	pkgs/fleet/crates/fleet-bridge/src/lib.rs
#	pkgs/message-bridge/worker/src/index.js
#	pkgs/message-bridge/worker/src/messages.js
@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Merge-refresh record (Felix lane) — branch refreshed to head ad70e2388, PR is MERGEABLE/CLEAN. Three merges of origin/main were needed as the sibling bridge slices landed in sequence (S1 #14412, S5 #14442, S8 #14374/S10 #14376, then S4 #14416). No semantic choices were made: lifecycle transition rules, credential scoping and anonymity projections are byte-for-byte the rules each slice landed with.

Conflicts and resolutions:

  • Merge 1 (main @ bfba379, commit 8250856): import unions in worker fleet.js/notes.js (glob + work helpers); MemoryStore noteDeliver row union (batch + work_state/work_task_id); auto-merge had duplicated const noteCols in index.js (S1 batch migration + S6 lifecycle migration in one scope) — deduplicated to one PRAGMA read serving both column checks.
  • Merge 2 (main @ 66858a2, commit 902b063; S10 bridge S10 (#14376): console provisioning — enroll + credential mints shown once, token state, revoke by agent #14506 had landed): VALUE_FLAGS union in fleet-bridge lib.rs; tests.rs verb-list union; tests.rs interleaved test bodies reconstructed as four intact tests (work_marks…, work_help…, pipeline_directory…, provisioning_verb_shapes…); worker README tables unioned (S6 work rows into S8/S10's reformatted tables).
  • Merge 3 (main @ 647c06e, commit ad70e23; S4 Bridge build-out S4: fleet agent enroll --bootstrap + notes kind/reply_to (#14370) #14416 had landed): worker index.js import union and noteInbox SELECT union (kind/reply_to + work_state/work_task_id, projected through noteForInbox); messages.js noteDeliver row union (kind/reply_to + work fields), noteInbox map union, and noteForInbox extended to pass work_state/work_task_id through (S4's instruction sender-stripping untouched); fleet-bridge usage/dispatch arm unions (work + exchange + notes) and VALUE_FLAGS --bootstrap; book bridge.md union (fleet-token row gains work; work/exchange/notes sections all present, WORK_RULE text verified identical in book and code).

Verification (remote only, fleet-command on developing-today/fleet, TARGET_HEAD confirmed in every log):

  • Head 8250856: worker 114/114 (run 45436780161), fleet-bridge 19/19 (45436825603), fleet-agent 94 passed / 1 filtered (45448506433).
  • Head 902b063: worker 125/125 (45452116170), fleet-bridge 21/21 (45452127758), fleet-agent 94 / 1 filtered (45452145086).
  • Head ad70e23 (final): worker 128/128 (45454469270), fleet-bridge 26/26 (45454495975), fleet-agent 97 passed / 0 failed / 1 filtered (45454528840).

fleet-agent note: the unfiltered lib suite hangs in the executor on the pre-existing test a_background_cargo_build_holds_its_target_lease_until_exit (issue #14446) — the original lane's run 45425456672 and this refresh's first attempt (45436852592) were both cancelled by the environment at ~85 min in Execute for exactly that reason. The filtered runs above skip only that test; all other fleet-agent tests pass, including S6's next.rs work follow-ups and S4's bootstrap tests. Left unmerged for Felix's merge.

@developing-today-fleet
developing-today-fleet Bot merged commit 394a670 into main Nov 24, 2026
2 checks passed
@developing-today-fleet
developing-today-fleet Bot deleted the felix/14372-bridge-work-lifecycle branch November 24, 2026 18:11
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.

Bridge build-out S6 — instruction work-item lifecycle (worker + fleet CLI + harness text)

0 participants