-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Handle claude code StopFailure hook #13784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9616017
0341b31
3f0c160
d69c046
b404f5f
b6bc584
d9e9254
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -548,6 +548,22 @@ fn map_cli_session_status( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| match status { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CLIAgentSessionStatus::InProgress => (AgentTaskState::InProgress, None), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CLIAgentSessionStatus::Success => (AgentTaskState::Succeeded, None), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CLIAgentSessionStatus::Failed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| error_type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // User-actionable errors (bad credentials, org restrictions, billing) map to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // FAILED. Everything else (rate limits, server errors, model errors, etc.) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // maps to ERROR since they are typically Anthropic's or Warp's fault. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // The list of error types on Claude Code comes from https://code.claude.com/docs/en/hooks#stopfailure-input | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let task_state = match error_type.as_deref() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Some("authentication_failed" | "oauth_org_not_allowed" | "billing_error") => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AgentTaskState::Failed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _ => AgentTaskState::Error, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+559
to
+564
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This list is intentional. The other error categories mean warp configured something incorrectly
Comment on lines
+559
to
+564
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is incorrect. Warp is responsible for setting the model and validating it before starting the worker |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (task_state, message.as_ref().map(TaskStatusUpdate::message)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CLIAgentSessionStatus::Blocked { message } => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AgentTaskState::Blocked, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message.as_ref().map(TaskStatusUpdate::message), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex doesn't have an equivalent hook. We add this runtime pattern match to fix this run not properly being marked as errored https://oz.staging.warp.dev/runs/019f6324-bb99-70fa-aa53-d200dd806dca