Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .agentworkforce/features/critical-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ For GitHub-native issues, every collision-prone role is repository-qualified and

Batch capacity must queue excess work and promote the next issue when the current record completes. Dispatch failures must back off and stop at `dispatch.maxAttempts`. Local internal dispatch expands supported home-relative clone paths, infers cwd only for one remote-matching repository, and fails before spawn when a configured checkout is missing, non-git, or not its worktree root.

Critical briefing delivery is fail-closed. A confirmed delivery failure retries the persisted message, but exhausted initial delivery or reinjection must atomically persist an abort intent for the exact dispatch run, fence side effects to its lease owner, release the complete team, publish a correlated issue-visible abort, and only then restore Ready for Agent plus retry eligibility. Partial release or writeback failures retain the in-progress fence and batch slot for durable cleanup takeover; stale failures from older runs cannot abort a newer team. The lifecycle contract spans `src/orchestrator/factory.ts`, `src/orchestrator/batch-tracker.ts`, `src/ports/state.ts`, `src/state/file-state-store.ts`, and provider writeback implementations.

**What breaks if this fails:** agent execution, batch fairness, retry safety, issue lifecycle accuracy.

---
Expand Down Expand Up @@ -237,7 +239,7 @@ Internal execution must reuse an operator-owned broker when present, otherwise s
| Repo-qualified identity + composite issue key | Equal-number issues share agents, PR caches, or lifecycle state | `src/triage/agent-names.ts`, `src/orchestrator/factory.ts` |
| Clone expansion/inference/preflight | Local work spawns in a missing or wrong checkout | `src/config/schema.ts`, `src/config/local-clone-paths.ts`, `src/cli/fleet.ts` |
| Live high-water + replay suppression | Missed or duplicate dispatch | `src/orchestrator/factory.ts`, `src/subscriptions/event-client.ts` |
| Critical message confirmation | Agents start without receiving tasks | `src/orchestrator/factory.ts`, `src/fleet/internal-fleet-client.ts` |
| Critical message confirmation + abort cleanup | Agents start without receiving tasks, or dirty lifecycle state blocks a safe retry | `src/orchestrator/factory.ts`, `src/fleet/internal-fleet-client.ts`, `src/ports/state.ts`, `src/state/file-state-store.ts`, `src/writeback/github.ts` |
| Durable relay lifecycle + owner epoch | Duplicate remote team/PR, leaked capacity, or stalled release | `src/orchestrator/factory.ts`, `src/ports/state.ts`, `src/state/file-state-store.ts` |
| Remote head publication + receipt recovery | In-flight issue stalls or publishes a stale/local branch | `src/orchestrator/factory.ts`, `src/mount/relayfile-github-connection-write.ts` |
| Canonical babysitter routing + durable wake | Wrong PR wakes, event loss, or duplicate branch mutation | `src/orchestrator/factory.ts`, `src/ports/state.ts`, `src/state/file-state-store.ts` |
Expand Down
4 changes: 2 additions & 2 deletions .agentworkforce/features/manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ categories:
- id: dispatch-critical-delivery-retry
name: Critical Delivery Retry
api: FleetClient.onDeliveryFailed()
description: Persist critical messages by event ID and retry them when broker delivery fails
location: src/orchestrator/factory.ts, src/state/in-memory-state-store.ts
description: Persist critical messages by event ID, retry confirmed failures, and on exhausted initial delivery or reinjection durably fence and release the full team before an idempotent issue-visible abort restores retryable source state
location: src/orchestrator/factory.ts, src/orchestrator/batch-tracker.ts, src/ports/state.ts, src/state/in-memory-state-store.ts, src/state/file-state-store.ts, src/writeback/github.ts
verify_tier: 4

- id: dispatch-agent-resume
Expand Down
1 change: 1 addition & 0 deletions .agentworkforce/features/verify/procedures.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ Against a disposable fixture/provider issue, verify:
1. implementer(s) and reviewer/workflow spawn once;
2. task delivery receives `delivery_injected` acknowledgement before input submission;
3. a simulated delivery failure retries the persisted critical message;
exhausted initial delivery and exhausted reinjection must converge on one owner-fenced abort that releases the full team, emits at most one correlated `cleanup-pending` marker and at most one final `aborted` marker, restores source readiness only after cleanup acknowledgement, and survives retries, release/writeback failure, plus remote-owner restart without duplicating either marker or respawning workers;
4. an interrupted session resumes once;
5. batch overflow queues and completion promotes the next issue;
6. registry data contains agent/session/PID or remote invocation/node identity;
Expand Down
3 changes: 3 additions & 0 deletions src/orchestrator/batch-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export interface TrackedAgent {
}

export interface InFlightIssue {
/** Exact durable dispatch attempt; absent for local-only dispatches. */
runId?: string
issue: IssueRef
decision: TriageDecision
dryRun: boolean
Expand Down Expand Up @@ -181,6 +183,7 @@ export class BatchTracker {
const existing = this.#inFlight.get(key)
if (existing) return existing
const restored: InFlightIssue = {
runId: record.runId,
issue: { ...record.issue },
decision: structuredClone(record.decision),
dryRun: record.dryRun,
Expand Down
Loading