Skip to content

fix(ai): name an exhausted usage limit first and do not retry it - #110

Merged
yohey-w merged 2 commits into
mainfrom
fix/ai-failure-headline
Dec 1, 2026
Merged

yohey-w merged 2 commits into
mainfrom
fix/ai-failure-headline

Conversation

@yohey-w

@yohey-w yohey-w commented Dec 1, 2026

Copy link
Copy Markdown
Owner

What

A sample run stopped with AI command failed: warning: Untrusted project-local configuration is disabled. .... The agent CLI's first stderr line was a benign warning; the real cause was near the end: ERROR: You've hit your usage limit. ... try again at <time>. The call was also retried once as a "transient transport error" because the long transcript happened to contain transport words, and failed again the same way.

Change

  • When the CLI's last own error line (error:, ERROR:, fatal:) says the usage limit or credit balance is exhausted (usage limit, purchase more credits, out of credits, insufficient credits), that line is put first in the AI command failed: message so the one-line stage summary names it; the full detail follows unchanged.
  • That failure is not auto-retried, neither by the transient-transport loop nor by the caller-side retries= loop.
  • Everything else is unchanged: other failures keep their message byte for byte; per-minute quotas and rate limits (429, quota exceeded for ... per minute) stay transient; earlier ERROR: lines the agent printed while working do not count.

Tests

  • New tests/test_ai_failure_headline.py (6 cases: headline and no retry for an exhausted usage limit, also with retries=2 and when it is already the first line; per-minute quota still retried; earlier log error lines do not block a transient retry; other failure messages unchanged). On main the usage-limit cases fail (the warning is the first line and the call is retried).
  • tests/test_ai_invoke*.py + the new file: 120 passed.
  • Full suite: the same environment failures as main here (real tsc/npm through the Windows toolchain); the three real_tsc tests that differ between the two runs fail identically on both when run alone.
  • One independent review round (5 blocking findings on a broader first version: exact-message tests, per-minute quotas, transcript log lines, first-line case, caller retries) addressed by narrowing.

🤖 Generated with Claude Code

https://claude.ai/code/session_014yyaLv8ZQ3GiQnmizx4cqb

yohey-w and others added 2 commits December 1, 2026 23:53
…d usage limit

A sample run stopped with "AI command failed: warning: Untrusted project-local
configuration is disabled. ...": the agent CLI's first stderr line was a
benign warning, and the real cause ("ERROR: You've hit your usage limit. ...
try again at <time>") sat near the end. The call was also retried as a
transient transport error because the long transcript contained transport
words.

- The failure message puts the CLI's last own error line ("error:", "ERROR:",
  "fatal:") first; the full detail follows unchanged.
- An error line saying the usage limit, quota or credits are exhausted makes
  the failure non-transient, so it is not auto-retried. Only the CLI's error
  lines count, not words anywhere in the transcript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yyaLv8ZQ3GiQnmizx4cqb
Review follow-up.

- Only an exhausted usage limit or credit balance ("usage limit", "purchase
  more credits", "out of credits", "insufficient credits") in the CLI's last
  own error line changes anything; per-minute quotas and rate limits stay
  transient, and earlier "ERROR:" lines the agent printed while working do not
  count.
- Only that case gets a headline; every other failure keeps its message
  byte for byte (existing exact-message tests are unchanged).
- The caller-side retry loop (`retries=`) no longer retries it either, and a
  usage line that is already the first line is recognised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yyaLv8ZQ3GiQnmizx4cqb
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

CoDD Audit

❌ Audit failed to run. Check workflow logs.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Coverage Matrix Report

Project: /home/runner/work/codd-dev/codd-dev
Mode: text-grep
Generated: 2026-12-01T15:35:54.078028Z

Lexicon Axis Status Hits
ai_governance_eu_act Classification rules for high-risk AI systems unknown 0
ai_governance_eu_act Prohibited AI practices unknown 0
ai_governance_eu_act Requirements for high-risk AI systems unknown 0
ai_governance_eu_act Human oversight unknown 0
ai_governance_eu_act Transparency obligations for providers and deployers of certain AI systems unknown 0
ai_governance_eu_act General-purpose AI models unknown 0
ai_governance_eu_act Conformity assessment unknown 0
ai_governance_eu_act Post-market monitoring by providers and post-market monitoring plan unknown 0
ai_governance_eu_act Fundamental rights impact assessment for high-risk AI systems unknown 0
ai_governance_eu_act Governance at Union and national level unknown 0
api_rate_limiting_caching rate_limit_strategy covered_text_match 1
api_rate_limiting_caching quota_management unknown 0
api_rate_limiting_caching throttling_response unknown 0
api_rate_limiting_caching cache_control_headers unknown 0
api_rate_limiting_caching etag_conditional_requests unknown 0
api_rate_limiting_caching cdn_edge_caching unknown 0
api_rate_limiting_caching idempotency_keys covered_text_match 1
api_rest_openapi openapi covered_text_match 25
api_rest_openapi info.version unknown 0
api_rest_openapi problem_details covered_text_match 150
api_rest_openapi query covered_text_match 17
api_rest_openapi security covered_text_match 14
api_rest_openapi schemas covered_text_match 57
api_rest_openapi content covered_text_match 95
api_rest_openapi responses covered_text_match 85
api_rest_openapi links unknown 0
api_rest_openapi idempotent covered_text_match 112
api_rest_openapi 429 unknown 0
api_rest_openapi Access-Control-Allow-Origin covered_text_match 8
api_rest_openapi Cache-Control unknown 0
api_rest_openapi parameters covered_text_match 195
api_rest_openapi callbacks unknown 0
babok stakeholder covered_text_match 2
babok goal covered_text_match 10
babok flow covered_text_match 46
babok issue covered_text_match 9
babok data covered_text_match 83
babok functional covered_text_match 21
babok non-functional covered_text_match 10
babok rule covered_text_match 15
babok constraint covered_text_match 35
babok acceptance covered_text_match 31
babok risk covered_text_match 74
babok assumption unknown 0
babok term covered_text_match 26
backend_event_cloudevents Context Attributes covered_text_match 1
backend_event_cloudevents REQUIRED Attributes covered_text_match 861
backend_event_cloudevents OPTIONAL Attributes covered_text_match 198
backend_event_cloudevents Type System covered_text_match 66
backend_event_cloudevents Extension Context Attributes unknown 0
backend_event_cloudevents Event Data covered_text_match 83
backend_event_cloudevents Protocol Binding unknown 0
backend_graphql schema covered_text_match 63
backend_graphql Type System covered_text_match 160
backend_graphql Type System Extensions unknown 0
backend_graphql query covered_text_match 54
backend_graphql mutation covered_text_match 28
backend_graphql subscription unknown 0
backend_graphql Fragments covered_text_match 1563
backend_graphql Variables covered_text_match 36
backend_graphql Directives covered_text_match 2
backend_graphql Introspection unknown 0
backend_graphql Response covered_text_match 93
backend_grpc_proto service covered_text_match 25
backend_grpc_proto message covered_text_match 73
backend_grpc_proto Scalar Value Types covered_text_match 38
backend_grpc_proto Enumerations covered_text_match 257
backend_grpc_proto stream covered_text_match 4
backend_grpc_proto status code covered_text_match 141
backend_grpc_proto Deadlines/Timeouts covered_text_match 2
backend_grpc_proto Metadata covered_text_match 16
compliance_hipaa Administrative safeguards unknown 0
compliance_hipaa Physical safeguards unknown 0
compliance_hipaa Technical safeguards covered_text_match 7
compliance_hipaa Risk analysis unknown 0
compliance_hipaa Access control unknown 0
compliance_hipaa Audit controls unknown 0
compliance_hipaa Integrity covered_text_match 7
compliance_hipaa Transmission security unknown 0
compliance_hipaa Breach notification unknown 0
compliance_hipaa Business associate contracts or other arrangements unknown 0
compliance_iso27001 context_organization unknown 0
compliance_iso27001 leadership unknown 0
compliance_iso27001 planning covered_text_match 3
compliance_iso27001 support covered_text_match 39
compliance_iso27001 operation covered_text_match 29
compliance_iso27001 performance_evaluation unknown 0
compliance_iso27001 improvement unknown 0
compliance_iso27001 risk_treatment_plan unknown 0
compliance_iso27001 SOA unknown 0
compliance_iso27001 access_control unknown 0
compliance_iso27001 cryptography unknown 0
compliance_iso27001 physical_security unknown 0
compliance_iso27001 supplier_relationships unknown 0
compliance_iso27001 incident_management unknown 0
compliance_pci_dss_4 Install and Maintain Network Security Controls unknown 0
compliance_pci_dss_4 Protect Stored Account Data unknown 0
compliance_pci_dss_4 Maintain a Vulnerability Management Program unknown 0
compliance_pci_dss_4 Restrict Access to System Components and Cardholder Data by Business Need to Know unknown 0
compliance_pci_dss_4 Regularly Monitor and Test Networks unknown 0
compliance_pci_dss_4 Support Information Security with Organizational Policies and Programs unknown 0
compliance_pci_dss_4 Protect Cardholder Data with Strong Cryptography During Transmission Over Open, Public Networks unknown 0
compliance_pci_dss_4 Develop and Maintain Secure Systems and Software unknown 0
compliance_pci_dss_4 Personnel screening unknown 0
compliance_pci_dss_4 Restrict Physical Access to Cardholder Data covered_text_match 3
compliance_pci_dss_4 Security incident response plan unknown 0
compliance_pci_dss_4 PCI DSS scope unknown 0
data_aggregation_policies collection_cardinality covered_text_match 3388
data_aggregation_policies test_data_variation unknown 0
data_aggregation_policies aggregation_function covered_text_match 117
data_aggregation_policies empty_partial_state covered_text_match 24
data_aggregation_policies grouping_dimension covered_text_match 11
data_aggregation_policies recency_selection covered_text_match 27
data_aggregation_policies source_traceability covered_text_match 174
data_eventsourcing_es_cqrs Event Sourcing unknown 0
data_eventsourcing_es_cqrs Event covered_text_match 25
data_eventsourcing_es_cqrs event store unknown 0
data_eventsourcing_es_cqrs Event Replay unknown 0
data_eventsourcing_es_cqrs Application State Storage covered_text_match 2
data_eventsourcing_es_cqrs Complete Rebuild unknown 0
data_eventsourcing_es_cqrs Temporal Query unknown 0
data_eventsourcing_es_cqrs CQRS pattern unknown 0
data_governance_appi_gdpr Lawfulness of processing unknown 0
data_governance_appi_gdpr Consent unknown 0
data_governance_appi_gdpr Purpose limitation unknown 0
data_governance_appi_gdpr Storage limitation unknown 0
data_governance_appi_gdpr Data subject rights unknown 0
data_governance_appi_gdpr Responsibility of the controller unknown 0
data_governance_appi_gdpr Processor unknown 0
data_governance_appi_gdpr Records of processing activities unknown 0
data_governance_appi_gdpr Data protection impact assessment unknown 0
data_governance_appi_gdpr Notification of a personal data breach unknown 0
data_governance_appi_gdpr Transfers of personal data to third countries or international organisations unknown 0
data_governance_appi_gdpr Data protection officer unknown 0
data_nosql_jsonschema JSON Schema Documents unknown 0
data_nosql_jsonschema Schema Vocabularies covered_text_match 7
data_nosql_jsonschema Meta-Schemas unknown 0
data_nosql_jsonschema Identifiers covered_text_match 3
data_nosql_jsonschema References covered_text_match 24
data_nosql_jsonschema Applicators covered_text_match 354
data_nosql_jsonschema Assertions covered_text_match 175
data_nosql_jsonschema Annotations covered_text_match 17
data_nosql_jsonschema Validation Keywords covered_text_match 52
data_nosql_jsonschema Format covered_text_match 31
data_relational_iso_sql schema definition covered_text_match 57
data_relational_iso_sql table definition unknown 0
data_relational_iso_sql data types covered_text_match 4
data_relational_iso_sql domain constraints covered_text_match 85
data_relational_iso_sql referential constraints covered_text_match 26
data_relational_iso_sql query expressions covered_text_match 222
data_relational_iso_sql data change statements covered_text_match 51
data_relational_iso_sql transaction statements covered_text_match 21
data_relational_iso_sql isolation levels unknown 0
data_relational_iso_sql views unknown 0
ddd_domain_driven_design ubiquitous_language unknown 0
ddd_domain_driven_design bounded_context unknown 0
ddd_domain_driven_design aggregate_design covered_text_match 7
ddd_domain_driven_design entity_value_object covered_text_match 2
ddd_domain_driven_design domain_events unknown 0
ddd_domain_driven_design repository_pattern covered_text_match 2
ddd_domain_driven_design application_service unknown 0
ddd_domain_driven_design context_mapping unknown 0
ddd_domain_driven_design anti_corruption_layer unknown 0
dora_sre_metrics deployment_frequency unknown 0
dora_sre_metrics lead_time_for_changes unknown 0
dora_sre_metrics change_failure_rate unknown 0
dora_sre_metrics mean_time_to_restore unknown 0
dora_sre_metrics slo_sli_definition unknown 0
dora_sre_metrics error_budget_policy unknown 0
dora_sre_metrics toil_reduction unknown 0
dora_sre_metrics incident_management unknown 0
i18n_unicode_cldr locale_tagging unknown 0
i18n_unicode_cldr character_encoding covered_text_match 6
i18n_unicode_cldr time_zone_handling covered_text_match 8
i18n_unicode_cldr number_currency_format unknown 0
i18n_unicode_cldr date_time_calendar unknown 0
i18n_unicode_cldr text_collation unknown 0
i18n_unicode_cldr rtl_bidi_support covered_text_match 9
i18n_unicode_cldr pluralization_rules covered_text_match 24
i18n_unicode_cldr translation_string_management covered_text_match 15
ml_model_cards model_details unknown 0
ml_model_cards intended_use unknown 0
ml_model_cards evaluation_factors covered_text_match 2
ml_model_cards performance_metrics covered_text_match 4
ml_model_cards training_data unknown 0
ml_model_cards ethical_considerations unknown 0
ml_model_cards caveats_recommendations covered_text_match 1
ml_model_cards model_versioning unknown 0
mobile_a11y_native touchscreens unknown 0
mobile_a11y_native small screen sizes unknown 0
mobile_a11y_native different input modalities unknown 0
mobile_a11y_native color contrast unknown 0
mobile_a11y_native larger text sizes unknown 0
mobile_a11y_native screen reader covered_text_match 1
mobile_a11y_native haptics unknown 0
mobile_a11y_native Reduce Motion unknown 0
mobile_android_material3 Color unknown 0
mobile_android_material3 Typography unknown 0
mobile_android_material3 Shape covered_text_match 3
mobile_android_material3 Elevation covered_text_match 1
mobile_android_material3 Motion covered_text_match 5
mobile_android_material3 Components covered_text_match 5
mobile_android_material3 Icons unknown 0
mobile_android_material3 Accessibility unknown 0
mobile_android_material3 Adaptive design covered_text_match 7
mobile_android_material3 Interaction covered_text_match 8
mobile_android_material3 Content design unknown 0
mobile_android_material3 Dynamic color unknown 0
mobile_ios_hig Navigation and search unknown 0
mobile_ios_hig Typography unknown 0
mobile_ios_hig Color unknown 0
mobile_ios_hig Accessibility unknown 0
mobile_ios_hig Playing haptics unknown 0
mobile_ios_hig Motion covered_text_match 3
mobile_ios_hig Inputs covered_text_match 3
mobile_ios_hig Layout covered_text_match 7
mobile_ios_hig Icons unknown 0
mobile_ios_hig Playing audio unknown 0
mobile_ios_hig Privacy unknown 0
mobile_ios_hig Feedback covered_text_match 9
mobile_security_masvs storage_security unknown 0
mobile_security_masvs crypto_best_practices unknown 0
mobile_security_masvs auth_session_management covered_text_match 17
mobile_security_masvs network_communication covered_text_match 14
mobile_security_masvs platform_interaction covered_text_match 1
mobile_security_masvs code_quality covered_text_match 47
mobile_security_masvs resilience covered_text_match 2
ops_cicd_pipeline declarative_config covered_text_match 19
ops_cicd_pipeline version_control unknown 0
ops_cicd_pipeline automated_apply covered_text_match 125
ops_cicd_pipeline continuous_reconciliation unknown 0
ops_cicd_pipeline drift_detection covered_text_match 8
ops_cicd_pipeline rollback unknown 0
ops_cicd_pipeline observability covered_text_match 1
ops_iac_terraform terraform covered_text_match 8
ops_iac_terraform provider covered_text_match 156
ops_iac_terraform resource covered_text_match 87
ops_iac_terraform data covered_text_match 86
ops_iac_terraform variable covered_text_match 301
ops_iac_terraform state covered_text_match 169
ops_iac_terraform module covered_text_match 378
ops_iac_terraform workspace covered_text_match 85
ops_iac_terraform backend covered_text_match 25
ops_iac_terraform Sentinel unknown 0
ops_kubernetes Workloads covered_text_match 31
ops_kubernetes Service covered_text_match 20
ops_kubernetes ConfigMap covered_text_match 85
ops_kubernetes PersistentVolume unknown 0
ops_kubernetes RBAC covered_text_match 40
ops_kubernetes Scheduling covered_text_match 1
ops_kubernetes ResourceQuota covered_text_match 6
ops_kubernetes Probe unknown 0
ops_kubernetes HorizontalPodAutoscaler covered_text_match 31
ops_kubernetes Events covered_text_match 30
ops_kubernetes Upgrade A Cluster unknown 0
ops_kubernetes Namespace covered_text_match 4
ops_observability_otel signals_traces covered_text_match 3
ops_observability_otel signals_metrics covered_text_match 19
ops_observability_otel signals_logs covered_text_match 1
ops_observability_otel context_propagation covered_text_match 13
ops_observability_otel resource_attributes covered_text_match 26
ops_observability_otel instrumentation covered_text_match 71
ops_observability_otel collector covered_text_match 2
ops_observability_otel semantic_conventions unknown 0
process_iso25010 functional_suitability unknown 0
process_iso25010 performance_efficiency unknown 0
process_iso25010 compatibility covered_text_match 5
process_iso25010 usability unknown 0
process_iso25010 reliability covered_text_match 6
process_iso25010 security covered_text_match 17
process_iso25010 maintainability unknown 0
process_iso25010 portability unknown 0
process_test_iso29119 test_concepts_definitions unknown 0
process_test_iso29119 test_processes unknown 0
process_test_iso29119 test_documentation unknown 0
process_test_iso29119 test_techniques unknown 0
process_test_iso29119 keyword_driven_testing unknown 0
process_test_iso29119 work_aided_software_testing unknown 0
twelve_factor_app codebase covered_text_match 12
twelve_factor_app dependencies covered_text_match 47
twelve_factor_app config covered_text_match 153
twelve_factor_app backing_services unknown 0
twelve_factor_app build_release_run covered_text_match 277
twelve_factor_app processes covered_text_match 2
twelve_factor_app port_binding unknown 0
twelve_factor_app concurrency covered_text_match 1
twelve_factor_app disposability unknown 0
twelve_factor_app dev_prod_parity unknown 0
twelve_factor_app logs covered_text_match 1
twelve_factor_app admin_processes unknown 0
web_a11y_wcag22_aa 1.1 Text Alternatives unknown 0
web_a11y_wcag22_aa 1.2 Time-based Media unknown 0
web_a11y_wcag22_aa 1.3 Adaptable unknown 0
web_a11y_wcag22_aa 1.4 Distinguishable unknown 0
web_a11y_wcag22_aa 2.1 Keyboard Accessible unknown 0
web_a11y_wcag22_aa 2.2 Enough Time unknown 0
web_a11y_wcag22_aa 2.3 Seizures and Physical Reactions unknown 0
web_a11y_wcag22_aa 2.4 Navigable unknown 0
web_a11y_wcag22_aa 2.5 Input Modalities unknown 0
web_a11y_wcag22_aa 3.1 Readable unknown 0
web_a11y_wcag22_aa 3.2 Predictable unknown 0
web_a11y_wcag22_aa 3.3 Input Assistance unknown 0
web_a11y_wcag22_aa 4.1 Compatible unknown 0
web_authn_webauthn registration ceremony unknown 0
web_authn_webauthn authentication ceremony covered_text_match 5
web_authn_webauthn attestation unknown 0
web_authn_webauthn user verification covered_text_match 34
web_authn_webauthn credential management unknown 0
web_authn_webauthn extensions covered_text_match 5
web_browser_compat Newly available unknown 0
web_browser_compat Widely available unknown 0
web_browser_compat Limited availability unknown 0
web_browser_compat core browser set unknown 0
web_browser_compat Baseline threshold unknown 0
web_browser_compat polyfill covered_text_match 2
web_browser_compat progressive enhancement covered_text_match 20
web_forms_html5 input element covered_text_match 160
web_forms_html5 form element covered_text_match 348
web_forms_html5 client-side form validation covered_text_match 237
web_forms_html5 autocomplete covered_text_match 1551
web_forms_html5 label element covered_text_match 284
web_forms_html5 fieldset unknown 0
web_forms_html5 inputmode covered_text_match 14
web_forms_html5 form submission covered_text_match 14
web_forms_html5 File Upload state covered_text_match 241
web_performance_core_web_vitals Largest Contentful Paint (LCP) unknown 0
web_performance_core_web_vitals Interaction to Next Paint (INP) covered_text_match 8
web_performance_core_web_vitals Cumulative Layout Shift (CLS) unknown 0
web_performance_core_web_vitals Time to First Byte (TTFB) unknown 0
web_performance_core_web_vitals First Contentful Paint (FCP) covered_text_match 32
web_performance_core_web_vitals Time to Interactive (TTI) unknown 0
web_pwa_manifest manifest members covered_text_match 259
web_pwa_manifest icons covered_text_match 123
web_pwa_manifest display covered_text_match 104
web_pwa_manifest start_url covered_text_match 650
web_pwa_manifest scope covered_text_match 22
web_pwa_manifest theme_color covered_text_match 17
web_pwa_manifest shortcuts covered_text_match 30
web_pwa_manifest share_target covered_text_match 153
web_responsive width unknown 0
web_responsive orientation unknown 0
web_responsive prefers-color-scheme covered_text_match 11
web_responsive prefers-reduced-motion covered_text_match 2
web_responsive resolution covered_text_match 10
web_responsive hover covered_text_match 14
web_responsive pointer covered_text_match 23
web_responsive aspect-ratio unknown 0
web_security_owasp broken_access_control unknown 0
web_security_owasp cryptographic_failures unknown 0
web_security_owasp injection covered_text_match 2
web_security_owasp insecure_design unknown 0
web_security_owasp security_misconfiguration unknown 0
web_security_owasp vulnerable_and_outdated_components unknown 0
web_security_owasp identification_and_authentication_failures unknown 0
web_security_owasp software_and_data_integrity_failures unknown 0
web_security_owasp security_logging_and_monitoring_failures unknown 0
web_security_owasp server_side_request_forgery_ssrf unknown 0
web_security_owasp authentication covered_text_match 5
web_security_owasp session_management unknown 0
web_security_owasp input_validation unknown 0
web_security_owasp output_encoding_and_injection_prevention unknown 0
web_seo_schemaorg Organization covered_text_match 12
web_seo_schemaorg Person covered_text_match 8
web_seo_schemaorg Product covered_text_match 7
web_seo_schemaorg Article covered_text_match 43
web_seo_schemaorg BreadcrumbList unknown 0
web_seo_schemaorg FAQPage covered_text_match 19
web_seo_schemaorg Event covered_text_match 25
web_seo_schemaorg VideoObject unknown 0

Totals: 369 axes, 176 covered signals (47.70%), 193 unknown.

@yohey-w
yohey-w merged commit e1775ed into main Dec 1, 2026
5 checks passed
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