Skip to content

feat: add Droid harness support - #70

Closed
esotericzhang wants to merge 4 commits into
kunchenguid:mainfrom
esotericzhang:feat/droid-harness-support
Closed

esotericzhang wants to merge 4 commits into
kunchenguid:mainfrom
esotericzhang:feat/droid-harness-support

Conversation

@esotericzhang

Copy link
Copy Markdown

Intent

Make Factory Droid CLI a first-class verified Firstmate harness, functionally equivalent to the existing Claude, Codex, OpenCode, and Pi harnesses. The implementation should support Droid in harness detection and session locking, spawning ship/scout tasks and secondmates, turn-end signaling via Droid Stop hooks, busy-pane detection, teardown cleanup, skill discovery through Factory's .factory/skills path, self-update instruction-surface tracking, and project documentation. It should preserve Firstmate's safety posture by using Droid --auto high rather than unsafe permission bypass, keep runtime hook settings in state rather than project worktrees, ensure Droid sessions do not add agent co-author trailers, and include behavior tests for Droid launch templates, secondmate behavior, adapter acceptance, and busy-footer detection.

What Changed

  • Adds Droid as a verified Firstmate harness for detection, spawning, session locking, busy-pane handling, teardown cleanup, and runtime turn-end Stop hooks using --auto high.
  • Exposes Factory skill discovery through .factory/skills and updates Firstmate docs and skills to describe Droid behavior, co-author suppression, and instruction-surface handling.
  • Adds behavior coverage for Droid launch templates, secondmate launch behavior, adapter acceptance, and Droid busy-footer recognition.

Risk Assessment

✅ Low: Captain, the changes are well-bounded harness-adapter additions with matching cleanup, detection, documentation, and focused behavior coverage, and I did not identify material merge-blocking risks.

Testing

Inspected the Droid harness change scope, ran focused behavior tests covering Droid ship and secondmate launch templates, verified adapter acceptance, busy-footer detection, wake handling, update instruction-surface tracking, and manually demonstrated Droid harness detection plus lock recognition; the relevant tests and checks passed, the working tree remained clean, and the only broad-suite attempt timed out before replacing it with focused validation.

Evidence: Focused Droid harness behavior test transcript
warn: no registry at /var/folders/cp/jmq_5jjx6t3bzrtt05d5_chm0000gn/T/tmp.1JeMeZG0VK/fm-droid-harness.nakBEA/ship/home/data/projects.md; defaulting project to no-mistakes off
ok - droid ship launch uses a runtime Stop hook and records harness metadata
ok - droid secondmate launch omits parent turn-end hook
ok - batch dispatch re-execs and reports every id=repo pair
ok - a single id=repo pair routes through batch dispatch
ok - single-task invocation (no '=') is untouched by batch detection
ok - batch dispatch rejects an argument that is not id=repo
ok - an arg whose id part contains '/' is not treated as a batch pair
ok - FM_HOME scopes projects/ paths for single-task spawn
ok - FM_PROJECTS_OVERRIDE scopes projects/ paths for single-task spawn
ok - explicit droid adapter is accepted as verified
ok - supervise daemon state root is scoped by FM_HOME
ok - concurrent append plus drain preserves queue records
ok - signal written while no watcher runs is caught on next run
ok - stale wake is queued before suppressor state is advanced
ok - check output is queued before cadence suppression
ok - simultaneous watcher starts leave exactly one live process
ok - two atomic drains cannot consume the same records twice
ok - drain collapses obvious duplicate heartbeat and signal records
ok - killed watcher stale lock is reclaimed
ok - live watcher lock with stale heartbeat is actionable
ok - guard warns when queued wakes are pending
ok - guard orders watcher re-arm after queued wake drain
ok - routine signal self-handles
ok - captain-relevant status verbs escalate
ok - check + unknown escalate; heartbeat self-handles
ok - transient stale self-handles and records a persistence marker
ok - stale + terminal status escalates immediately
ok - persistent stale escalates after threshold and clears its marker
ok - resumed (busy) stale clears its marker without escalating
ok - Droid busy footers are recognized
ok - multiple escalations flush as a single batched digest
ok - batch flush measures max-delay from the first append, not the last
ok - catch-all scan escalates a missed terminal once, not twice
ok - handle_wake routes routine->self and captain->escalate
ok - INJECT_SKIP forces self-handle, bypassing captain-relevant classification
ok - is_wake_reason distinguishes watcher wake reasons from singleton-status stdout
ok - terminal-stale escalate removes its marker so housekeeping does not re-escalate
ok - captain signal escalate marks seen so the catch-all scan does not re-fire
ok - _collapse_newlines replaces newlines with literal separator
ok - afk flag absent: daemon does not inject, buffer preserved
ok - afk flag present: daemon injects with sentinel marker prefix
ok - injected digest is single-line (no embedded newlines)
ok - busy-guard defers injection when supervisor pane is busy
ok - marker detection: marker -> stay afk, no marker -> exit afk
ok - /afk invocation is exempt from afk exit (no self-cancel)
ok - should_exit_afk returns false when afk is not active
ok - strip_injection_marker removes the sentinel marker cleanly
ok - pane_input_pending detects partial input on the cursor line
ok - pane_input_pending: blank cursor line is not pending
ok - pane_input_pending: bare prompts are not pending (idle)
ok - pane_input_pending honors FM_COMPOSER_IDLE_RE after border stripping
ok - composer guard defers injection when pane has pending input
ok - swallowed Enter: type-once + Enter-retry, no concatenation
ok - normal inject: exactly one digest, one Enter, no duplicates
ok - classify_signal dedupes against the catch-all scan seen marker
ok - classify_stale dedupes against the signal path seen marker
ok - pane_input_pending: an idle bordered composer is NOT pending (afk-invx-i5)
ok - pane_input_pending: text inside a bordered composer is still pending
ok - submit-ACK confirms a submit when the composer returns to a bordered-empty box
ok - submit-ACK reports pending on a persistently swallowed Enter (type-once)
ok - max-defer on an empty stuck pane types once, alarms, and preserves the buffer
ok - max-defer flushes and clears the buffer on an empty bordered pane
ok - max-defer on a pending composer alarms without typing
ok - normal flush clears a stale wedge marker
ok - below MAX_DEFER: no inject, no alarm, buffer preserved
ok - max-defer does not flush or alarm while afk is inactive
ok - fm-send exits non-zero on a confirmed swallow, zero on a clean submit
ok - fm-send exits non-zero when initial text send fails
Evidence: Self-update instruction-surface test transcript
ok - T1 main + secondmate fast-forward, reread + nudge signalled
ok - T2 advance is a fast-forward, not a merge commit
ok - T3 reread gates on instruction surface, nudge on advancement
ok - T4 dirty secondmate skipped, local edit preserved
ok - T5 diverged secondmate skipped, local commit preserved
ok - T6 idempotent: a second run is a no-op
ok - T7 secondmate resolved from registry without inventing a window
ok - T8 deduped homes and excluded the firstmate repo itself
ok - T9 firstmate off its default branch is skipped, not forced
ok - T10 firstmate detached HEAD is skipped
ok - T11 unsafe secondmate home is not fast-forwarded
# all fm-update tests passed
Evidence: Droid harness detection evidence

droid

droid
Evidence: Droid session-lock recognition evidence

lock: held by live harness pid 57396

lock: held by live harness pid 57396

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • git status --porcelain and git diff --stat e2e730f8e7139e385a6eee3352eea1db9da6adeb..151c1516779ac4d0e5b9344d6f9a17ef7f5eae0d
  • ./tests/fm-droid-harness.test.sh; ./tests/fm-spawn-batch.test.sh; ./tests/fm-wake-queue.test.sh
  • ./tests/fm-update.test.sh
  • Manual harness detection check using a droid-named shell wrapper around ./bin/fm-harness.sh
  • Manual session-lock status check using a live droid-named process recorded in .lock
  • Attempted broad for t in ./tests/*.test.sh; do "$t"; done, which timed out in the long afk e2e test before useful full-suite coverage was produced
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

pranaypratyush added a commit to pranaypratyush/firstmate that referenced this pull request Aug 31, 2026
* fix(remote): relay autonomous secondmate status

* no-mistakes(review): Enforce exact remote reply correlation boundaries

* no-mistakes(review): Harden remote reply correlation parsing

* no-mistakes(review): Require whole-token remote reply correlations

* no-mistakes(document): Document remote lifecycle reply ingestion
@corygforsythe

Copy link
Copy Markdown

Why these values

  • Render path is already correct. A character render loads only the character's LoRA, never the training adapter. It renders at the same 1/rank scale ComfyUI's trainer trained it at (ComfyUI v0.39.0 saves .alpha = 1, and its loader uses alpha/rank). A test now holds that.
  • Recipes. ai-toolkit's Z-Image Turbo preset (with training adapter v2): AdamW at 1e-4 (alpha = rank), 3,000 steps, fp32 LoRA weights. The community starts character LoRAs at strength 0.7–0.8.
  • ComfyUI's numbers differ from ai-toolkit's. TrainLoraNode scales the LoRA by 1/rank, but its randomly-initialised factor starts larger. A CPU calibration puts its 3e-4 ≈ ai-toolkit's 1e-4, and 2.5e-4 ≈ 8e-5.
  • Why fp32: in bf16, AdamW steps that small round away. In that calibration, 2e-4 bf16 learned almost nothing in 2,000 steps.
  • Why shift 1: the trainer's x0 loss weighs each step by σ². At shift 3 that put about 82% of the loss on σ > 0.7, where body and pose are laid out; at shift 1 it is about 66%.
  • High's memory: about 11.4 of the card's 15.5 GiB, from PR 67's memory toy re-run at 1024². Its time is not measured.

Post-merge test plan (after the gitops rollout)

  1. Take one photo set of 15–25 photos with a mix of close-ups, half body and full body.

    • If you have an old LoRA trained on that set, use it as the baseline.
    • Otherwise, train the set on the old settings too (the previous image).
  2. Train the same set on Standard with the new settings (optionally also on High). Watch nvidia-smi in the ComfyUI pod for peak memory: expected ≈ 9 GiB on Standard and ≈ 11.5 GiB on High. Note the real seconds per step from the Training LoRA progress, so the estimates can be corrected.

  3. In Create, on Z-Image Turbo at 1024², 8 steps, render each LoRA at the new default strength 0.8 with the same seeds and the same 6–8 prompts:

    • two close-up portraits;
    • two full-body standing shots with hands visible;
    • one seated;
    • one action pose;
    • one with another person.

    Compare hands, limbs, proportions, face and likeness. Optionally also render the old LoRA at 0.9 for reference.

  4. Reading the result:

    • Weak likeness at 0.8: try 0.9–1.0. If it is still weak, the new settings under-train; raise the steps per photo or the learning rate toward 3e-4.
    • Anatomy still poor: note which prompts fail.
    • High out of memory or past the 6 h timeout: cap or drop High.

fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 2, 2026
…unchenguid#70)

* Add host-level supervision outage sentinel

* Add explicit sentinel disarm and alert backoff

* Harden sentinel outage episode handling

* no-mistakes(review): Fix sentinel path identity, hook alert latency, and episode backoff reset

* Resolve sentinel review merge overlap

* no-mistakes(review): Make sentinel check marker-only, add arm backoff, fix test selection

* no-mistakes(review): Surface sentinel arm failures, make check diagnostic, split retry tunables

* no-mistakes(review): Drop plist notifier seam, share arm-failure cooldown reader

* no-mistakes(review): Merge supervision family map, dedup arm-failure reads, narrow smoke claim

* no-mistakes(review): Arm sentinel only after healthy watcher, fix liveness proof and grace pinning

* no-mistakes(review): Defer away-mode sentinel arm to daemon, require contention evidence

* no-mistakes(review): Retry away sentinel arm on cadence, record host-alarm gaps

* no-mistakes(review): Distinguish unsupported host from retryable sentinel arm failure

* no-mistakes(test): Wait for committed delivery in real-launchd sentinel smoke

* no-mistakes(review): Fix disarm-enable deadlock, add deliberate no-op arm status

* no-mistakes(document): Add sentinel to script inventory and afk return evidence

* no-mistakes(review): Declare the supervision sentinel fork surface

The Declared fork surface CI job and tests/fm-fork-surface.test.sh both
failed because the two files this PR adds, bin/fm-supervision-sentinel.sh
and tests/fm-supervision-sentinel.test.sh, were unclaimed fork-only paths.
Declare them in a supervision-outage-sentinel capability block with the
in-place edits the sentinel makes, proven by its colocated test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
fritznoff pushed a commit to fritznoff/starship that referenced this pull request Nov 18, 2026
…finished (kunchenguid#70)

* feat(bin): tell a Mothership card when work that ends in a report is finished

Investigations, guides and drafts end in a report and no PR, so their room
card only ever heard that work had started. Cleaning such a task up with its
report kept (data/<task-id>/report.md, no PR, not a --force discard) now
reports a new finished event: the card gets one fixed result line that it
finished with a report the ship's owner holds, which settles it like a
landing, and never any of the report's words. Only when the task's body names
an address for the room, mothership-report: <https-url>, does the line say
"Done: finished with a report." with that address as its link.

The send takes the same path as every other card line: config/private-projects
keeps it from every room, the link's allow-list and word check apply, a home
with no room link runs nothing, and a failed send wakes the first mate without
holding up or failing the cleanup. A job on the Ships view hears finished as
dropped, so it leaves the view as before.

* no-mistakes(review): Tell a card a report finished only for scouts

* no-mistakes(review): Settle a card only when a scout's task closes

* no-mistakes(review): Document that a held scout leaves its card open

* no-mistakes(ci): Root cause (ci-4 Test coverage guard, ci-1 Behavior portable parallel 3, ci-3 Full suite): this PR raised the serial packing hint for tests/fm-procevent-mothership-reports.test.sh from 120000 to a provisional 185000 ms, based on one slow local macOS run. With that weight the largest portable serial shard models at 1202052 ms, 2052 ms over the 1200000 ms target. `bin/fm-test-run.sh --check-coverage` then failed, both in the guard job and inside tests/fm-test-run.test.sh, which ran in parallel shard 3. Full suite only rolls up the failed lanes. Invariant: every serial packing hint must reflect real CI cost, so the modeled largest shard stays within the 1200000 ms budget. This PR changed only that one hint, and that is the place the invariant breaks. Fix: in bin/fm-test-run.sh, set the hint to 132386 ms. That is the suite's completed, passing Ubuntu `FM_TEST_END` sample from this PR's own CI run 44068469247 (serial shard 9). This follows the policy in docs/fm-test-portable-shards.md that Ubuntu measurements replace provisional local ones. I updated the matching sentence in that doc to cite the run. Verified locally: - `bin/fm-test-run.sh --check-coverage` exits 0 with `FM_TEST_COVERAGE ok ... serial_max_ms=1198902 serial_budget_ms=1200000 serial_unhinted=0`. - The full `bash tests/fm-test-run.test.sh` run (about 19 minutes) printed no `not ok` lines. Its coverage-guard cases passed: "portable shard union, disjointness, and coverage guard hold" and "coverage guard bounds the unmeasured share and serial packing within twenty minutes". The exit-code echo came out blank, so the absence of failure lines is the only evidence the whole file passed. ci-2 (Behavior portable serial 6) is not caused by this PR. The only failing script there was tests/fm-afk-return.test.sh, case "the restored record did not recover its away window". It expected `away 11:06:19Z` but the brief showed `11:06:20Z`: the away entry and the return `begin` fell on different wall-clock seconds. That is a race in a pre-existing test of AFK code this PR does not touch (the diff has no bin/fm-afk*, bin/fm-supervision* or tests/fm-afk* changes). I left it unchanged. A rerun should pass, and the flake needs its own fix outside this PR
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.

2 participants