Skip to content

[P1] Standardize worker lifecycle, cancellation, retry, quota handoff, and resume #38

Closed

Description

@anthonyandrei

Problem

Each vendor worker can report different process states, failures, timeouts, and quota errors. The secure workflow needs one lifecycle contract for the orchestrator.

Deliverable

Define and implement a shared lifecycle for every adapter:

created, started, running, completed, failed, canceled, quota-handoff, retained, and cleaned.

Make cancellation and timeout terminate the worker, wait for exit, and preserve the correct artifacts. Connect retries and resume to the recorded model choice and the resource ledger.

Acceptance criteria

  • Every adapter reports the shared lifecycle states and valid transitions.
  • A timeout or cancellation stops the worker before cleanup continues.
  • The orchestrator waits for process exit and records the exit result.
  • A normal retry uses the same pinned model and effort.
  • The workflow allows at most one retry per assignment unless an explicit policy changes that limit.
  • Quota exhaustion hands unfinished work back to the orchestrator without waiting for unrelated workers.
  • Resume uses the ledger, assignment identity, verification baseline, and pinned model choice.
  • Failed, canceled, timed-out, and quota-handoff runs retain the evidence required for diagnosis.
  • Malformed worker output cannot advance an assignment to completed.
  • Both shell-native helper families pass equivalent fake-worker lifecycle cases.

Dependencies

Out of scope

  • Vendor-specific model ranking.
  • A general scheduler.
  • Silent provider or model switching.

Implementation pointers

  • modes/execution.md
  • modes/repo-research.md
  • modes/web-research.md
  • scripts/run-agy-json.ps1
  • scripts/run-agy-json.sh
  • tests/

Activity

  1. anthonyandrei commented on Sep 4, 2026

    @anthonyandrei
    OwnerAuthor

    Resolved by PR #39 (#39). The merged implementation covers this issue, and the targeted acceptance tests pass. Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions