Skip to content

Daemon pool retries completed agent sessions on non-crash exit codes #1100

Description

@PierrunoYT

Found in the 2026-09-28 code audit (finding N-5).

Where: internal/daemon/pool.go:200-233 vs exit codes at internal/cli/exec.go:37-49.

Problem: The pool stops retrying only on exit 0 or ExitPermanent (76) and treats 75 as tempfail. zero exec also exits 2 (usage), 3 (provider), 4 (incomplete) and 130 (interrupted); all are treated as crashes and retried up to MaxAttempts = 5 with backoff. Exit 4 means the agent already ran (edits, shell commands, pushes), so each retry repeats side effects and re-bills the provider. All attempts are appended to one session buffer, merging several runs into one stream.

Suggested fix: map 2, 3, 4 and 130 to permanent; retry only launch/read errors and crash-type exits (1, signal). Better: never retry once the worker has emitted output.

Tests: fake-launcher test for exit codes 2/3/4/130.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions