Skip to content

CodingAgent step: dispatch to Claude Code unreliable, needs error handling and retry #367

Closed

Description

@joelteply

Problem

The sentinel/coding-agent step dispatches to Claude Code via the Agent SDK. It exists but is unreliable — needs proper error handling, timeout management, output parsing, and retry logic.

Current Implementation

  • Rust dispatches to TypeScript sentinel/coding-agent via execute_ts_json
  • TypeScript wraps Claude Code via Agent SDK
  • ClaudeCodeProvider strips ANTHROPIC_API_KEY by default (uses OAuth from claude login)
  • captureTraining=true captures user→assistant pairs for training data

What Needs to Work

  1. Reliable dispatch — handle Claude Code crashes, timeouts, rate limits
  2. Output parsing — extract code changes, test results, commit hashes from Claude Code output
  3. Retry on failure — if Claude Code fails, retry with better context (error message included)
  4. Budget management — extendBudget for long tasks, don't let it die mid-fix
  5. Structured results — not just "it ran" but "here's what changed, here's the test result"

Acceptance Criteria

# This should work end-to-end:
./jtag sentinel/coding-agent --task="Add a function fibonacci(n) to src/utils/math.ts that returns the nth fibonacci number" --verify=true

# Expected: writes code, runs tests, returns structured result with file paths and test output

Related

Activity

  1. joelteply commented on Mar 25, 2026

    @joelteply
    ContributorAuthor

    Tested e2e — sentinel/coding-agent works reliably:

    1. File creation: --prompt="Create a file /tmp/test.txt" → success, structured tool call result
    2. Error handling: Nonexistent file read → Claude Code handles gracefully, reports error
    3. Workspace bootstrap: 3 strategies (project worktree, persona workspace, sandbox) all implemented
    4. Training capture: Interactions captured for LoRA pipeline
    5. Progress events: Emitted via sentinel handle

    The implementation in ClaudeCodeProvider.ts handles SDK quirks (non-zero exit after success, PATH resolution in daemon contexts, permission mode mapping).

    Remaining edge cases that may warrant follow-up:

    • No retry logic on rate limits (could add exponential backoff)
    • extendBudget not implemented (SDK may not support it yet)
    • No timeout — relies on SDK's maxTurns/maxBudgetUsd

    Closing as working. The persona-level tool calling issues that blocked this (#368, #371) are now fixed.

  2. added 2 commits that reference this issue on Mar 25, 2026
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