Skip to content

feat(loop): agent list + enforce --agent-id on run (parallel-safety) - #125

Merged
huichen merged 2 commits into
mainfrom
claude/loop-agent-list
Aug 9, 2026
Merged

huichen merged 2 commits into
mainfrom
claude/loop-agent-list

Conversation

@huichen

@huichen huichen commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Parallel-safety hardening for future loop run + an agent-registry inspection command.

Commit 1 — agent list (0ff24a8)

New future loop agent list --goal G: lists every registered agent with live
execution status — running (holds a live lease on a todo, with lease time
remaining) vs idle — plus declared capabilities and last activity. Pre-flight
check before registering/launching so parallel workers reuse existing ids
instead of re-registering the same one. 3 new contract tests.

Commit 2 — enforce --agent-id on run (8bea289)

  • run now REQUIRES --agent-id and fails fast (before any gRPC/session work)
    with a hint pointing at agent list; --anonymous opts back into the legacy
    uncoordinated one-shot path with a warning.
  • ensure_run_identity() auto-registers an unregistered id on first use
    (check-then-register, replay idempotent → no duplicate events); registered
    ids pass through untouched.
  • run claims the task lease with --lease-secs (default 4h instead of the
    hardcoded 1h — long LLM/compute turns >1h could get the todo stolen
    mid-turn once the lease expired).
  • agent onboard accepts both --capability and --capabilities (docs used
    the plural, code only parsed the singular).
  • 5 new run_identity_contract tests (fail-closed hint, anonymous escape,
    auto-register once, existing-id passthrough, CLI fail-fast before connect).

Also included

  • agent/src/llm/mod.rs: LLM call timeout 600→1800s + FUTURE_LLM_TIMEOUT_SECS
    env override (long-turn support).
  • Skill v1.0.3: parallel-safety sections (6.0/6.1), agent list, enforced
    --agent-id, 4h lease / --lease-secs docs.

Validation

  • 512 loop contract tests + full workspace suite (851) green
  • clippy --workspace --all-targets -D warnings clean, fmt clean
  • desktop --lib tests green (no desktop files changed; TS checks run in CI
    with deps installed — worktree has no node_modules)

chenhui added 2 commits August 8, 2026 10:56
Add `future loop agent list --goal G`: lists every registered agent with
its current execution status, so parallel workers check who is already
registered before registering/launching (avoid duplicate ids).

- status derived from the live task-lease ledger: running = holds a live
  lease on a todo right now (todo id + lease remaining); idle = registered
  but holding no lease.
- also shows declared capabilities (agent_profiles) and the agent's most
  recent activity (from agent/lease events).
- onboard now accepts both --capability and --capabilities (docs used the
  plural form; code only parsed the singular).
- contract tests: empty goal, registered-only ids, live-lease → running /
  release → idle; help + registry surface updated.
- skill (1.0.3): document agent list in the command reference and the
  register-once/reuse-ids guidance.
Make run identity mandatory so the lease mechanism always engages:

- `run` now REQUIRES --agent-id and fails fast (before any gRPC/session
  work) with a hint pointing at `agent list`; --anonymous opts back into
  the legacy uncoordinated one-shot path with a warning.
- ensure_run_identity(): auto-registers an unregistered id on first use
  (replay is idempotent, so no separate register step); already-registered
  ids pass through without appending duplicate events.
- run claims the task lease with --lease-secs (default 4h instead of the
  hardcoded 1h — long LLM/compute turns routinely exceed 1h, which let
  another worker steal the todo mid-turn once the lease expired).
- --anonymous added to the boolean-flag set in parse_pairs.
- run_identity_contract.rs: 5 tests (fail-closed hint, anonymous escape,
  auto-register once + no duplicate event, existing id passthrough,
  CLI fail-fast before connecting).
- skill 1.0.3: fold in the user's 6.0/6.1 parallel-safety sections (main
  working-tree copy) and update them for the enforced behavior; document
  agent list, auto-register, 4h lease, --lease-secs.
- agent/src/llm/mod.rs: copy user's LLM timeout change (600→1800s +
  FUTURE_LLM_TIMEOUT_SECS env override) from main working tree.
@huichen
huichen merged commit 3233a02 into main Aug 9, 2026
15 checks passed
@huichen
huichen deleted the claude/loop-agent-list branch August 9, 2026 10:12
@huichen
huichen restored the claude/loop-agent-list branch August 17, 2026 04:17
@huichen
huichen deleted the claude/loop-agent-list branch August 17, 2026 12:25
huichen added a commit that referenced this pull request Nov 15, 2026
…ogue-lane wait; bump skills (#1625)

* feat(cli): pin and unpin conversations and workspaces from the terminal

The desktop app's pinned section had no CLI: `future session list` is a gRPC
call to the Agent, which has no notion of a pin, and nothing read the flag the
app stores on `threads.pinned` / `workspaces.pinned`. So a user could see the
section in the app and had no way to inspect or change it from a terminal.

Adds both scopes, both directions, and both listings:

  future session pin|unpin <session-id>
  future session pinned [--json|--format toon]
  future workspace pin|unpin <path|id|name>
  future workspace list --pinned [--json]

The writes go through `store::pin_thread` / `store::pin_workspace` — the same
calls the app and the remote bridge use — so the catalogue-dirty signal that
tells the app and a paired phone to re-read is not bypassed, and `pinned` stays
an ordering flag rather than becoming an activity event: neither `updated_at`
nor `last_opened_at` is rewritten, which a test asserts at both scopes. The
readings use the store's own queries (`list_pinned_threads` with the app's
`Recent` scope, `list_pinned_workspaces`), so the terminal, the sidebar and the
phone cannot disagree about what is pinned or in which order.

Two consequences of the app's existing rules are reported rather than left to be
discovered: archiving clears the pin (a pinned row on the shelf would hide
behind it), so `unpin` is not the inverse of `archive`; and a pin on an archived
row, or on a row inside an archived workspace, is stored while the section keeps
it out of sight — the note names whichever restore command applies, read from
the row and its workspace. Both are easy to get wrong: the first draft printed
that note on a successful *unpin* of a live row, and inferred the cause instead
of reading it, which only showed up against the real store.

Reads never create the app database (`open_existing` first), so a machine that
never ran the app gets `count: 0` and an empty-state line, or `[]` under
`--json` — not an error, and not a new file. A store `workspace add` created
without a `threads` table lists nothing rather than failing on the missing
table.

The archive module's shared helpers (`parse_target`, `desktop_store`,
`resolve_workspace`, `with_flag`, `pretty`) are now `pub(super)` and its test
harness moved to `test_store`, rather than duplicating either in the new module.

* test(host): name the packet a catalogue-lane wait is waiting for

`catalogue_window_lane_sends_the_newest_rows_and_names_the_rest` failed on
Windows (run 43502377622) at

    assertion `left == right` failed: a deleted conversation is named, not
    left to be inferred
      left: Array []
     right: Array [String("sesswindowborn-7856-764")]

The wait had been satisfied — by the wrong packet. It was
`await_publish(&mut tap, &subject, ..)`, which answers with *the next packet on
the subject*: the lane publishes one packet per change, so a second packet on
`p.{pair}.state.sessions` describing the state *before* the deletion (the same
change detected twice, a restarted loop's resync, a second publisher
generation) is taken as the answer, and `removed` reads `[]`. The tap is also a
256-slot ring over a 100/s heartbeat, so the same wait loses a change-driven
packet outright when the reader is descheduled — the reason the bridge test
already reads the broker record instead (#1606).

Both waits now do that: `FakeNats::await_publish` reads the record (nothing is
dropped, and a packet published before the wait began is still found) and is
keyed by `accepts` — the packet that *says* what the caller awaits — not by the
next arrival. The window and delta lane tests ask for `full: true`, for the
packet naming the row that was born, and for the one naming the removal.

The window test also publishes the shift packet once more before deleting: that
one repeated packet is the flake's timing, made deterministic. With the old
wait it is taken and the test fails with the output above, byte for byte; with
the condition-keyed wait it is skipped and the test is green. A wait that times
out now names the newest packet on the subject instead of only the budget.

host: cargo test -p future-host --lib remote → 715 passed, 0 failed
      (the window test 5x, the delta lane 1x, the four await_publish tests)

* chore(skills): bump future-skills to document pinning (#125)
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