Skip to content

feat: track every inbox-plane work request - #3042

Closed
bingb0t5 wants to merge 12 commits into
kunchenguid:mainfrom
bingb0t5:fm/fm-tracked-delegation-fork
Closed

bingb0t5 wants to merge 12 commits into
kunchenguid:mainfrom
bingb0t5:fm/fm-tracked-delegation-fork

Conversation

@bingb0t5

Copy link
Copy Markdown

Intent

Make untracked delegation impossible. Firstmate must rely on durable records as the source of truth: a work-asking send/steer must automatically create a tracked pending obligation, and firstmate must be able to list every still-open one without grepping chats or journals. Absence of a search hit is not evidence of absence; the obligation list is the cheap authoritative answer to whether work was actually requested or closed.

Reuse the existing pending-obligation mechanism (bin/fm-pending-reply-lib.sh, bin/fm-send.sh). Do not add a second control plane, daemon, or wrapper. Do not solve this with AGENTS.md prose, a skill that says "remember to mark requests", or a new general policy layer. Do not build fm-fresh-external-claims (live PR/check reads).

A work-asking send/steer that would otherwise be fire-and-forget must open a durable obligation visible to the listing command, or refuse rather than deliver untracked. The chosen bin/ owner, documented in its header, lists every open obligation for that home; an answered obligation leaves the open list. A documentation-only change with no executable gate must not satisfy the tracking requirement.

Accepted review decisions already applied on this head: restore from-firstmate marking for a secondmate even when the text is a typed-plane slash invocation; ship/scout crewmate work-asking inbox steers still open an obligation but close it on a terminal status line (done/failed/blocked) without requiring a corr token and must not nag or captain-block; corr reuse only on the dedicated recovery resend path, not an unanchored grep of quoted tokens; sort the list by created epoch; a malformed or unreadable record must not vanish from the authoritative list; typed-plane harness invocations such as /no-mistakes stay untracked.

Keep mechanics in the owning script header and --help (one-owner rule). At most a one-line AGENTS.md trigger at the genuine risk point; do not restate the contract. Portable tests in tests/, named .test.sh, must exercise the executable and never assert implementation-source bytes. Run bin/fm-lint.sh on script changes. Never add an agent name as a commit co-author. Any wait must be bounded with an escape: fail closed with a named error rather than polling forever.

Standing no-mistakes posture. Target the captain fork bingb0t5/firstmate. Do not merge. This run is on fm/fm-tracked-delegation-fork, keeping every prior pipeline fix commit; do not reopen or wait on #3034.

What Changed

  • Make inbox-plane sends to recorded tasks create durable pending obligations before delivery, refusing sends that cannot be tracked while leaving typed-plane harness invocations untracked.
  • Add an authoritative command that lists all open obligations by creation time and keeps malformed or unreadable records visible.
  • Resolve crewmate and scout obligations from terminal status transitions while preserving correlated recovery and escalation behavior for secondmates.

Risk Assessment

✅ Low: The prior crew-resolution and malformed-record issues are corrected, and the remaining changes conform to the stated tracking, listing, ordering, typed-plane, and resolution requirements without a substantiated reachable defect.

Testing

Exercised durable obligation creation, authoritative listing, terminal-transition closure, malformed-record visibility, typed-plane exclusions, secondmate marking, bounded failure behavior, and send-plane durability. All targeted tests passed, a reviewer-visible CLI transcript was captured, and no transient worktree changes remained.

Evidence: Pending-obligation end-to-end CLI transcript

Source: Pending-obligation end-to-end CLI transcript

ok - normal correlated reply resolves once (idempotent)
ok - completed turn with no report triggers exactly one recovery
ok - recovery attempts reconcile without reinjection
ok - recovery reply resolves the original expectation
ok - second missed turn escalates once and remains durable
ok - escalations and replies wake; the home's own escalation close stays quiet
ok - failed escalation publication remains retryable and publishes once
ok - legacy escalation closes under the shared default key
ok - legacy escalation cannot close an unrelated default-key decision
ok - foreign correlated blocker cannot impersonate a pending-reply escalation
ok - concurrent resolution closes one keyed escalation exactly once
ok - concurrent escalation yields to a late correlated reply
ok - transport success cannot masquerade as reply success
ok - undelivered records remain immutable across scan paths
ok - delivery confirmation fallback reconciles durably
ok - delivery confirmation serializes with reconciliation
ok - unrelated events and stale correlation ids cannot resolve
ok - restart preserves expectation and exact parent destination
ok - wrong-home reports are detected but do not silently acknowledge
ok - inbox-plane crewmate text opens a pending obligation visible to list
ok - an answered obligation leaves the open list
ok - crew obligations use durable kind and a request-time status baseline
ok - crew terminal transitions resolve one oldest obligation each
ok - crew reconciliation consumes unseen terminals and ignores needs-decision
ok - quoted corr text does not reuse an obligation
ok - open list orders by epoch and surfaces malformed records
ok - typed-plane, --key, and explicit-target sends stay off the open list
ok - list refuses to resolve against an implicit home
ok - fm-send marked secondmate path creates pending and embeds corr
ok - status-pointed document resolves the expectation
ok - optional helper report resolves without being required for correctness
ok - backend busy/idle observation covers Pi/Claude paths without conversation scrape
ok - tmux and zellij unknown states use bounded capture fallback
ok - pending replies scope Kimi capture fallback by recorded harness
ok - tick skips terminal records and reuses target observations
ok - correlations are reused only for matching open task records
ok - tick end-to-end: miss -> one recovery -> escalate -> durable
ok - failed transport discards undelivered expectation only
ok - a remote repost waits for the reply channel and still fires on a real miss
ok - a mirrored correlated remote reply resolves without any repost
ok - all pending-reply tests passed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed (2) ✅
  • 🚨 bin/fm-pending-reply-lib.sh:572 - The accepted behavior says crew obligations close on terminal done/failed/blocked lines, but this calls status_is_terminal_verb, which also accepts needs-decision. A crew status of needs-decision: choose API therefore removes the obligation from the authoritative open list even though the request is awaiting an answer. Use the crew-specific accepted terminal set here.
  • 🚨 bin/fm-pending-reply-lib.sh:571 - Crew reconciliation examines only last_status_line. If done: request complete is followed by any nonterminal status before the watcher runs, the changed signature is recorded without resolving and that terminal transition is permanently missed. Likewise, two terminal lines appended between ticks can close only one of two open obligations. The accepted requirement says terminal status lines close crew obligations, so reconciliation must consume unseen status transitions from the request-time boundary, not just inspect the latest line.
  • 🚨 bin/fm-pending-reply-lib.sh:1535 - The intent requires that a malformed or unreadable record must not vanish from the authoritative list, but any malformed file containing phase=resolved is omitted without validating its schema, correlation ID, task ID, or resolution fields. For example, a truncated record containing only phase=resolved disappears. Only suppress records that are validly resolved; surface invalid records as phase=unknown or an explicit malformed state.

🔧 Fix: Fix crew transition tracking and malformed record visibility
2 errors still open:

  • 🚨 bin/fm-pending-reply-lib.sh:738 - The required crew rule is "close it on a terminal status line (done/failed/blocked)", but this first applies the secondmate correlation matcher to every record. A crew line such as working: corr=<id> investigating therefore resolves the obligation before the crew-only terminal check runs. Select resolution behavior by target_kind before scanning: correlated acknowledgements for secondmates, terminal transitions only for crew.
  • 🚨 bin/fm-pending-reply-lib.sh:745 - The required fix says to consume every unseen terminal transition, but a newer obligation inspected before the oldest can find terminal lines that belong to the oldest, claim none, and still advance its scan signature here. If two terminal lines arrived between ticks, the oldest then consumes only the first; the newer will not scan again until another status-file change, leaving the second transition unconsumed. Reconcile all eligible transitions for the task under the shared task lock, or do not advance a record's signature while an eligible unclaimed transition remains.

🔧 Fix: Fix task-wide crew terminal reconciliation
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • tests/fm-pending-reply.test.sh
  • bash tests/fm-send-inbox.test.sh
  • bash tests/fm-send-secondmate-marker.test.sh
  • tests/fm-pending-reply.test.sh | tee /home/rich/.no-mistakes/evidence/01M0W08KRQ8R2SST2REXT6SW2E/pending-obligation-e2e-transcript.txt
  • git status --short
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Fix empty candidate variable assignments
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5

The PR is not yet safe to merge because stale terminal claims can still leave obligations permanently open when task-incarnation metadata is absent and filesystem identity is reused.

The new incarnation check handles normal recreated tasks, but records or claims lacking task_incarnation still use the previously reported colliding filesystem identity path, allowing a valid new terminal transition to be skipped.

Files Needing Attention: bin/fm-pending-reply-lib.sh, tests/fm-pending-reply.test.sh

Reviews (4): Last reviewed commit: "no-mistakes: apply CI fixes" | Re-trigger Greptile

Comment thread bin/fm-pending-reply-lib.sh Resolved
Comment thread bin/fm-pending-reply-lib.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: first look on current main 6a2cd6cd2c64 (#3024). Never messaged the captain.

class=default-behavior. Inbox-plane fm-send text to any recorded task now opens a durable pending-reply obligation before delivery, or refuses rather than sending untracked. No opt-in flag. Typed-plane / and Codex $ stay untracked; --key and explicit backend targets unchanged. That is a new default on the ordinary send path, not an option to enable. Never auto.

VISION.md (inspected bin/fm-send.sh INBOX_PLANE / fm_pending_reply_create refuse-untracked, bin/fm-pending-reply-lib.sh crew terminal claim + malformed visibility, bin/fm-pending-reply.sh list, AGENTS.md obligation trigger, tests/fm-pending-reply.test.sh / tests/fm-send-inbox.test.sh / tests/fm-send-secondmate-marker.test.sh):

  • One captain, one interface: aligns (authoritative list instead of grepping chats; crew terminals close without captain nag).
  • Authority is explicit: does not align as auto (every inbox send is tracked without a grant).
  • Scripts own the mechanics: aligns (record create/list/resolve is exact; crew terminals are verb-set, not meaning).
  • A restart is a non-event: aligns (obligations live in state/pending-replies/; listing is the cheap source of truth).
  • Delegation with a spine: mixed (spine yes; new default tracking widens standing send behavior).
  • The fleet outlives any vendor: aligns.
  • Scope: aligns (reuses pending-reply, no second control plane).

This HEAD: 9950d285a451b5396c776221c80d0260fa51033f. MERGEABLE / UNSTABLE, ahead 12 / behind 0.
Attestation 6403e44b… ≠ THIS HEAD (later no-mistakes: apply CI fixes).
CI: fork Actions on THIS HEAD are action_required (CI 32832134361, Require no-mistakes 32832134339) — not green. Greptile 4/5 (incarnation / stale terminal claims) is not a merge gate. Author body does not use a GitHub closing link.

Not first-time. No workflow approval this pass.

Security: none. Local pending-reply records; refuse-closed if the record cannot open; no network/credential change.

Overlap: same-author #3034 (earlier "track every delegated work request"; this body says do not wait on it). bin/fm-send.sh / pending-reply / AGENTS.md / docs also sit near other opens. Not lock / spawn-freshen / herdr / #2804.

Land-eligible rec: NO. Captain-flag NOW: no (attestation mismatch and CI not green; do not escalate those).

This is waiting-on-author for a HEAD-matching no-mistakes-pipeline-attestation:v1 (and green Actions). Class stays default-behavior for a later pass. Not a captain-decision this pass. Not a merge I will recommend.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this account has been flagged as attempting malicious activity and can no longer contribute to any of Kun's repos. Closing this pull request.

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