Skip to content

Port CLI resilience features from Paperclip#40

Merged
DorianZheng merged 1 commit intomainfrom
worktree-mossy-bubbling-stream
Mar 22, 2026
Merged

Port CLI resilience features from Paperclip#40
DorianZheng merged 1 commit intomainfrom
worktree-mossy-bubbling-stream

Conversation

@DorianZheng
Copy link
Copy Markdown
Collaborator

Summary

  • Add detection helpers for login errors, unknown session errors, and max-turns exhaustion in Claude CLI output
  • Parse system:init stream events to extract Claude's real session ID instead of relying on pre-generated UUIDs
  • Auto-retry CLI invocation with a fresh session when an unknown session error is detected (mirrors Paperclip's proven pattern)
  • Strip Claude nesting guard env vars (CLAUDECODE, CLAUDE_CODE_ENTRYPOINT, etc.) so the CLI doesn't detect it's running inside another Claude instance
  • Make --max-turns, --effort, and extra CLI args configurable per agent via schema, DB migrations, and agent store
  • Add renderTemplate() with {{dotted.path}} substitution for future prompt configurability

Test plan

  • 29 new tests covering detection functions, CLI flag generation, nesting guards, and template engine — all passing
  • make build passes across all packages
  • Pre-existing test failures in todos-api-validation.test.ts are unrelated

…tection, configurable flags, template engine

- Add detection helpers for login errors, unknown session errors, and max-turns exhaustion
- Parse system:init events to extract Claude's real session ID
- Auto-retry CLI invocation with fresh session when unknown session error detected
- Strip Claude nesting guard env vars to prevent nested-instance detection
- Make --max-turns, --effort, and extra CLI args configurable per agent (schema, DB, store)
- Add renderTemplate() with {{dotted.path}} substitution for future prompt configurability
- Add 29 tests covering all new detection functions, CLI flag generation, and template engine
@DorianZheng DorianZheng merged commit 66c6f3f into main Mar 22, 2026
1 check failed
@DorianZheng DorianZheng deleted the worktree-mossy-bubbling-stream branch March 22, 2026 10:18
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.

1 participant