orbi-cli 0.7.50__tar.gz → 0.7.52__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/PKG-INFO +1 -1
  2. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/pyproject.toml +1 -1
  3. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/__init__.py +1 -1
  4. orbi_cli-0.7.52/src/orbi/delivery_push.py +168 -0
  5. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/draft.py +129 -34
  6. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/failure.py +22 -21
  7. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/failure_report.py +67 -21
  8. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/gitops.py +16 -19
  9. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/journal.py +4 -1
  10. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/language_failure.py +41 -0
  11. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_process.py +21 -23
  12. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pr_head_sync.py +71 -16
  13. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pr_verification.py +6 -3
  14. orbi_cli-0.7.52/src/orbi/provider_balance.py +107 -0
  15. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/runner.py +19 -35
  16. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/suggest.py +52 -55
  17. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi_cli.egg-info/PKG-INFO +1 -1
  18. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi_cli.egg-info/SOURCES.txt +4 -0
  19. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_delivery.py +62 -13
  20. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_pi.py +80 -1
  21. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_draft.py +34 -1
  22. orbi_cli-0.7.52/tests/test_draft_repo_view.py +241 -0
  23. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_failure.py +173 -3
  24. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_failure_report.py +59 -2
  25. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_fix_needed_loop.py +33 -1
  26. orbi_cli-0.7.52/tests/test_git_base_smoke.py +793 -0
  27. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_gitops_fakes.py +42 -13
  28. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_resume_pr.py +23 -17
  29. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_suggest.py +3 -0
  30. orbi_cli-0.7.52/tests/test_suggest_repo_view.py +181 -0
  31. orbi_cli-0.7.50/tests/test_git_base_smoke.py +0 -398
  32. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/LICENSE +0 -0
  33. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/README.md +0 -0
  34. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/docs/licenses/sustainable-use-license.md +0 -0
  35. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/setup.cfg +0 -0
  36. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/acceptance_section.py +0 -0
  37. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/amend_command.py +0 -0
  38. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/answer.py +0 -0
  39. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/base_ci_fix.py +0 -0
  40. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/base_ci_red.py +0 -0
  41. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/blocked_comment.py +0 -0
  42. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/blocked_record.py +0 -0
  43. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/blocked_scan.py +0 -0
  44. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/body_steering.py +0 -0
  45. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/branch_reclaim.py +0 -0
  46. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/check_permission.py +0 -0
  47. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/checks.py +0 -0
  48. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/claim.py +0 -0
  49. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/clarify.py +0 -0
  50. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/clarify_proposal.py +0 -0
  51. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/clarify_stop.py +0 -0
  52. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/cli.py +0 -0
  53. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/cli_commands.py +0 -0
  54. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/cli_doctor.py +0 -0
  55. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/cli_parser.py +0 -0
  56. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/cli_source.py +0 -0
  57. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/cli_status.py +0 -0
  58. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/cli_ticket_command.py +0 -0
  59. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/command_line.py +0 -0
  60. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/comment_kind.py +0 -0
  61. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/comment_rest_id.py +0 -0
  62. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/comment_trust.py +0 -0
  63. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/config.py +0 -0
  64. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/config_hint.py +0 -0
  65. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/delivery_comment.py +0 -0
  66. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/delivery_labels.py +0 -0
  67. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/delivery_scene.py +0 -0
  68. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/draft_cli.py +0 -0
  69. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/draft_document.py +0 -0
  70. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/draft_marker.py +0 -0
  71. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/engine_source.py +0 -0
  72. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/example_config.toml +0 -0
  73. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/extensions/clarify_verdict.ts +0 -0
  74. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/extensions/draft_tools.ts +0 -0
  75. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/failure_evidence.py +0 -0
  76. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/gh_response.py +0 -0
  77. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/git_identity.py +0 -0
  78. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/git_transport.py +0 -0
  79. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/github.py +0 -0
  80. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/github_feedback.py +0 -0
  81. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/human_review.py +0 -0
  82. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/implementation_delivery.py +0 -0
  83. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/language.py +0 -0
  84. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/language_terms.py +0 -0
  85. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/language_terms_criteria.py +0 -0
  86. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/language_terms_fix.py +0 -0
  87. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/launchd_deploy.py +0 -0
  88. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/merge_blocked.py +0 -0
  89. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/merge_exec.py +0 -0
  90. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/merge_gate.py +0 -0
  91. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/merge_handoff.py +0 -0
  92. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/milestone.py +0 -0
  93. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/milestone_command.py +0 -0
  94. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/milestone_errors.py +0 -0
  95. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/notify.py +0 -0
  96. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/ops_delivery.py +0 -0
  97. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_activity.py +0 -0
  98. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_command.py +0 -0
  99. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_exec.py +0 -0
  100. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_idle.py +0 -0
  101. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_recovery.py +0 -0
  102. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_session.py +0 -0
  103. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pi_stream_log.py +0 -0
  104. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pilot_setup.py +0 -0
  105. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/pilot_slots.py +0 -0
  106. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/progress.py +0 -0
  107. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/progress_display.py +0 -0
  108. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/progress_outcome.py +0 -0
  109. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/progress_summary.py +0 -0
  110. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/question.py +0 -0
  111. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/release.py +0 -0
  112. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/release_closeout.py +0 -0
  113. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/release_comments.py +0 -0
  114. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/release_declaration.py +0 -0
  115. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/release_git.py +0 -0
  116. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/release_notes.py +0 -0
  117. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/release_run.py +0 -0
  118. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/repo_config.py +0 -0
  119. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/requeue.py +0 -0
  120. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/restart_scan.py +0 -0
  121. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/resume_scan.py +0 -0
  122. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/resume_verification.py +0 -0
  123. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/review_merge.py +0 -0
  124. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/review_rounds.py +0 -0
  125. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/review_verdict.py +0 -0
  126. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/run_fields.py +0 -0
  127. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/run_state.py +0 -0
  128. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/runner_health.py +0 -0
  129. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/runner_marker.py +0 -0
  130. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/runner_source.py +0 -0
  131. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/scene.py +0 -0
  132. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/scheduler.py +0 -0
  133. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/scheduler_units.py +0 -0
  134. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/session_command.py +0 -0
  135. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/setup_checks.py +0 -0
  136. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/setup_config.py +0 -0
  137. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/source_pool.py +0 -0
  138. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/split_apply.py +0 -0
  139. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/split_command.py +0 -0
  140. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/status_observe.py +0 -0
  141. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/steering.py +0 -0
  142. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/stopped_scans.py +0 -0
  143. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/systemd_deploy.py +0 -0
  144. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/terminal_stops.py +0 -0
  145. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/tick_reads.py +0 -0
  146. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/ticket_command.py +0 -0
  147. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/ticket_command_registry.py +0 -0
  148. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/ticket_criteria.py +0 -0
  149. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/user_summary.py +0 -0
  150. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi/worktree_retention.py +0 -0
  151. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi_cli.egg-info/dependency_links.txt +0 -0
  152. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi_cli.egg-info/entry_points.txt +0 -0
  153. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/src/orbi_cli.egg-info/top_level.txt +0 -0
  154. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_agents_md.py +0 -0
  155. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_amend_command.py +0 -0
  156. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_answer.py +0 -0
  157. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_apply_label_patch.py +0 -0
  158. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_base_branch_failure.py +0 -0
  159. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_base_ci_red.py +0 -0
  160. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_blocked_comment.py +0 -0
  161. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_body_steering.py +0 -0
  162. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_adapters.py +0 -0
  163. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_preflight.py +0 -0
  164. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_release.py +0 -0
  165. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_claim_resume.py +0 -0
  166. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_failure_report.py +0 -0
  167. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_main.py +0 -0
  168. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_milestone.py +0 -0
  169. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_outcome.py +0 -0
  170. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_prompt.py +0 -0
  171. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_reconcile.py +0 -0
  172. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_session.py +0 -0
  173. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_bootstrap_runner_tickets.py +0 -0
  174. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_branch_reclaim.py +0 -0
  175. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_check_permission.py +0 -0
  176. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_ci_failure_issue_workflow.py +0 -0
  177. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_ci_failure_triage.py +0 -0
  178. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_ci_macos_workflow.py +0 -0
  179. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_ci_workflow.py +0 -0
  180. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_clarify.py +0 -0
  181. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_claude_plugin.py +0 -0
  182. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_cli_golden.py +0 -0
  183. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_cli_install.py +0 -0
  184. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_cli_milestone.py +0 -0
  185. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_cli_packaging.py +0 -0
  186. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_cli_source.py +0 -0
  187. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_cli_ticket_commands.py +0 -0
  188. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_command_receipt_contract.py +0 -0
  189. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_comment_identity.py +0 -0
  190. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_comment_readers_contract.py +0 -0
  191. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_comment_rest_id.py +0 -0
  192. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_comment_trust.py +0 -0
  193. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_concurrency_e2e.py +0 -0
  194. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_constitution.py +0 -0
  195. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_coverage_gate.py +0 -0
  196. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_deliver_pr_fakes.py +0 -0
  197. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_delivery_branch_delete.py +0 -0
  198. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_delivery_labels.py +0 -0
  199. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_delivery_scene.py +0 -0
  200. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docker_docs.py +0 -0
  201. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docker_entrypoint.py +0 -0
  202. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docker_image_workflow.py +0 -0
  203. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_i18n.py +0 -0
  204. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_issue_shapes.py +0 -0
  205. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_labels.py +0 -0
  206. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_mermaid.py +0 -0
  207. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_releases.py +0 -0
  208. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_safety_matrix.py +0 -0
  209. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_single_source.py +0 -0
  210. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_docs_site.py +0 -0
  211. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_engine_source.py +0 -0
  212. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_gh_read_retry.py +0 -0
  213. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_gh_response.py +0 -0
  214. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_git_merge_smoke.py +0 -0
  215. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_git_network_retry.py +0 -0
  216. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_git_transport.py +0 -0
  217. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_github.py +0 -0
  218. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_github_fakes.py +0 -0
  219. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_gitops.py +0 -0
  220. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_human_review.py +0 -0
  221. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_import_graph.py +0 -0
  222. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_install_sh.py +0 -0
  223. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_issue_1367.py +0 -0
  224. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_issue_461.py +0 -0
  225. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_issue_template_config.py +0 -0
  226. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_journal.py +0 -0
  227. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_journal_events.py +0 -0
  228. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_launchd_deploy.py +0 -0
  229. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_license.py +0 -0
  230. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_merge_exec_extraction.py +0 -0
  231. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_message_language.py +0 -0
  232. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_milestone_command.py +0 -0
  233. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_notify.py +0 -0
  234. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_ops_e2e.py +0 -0
  235. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_orbi.py +0 -0
  236. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_orbi_dashboard.py +0 -0
  237. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_orbi_exporter.py +0 -0
  238. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_patch_ratchet.py +0 -0
  239. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_activity.py +0 -0
  240. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_child_reap.py +0 -0
  241. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_command.py +0 -0
  242. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_exec.py +0 -0
  243. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_extensions.py +0 -0
  244. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_provider_templates.py +0 -0
  245. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_recovery.py +0 -0
  246. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pi_session.py +0 -0
  247. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pilot_setup.py +0 -0
  248. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pilot_slots.py +0 -0
  249. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pr_issue_link_workflow.py +0 -0
  250. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_pr_verification.py +0 -0
  251. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_prerequisite_check.py +0 -0
  252. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_progress.py +0 -0
  253. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_progress_wiring.py +0 -0
  254. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_prompt_contract.py +0 -0
  255. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_public_contracts.py +0 -0
  256. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_public_helpers.py +0 -0
  257. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_publish_workflow.py +0 -0
  258. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_question.py +0 -0
  259. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_question_resume.py +0 -0
  260. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_release_docs_workflow.py +0 -0
  261. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_release_extraction.py +0 -0
  262. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_release_ticket_templates.py +0 -0
  263. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_repo_config.py +0 -0
  264. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_resume_continue_e2e.py +0 -0
  265. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_resume_e2e.py +0 -0
  266. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_review_merge.py +0 -0
  267. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_review_verdict.py +0 -0
  268. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_run_artifacts.py +0 -0
  269. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_run_fields.py +0 -0
  270. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_run_id_e2e.py +0 -0
  271. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_run_id_fixture.py +0 -0
  272. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_runner_config.py +0 -0
  273. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_runner_health.py +0 -0
  274. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_runner_source_freshness.py +0 -0
  275. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_scene.py +0 -0
  276. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_scheduler.py +0 -0
  277. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_seam.py +0 -0
  278. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_setup_output_golden.py +0 -0
  279. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_size_ratchet.py +0 -0
  280. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_split_command.py +0 -0
  281. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_src_layout.py +0 -0
  282. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_status_observe.py +0 -0
  283. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_steering_review.py +0 -0
  284. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_suite_hygiene.py +0 -0
  285. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_systemd_deploy.py +0 -0
  286. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_systemd_timer.py +0 -0
  287. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_tick_reads.py +0 -0
  288. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_ticket_command.py +0 -0
  289. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_ticket_command_registration.py +0 -0
  290. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_user_acceptance_contract.py +0 -0
  291. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_user_summary.py +0 -0
  292. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_versioned_comment_block.py +0 -0
  293. {orbi_cli-0.7.50 → orbi_cli-0.7.52}/tests/test_worktree_reclaim.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orbi-cli
3
- Version: 0.7.50
3
+ Version: 0.7.52
4
4
  Summary: Orbi — local AI development worker: claims GitHub Issues, runs Pi in isolated worktrees, and delivers PRs (GitHub Issues + labels are the only state store).
5
5
  Author: xqliu
6
6
  License-Expression: AGPL-3.0-only OR LicenseRef-Sustainable-Use-1.0
@@ -44,7 +44,7 @@ build-backend = "setuptools.build_meta"
44
44
 
45
45
  [project]
46
46
  name = "orbi-cli"
47
- version = "0.7.50"
47
+ version = "0.7.52"
48
48
  description = "Orbi — local AI development worker: claims GitHub Issues, runs Pi in isolated worktrees, and delivers PRs (GitHub Issues + labels are the only state store)."
49
49
  readme = "README.md"
50
50
  requires-python = ">=3.14"
@@ -18,4 +18,4 @@ the package would shadow the installed package for every process with
18
18
  the checkout root on sys.path. The direct-execution compatibility entry
19
19
  is `python3 -m orbi.cli` (development path only).
20
20
  """
21
- __version__ = "0.7.50"
21
+ __version__ = "0.7.52"
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env python3
2
+ """Make the delivery branch pushable, then push it (Issues #186, #2273).
3
+
4
+ The closeout's push (`deliver_pr`, step 3) is a plain push and nothing else:
5
+ no force push, no reset, no rewrite. Two things outside the worktree can make
6
+ that push a non-fast-forward, and both are absorbed HERE, right before it:
7
+
8
+ - the BASE advanced while the agent worked — a plain `git merge` of
9
+ `origin/<base>` (the pre-#186 agent contract, now the Runner's), and
10
+ - the DELIVERY BRANCH itself already carries pushed commits the worktree does
11
+ not hold (Issue #2273): a steering correction restarts the running session
12
+ in the same run, a branch was advanced on GitHub (the PR page's "Update
13
+ branch"), an earlier run of the same Issue pushed. Without the absorb that
14
+ push was rejected —
15
+
16
+ ! [rejected] HEAD -> orbi/<owner>-<repo>-issue-<n> (fetch first)
17
+
18
+ — and the delivery ended `ai-blocked` with nothing but Git's "Note about
19
+ fast-forwards" hint on the Issue.
20
+
21
+ `absorb_pushed_commits` fast-forwards onto those commits (or merges them when
22
+ the two sides diverged, keeping both). A file conflict rolls the merge back
23
+ and stops with `DeliveryBranchChangedError`, as does a push rejection the
24
+ absorb could not prevent; the failure report renders that failure's plain
25
+ cause and next step (`orbi.failure_report`), so the reader never has to read
26
+ Git's hint to know what happened.
27
+
28
+ This module imports no `runner` (CONSTITUTION Article 3.3) and calls no
29
+ `subprocess` directly (Article 3.4): every git command goes through the one
30
+ seam in `orbi.journal`.
31
+ """
32
+ from __future__ import annotations
33
+
34
+ import logging
35
+ import subprocess
36
+ from pathlib import Path
37
+
38
+ from orbi import gitops, run_state
39
+ from orbi.gitops import fetch_base_ref
40
+ from orbi.journal import event, run_command, run_git_network_command
41
+ from orbi.pr_head_sync import DeliveryBranchChangedError, fetch_delivery_branch
42
+
43
+ # Markers Git prints when a push is rejected because the remote ref moved
44
+ # (`! [rejected] ... (fetch first)`, `non-fast-forward`). They only tell that
45
+ # rejection apart from every other push failure; the reader-facing cause never
46
+ # repeats Git's hint text (Issue #2273).
47
+ _PUSH_REJECTED_MARKERS = (
48
+ "[rejected]", "fetch first", "non-fast-forward", "updates were rejected",
49
+ )
50
+
51
+
52
+ def absorb_advanced_base(worktree: Path, base_branch: str, branch: str,
53
+ *, repo_dir: Path) -> None:
54
+ """Absorb an advanced base into the task branch before the push.
55
+
56
+ The fetch updates the shared remote-tracking ref, so it runs under the
57
+ base-sync lock with the deployment checkout as the lock location. A
58
+ lock timeout or a fetch error fails fast — no retry, no lock bypass.
59
+
60
+ The base advanced while the agent worked: absorb it with a plain merge
61
+ (the same base update the old agent prompt required). A conflict is
62
+ rolled back: the worktree returns to the agent's exact commit boundary,
63
+ the PR opens on the agent's head, and the existing review loop
64
+ (ai-fix-needed -> the review session absorbs the base in-session)
65
+ handles the rest — the state machine is unchanged.
66
+ """
67
+ fetch_base_ref(repo_dir, base_branch, cwd=worktree)
68
+ freshness = run_state.assess_base_freshness(
69
+ worktree, base_branch, head="HEAD",
70
+ )
71
+ if freshness is run_state.BaseFreshness.FRESH:
72
+ return
73
+ try:
74
+ run_command(
75
+ ["git", "merge", f"origin/{base_branch}"], cwd=worktree,
76
+ )
77
+ event("base_absorbed", base_branch=base_branch, branch=branch)
78
+ except subprocess.CalledProcessError as exc:
79
+ run_command(["git", "merge", "--abort"], cwd=worktree)
80
+ event(
81
+ "base_merge_conflict", level=logging.ERROR,
82
+ base_branch=base_branch, branch=branch,
83
+ returncode=exc.returncode,
84
+ stderr=(exc.stderr or "").strip(),
85
+ )
86
+
87
+
88
+ def absorb_pushed_commits(worktree: Path, branch: str, *,
89
+ repo_dir: Path) -> None:
90
+ """Make the local delivery branch carry what `origin/<branch>` has.
91
+
92
+ Called by the closeout before its plain push. `repo_dir` is the
93
+ deployment checkout that owns the shared base-sync lock the fetch needs.
94
+ An unpushed branch (the first delivery's push) and a local head that
95
+ already contains the remote head (the PR's own earlier push, a killed
96
+ session's unpushed commit) need no network read beyond the remote-head
97
+ probe.
98
+ """
99
+ remote = gitops.remote_branch_head(branch, cwd=worktree)
100
+ if remote is None or remote == run_command(
101
+ ["git", "rev-parse", "HEAD"], cwd=worktree):
102
+ # Never pushed yet, or the local head IS the pushed head.
103
+ return
104
+ fetch_delivery_branch(repo_dir, branch, cwd=worktree)
105
+ if gitops.is_ancestor(remote, "HEAD", cwd=worktree):
106
+ # The local head already contains the pushed commits: a killed
107
+ # session's unpushed commit is the ahead side, which the push
108
+ # below carries as usual.
109
+ return
110
+ local_head = run_command(["git", "rev-parse", "HEAD"], cwd=worktree)
111
+ try:
112
+ # A plain merge: a fast-forward when the local branch is behind,
113
+ # a merge commit (both sides kept) when it diverged. Never
114
+ # `--force`, never a reset.
115
+ run_command(["git", "merge", f"origin/{branch}"], cwd=worktree)
116
+ except subprocess.CalledProcessError as exc:
117
+ run_command(["git", "merge", "--abort"], cwd=worktree)
118
+ event(
119
+ "delivery_branch_merge_conflict", level=logging.ERROR,
120
+ branch=branch, local_head=local_head, remote_head=remote,
121
+ # Git reports a merge conflict on stdout and a push rejection
122
+ # on stderr: the event carries whichever spoke.
123
+ output=((exc.stderr or "") + (exc.stdout or "")).strip(),
124
+ )
125
+ raise DeliveryBranchChangedError(
126
+ f"the delivery branch {branch} changed on GitHub and its "
127
+ f"changes conflict with this session's work; the merge was "
128
+ f"rolled back and the local head {local_head} is unchanged",
129
+ branch=branch, stderr=exc.stderr,
130
+ ) from exc
131
+ event(
132
+ "delivery_branch_synced", branch=branch, previous_head=local_head,
133
+ remote_head=remote,
134
+ )
135
+
136
+
137
+ def push_delivery_branch(worktree: Path, branch: str) -> None:
138
+ """Push the task branch; a rejection names the outside change it is.
139
+
140
+ The closeout's ONE push (never a force push). The absorbs above already
141
+ brought the remote commits in, so a rejection here means the branch
142
+ moved again in the seconds between the fetch and this push, or a
143
+ repository rule refused it — both are outside the run's control.
144
+ """
145
+ try:
146
+ run_git_network_command(
147
+ ["git", "push", "origin", f"HEAD:{branch}"], cwd=worktree,
148
+ )
149
+ except subprocess.CalledProcessError as exc:
150
+ if not _push_was_rejected(exc):
151
+ raise
152
+ event(
153
+ "delivery_branch_push_rejected", level=logging.ERROR,
154
+ branch=branch, returncode=exc.returncode,
155
+ output=((exc.stderr or "") + (exc.stdout or "")).strip(),
156
+ )
157
+ raise DeliveryBranchChangedError(
158
+ f"the delivery branch {branch} changed on GitHub while this "
159
+ "session ran, so the plain push was rejected: the branch "
160
+ "carries a commit this worktree does not",
161
+ branch=branch, stderr=exc.stderr,
162
+ ) from exc
163
+
164
+
165
+ def _push_was_rejected(exc: subprocess.CalledProcessError) -> bool:
166
+ """Whether a `git push` was rejected by an advanced remote ref."""
167
+ stderr = (exc.stderr or "").lower()
168
+ return any(marker in stderr for marker in _PUSH_REJECTED_MARKERS)
@@ -31,9 +31,13 @@ import json
31
31
  import logging
32
32
  import re
33
33
  import subprocess
34
+ from contextlib import contextmanager
34
35
  from pathlib import Path
35
36
 
36
- from orbi import clarify, draft_marker, journal, split_command
37
+ from orbi import (
38
+ clarify, draft_marker, failure, gitops, journal, provider_balance,
39
+ split_command,
40
+ )
37
41
  from orbi.acceptance_section import appended_body, write_body
38
42
  from orbi.claim import _repo_scan_keys
39
43
  from orbi.config import RunnerConfig
@@ -58,8 +62,9 @@ from orbi.draft_document import (
58
62
  taken_message,
59
63
  taken_options,
60
64
  )
65
+ from orbi.failure import failure_detail
61
66
  from orbi.github import edit_issue, issue_view, list_issues, list_milestones
62
- from orbi.journal import event
67
+ from orbi.journal import LOGGER, event, run_command
63
68
  from orbi.pi_command import (
64
69
  IMPLEMENT_EXCLUDED_SKILLS,
65
70
  ROLE_SUGGEST,
@@ -209,6 +214,90 @@ def _round_payload(payload: dict) -> dict:
209
214
  return payload
210
215
 
211
216
 
217
+ DRAFT_VIEW_DIRNAME = "draft-view"
218
+
219
+
220
+ def draft_view_path(repo_dir: Path, run_id: str) -> Path:
221
+ """Where one draft's view of `origin/<base>` lives.
222
+
223
+ Inside the checkout's gitignored `.orbi/` run dirs, so the deployment
224
+ checkout's working tree is never moved (Issue #2276) and no delivery
225
+ worktree ever sees a file it would call dirty.
226
+ """
227
+ return Path(repo_dir) / ".orbi" / DRAFT_VIEW_DIRNAME / run_id
228
+
229
+
230
+ def add_draft_view(repo_dir: Path, base_branch: str, run_id: str) -> Path:
231
+ """Fetch `origin/<base>` under the base-sync lock, then check it out.
232
+
233
+ The detached worktree of the fetched commit IS the drafting session's
234
+ repository view: a delivery never advances the checkout, so its working
235
+ tree can be arbitrarily old. `--detach` keeps the view off every branch,
236
+ so a draft can neither move the checkout nor touch a delivery's
237
+ worktree, and only the fetch writes shared state (the one remote-tracking
238
+ ref the lock guards). `--force` re-creates over the `prunable` entry a
239
+ killed draft left at the same path.
240
+ """
241
+ gitops.fetch_base_ref(repo_dir, base_branch)
242
+ path = draft_view_path(repo_dir, run_id)
243
+ run_command(
244
+ ["git", "worktree", "add", "--detach", "--force", str(path),
245
+ f"origin/{base_branch}"],
246
+ cwd=repo_dir,
247
+ )
248
+ return path
249
+
250
+
251
+ def remove_draft_view(repo_dir: Path, path: Path) -> None:
252
+ """Remove a draft's view; a view already gone is nothing to remove.
253
+
254
+ No `git worktree prune` here: the next view is created with
255
+ `--force`, which re-creates over the `prunable` registration a killed
256
+ draft left behind, while a prune would touch the one `worktrees/`
257
+ registry a delivery running at the same time is writing to.
258
+ """
259
+ if not Path(path).is_dir():
260
+ return
261
+ run_command(
262
+ ["git", "worktree", "remove", "--force", str(path)], cwd=repo_dir,
263
+ )
264
+
265
+
266
+ @contextmanager
267
+ def draft_repo_view(config: RunnerConfig, *, run_id: str):
268
+ """The repository state ONE draft reads (Issue #2276).
269
+
270
+ Yields a detached worktree of `origin/<base_branch>`, fetched at the
271
+ moment the draft starts. The deployment checkout is never advanced —
272
+ deliveries build their worktrees from the remote — so its working tree
273
+ can predate the base by weeks, and a draft that reads it reports
274
+ existing files as missing and cites names the base renamed.
275
+
276
+ A failed fetch FAILS the draft (`draft_failed`): a failed draft is
277
+ recoverable, a stale read is the defect this replaces, so there is no
278
+ fallback to the checkout. The view is removed when the draft ends; the
279
+ checkout and every delivery worktree are never touched.
280
+ """
281
+ repo_dir = Path(config.repo_dir)
282
+ base_branch = config.base_branch
283
+ try:
284
+ view = add_draft_view(repo_dir, base_branch, run_id)
285
+ except (RuntimeError, subprocess.SubprocessError) as exc:
286
+ raise DraftError(
287
+ "draft_failed", f"read the repository at origin/{base_branch}",
288
+ failure_detail(exc),
289
+ ) from exc
290
+ try:
291
+ yield view
292
+ finally:
293
+ try:
294
+ remove_draft_view(repo_dir, view)
295
+ except subprocess.SubprocessError as exc:
296
+ LOGGER.warning(
297
+ "draft view %s could not be removed: %s", view, exc,
298
+ )
299
+
300
+
212
301
  def render_context(payload: dict, *, repo_dir: Path) -> str:
213
302
  """The one context a round hands the session.
214
303
 
@@ -357,7 +446,10 @@ def _run_answer_session(
357
446
  The answer file is removed first, so an answer found after a failure is
358
447
  the one THIS round wrote: a round that timed out after the model wrote
359
448
  its draft still returns that draft, and a round that wrote nothing
360
- fails.
449
+ fails. A model-provider balance refusal is its own code with the plain
450
+ sentence as its detail — never `session_failed` and never the Python
451
+ exception text, which is where the provider's raw payload lives
452
+ (Issue #2278).
361
453
  """
362
454
  out_path.unlink(missing_ok=True)
363
455
  try:
@@ -368,6 +460,11 @@ def _run_answer_session(
368
460
  )
369
461
  except Exception as exc:
370
462
  if not out_path.is_file():
463
+ if provider_balance.is_stop(failure.failure_detail(exc)):
464
+ raise DraftError(
465
+ provider_balance.DRAFT_CODE, "run the drafting session",
466
+ provider_balance.DETAIL,
467
+ ) from exc
371
468
  code = (
372
469
  "timeout"
373
470
  if isinstance(exc, subprocess.TimeoutExpired)
@@ -545,36 +642,38 @@ def run_round(
545
642
  session_root = Path(session_dir).resolve()
546
643
  session_root.mkdir(parents=True, exist_ok=True)
547
644
  out_path = session_root / DRAFT_ANSWER_FILE
548
- payload, answer, taken = _answered_round(
549
- config, repo, session_root=session_root, payload=payload,
550
- out_path=out_path, run_id=run_id,
551
- )
552
- if answer.questions:
645
+ with draft_repo_view(config, run_id=run_id) as repo_view:
646
+ payload, answer, taken = _answered_round(
647
+ config, repo, session_root=session_root, payload=payload,
648
+ out_path=out_path, run_id=run_id, repo_view=repo_view,
649
+ )
650
+ if answer.questions:
651
+ return DraftRound(
652
+ reply=named_in_reply(answer.reply, taken),
653
+ questions=answer.questions,
654
+ )
655
+ if not answer.issues:
656
+ # Issue #2201: a reply-only answer asks for no code change, so
657
+ # neither the fidelity pass nor the pre-work check runs.
658
+ return DraftRound(reply=named_in_reply(answer.reply, taken))
659
+ issues, warning = fidelity_pass(
660
+ config, repo, session_root=session_root, run_id=run_id,
661
+ request=_fidelity_request(payload), issues=answer.issues,
662
+ )
663
+ issues, check, warning, reply = _apply_check(
664
+ config, repo, session_root=session_root, payload=payload,
665
+ run_id=run_id, issues=issues, warning=warning, reply=answer.reply,
666
+ repo_view=repo_view,
667
+ )
553
668
  return DraftRound(
554
- reply=named_in_reply(answer.reply, taken),
555
- questions=answer.questions,
669
+ reply=named_in_reply(reply, taken), issues=issues,
670
+ check=check, warning=warning,
556
671
  )
557
- if not answer.issues:
558
- # Issue #2201: a reply-only answer asks for no code change, so
559
- # neither the fidelity pass nor the pre-work check runs.
560
- return DraftRound(reply=named_in_reply(answer.reply, taken))
561
- issues, warning = fidelity_pass(
562
- config, repo, session_root=session_root, run_id=run_id,
563
- request=_fidelity_request(payload), issues=answer.issues,
564
- )
565
- issues, check, warning, reply = _apply_check(
566
- config, repo, session_root=session_root, payload=payload,
567
- run_id=run_id, issues=issues, warning=warning, reply=answer.reply,
568
- )
569
- return DraftRound(
570
- reply=named_in_reply(reply, taken), issues=issues,
571
- check=check, warning=warning,
572
- )
573
672
 
574
673
 
575
674
  def _answered_round(
576
675
  config: RunnerConfig, repo: str, *, session_root: Path, payload: dict,
577
- out_path: Path, run_id: str,
676
+ out_path: Path, run_id: str, repo_view: Path,
578
677
  ) -> tuple[dict, DraftAnswer, tuple[Option, ...]]:
579
678
  """Run the session until it drafts or asks what only the person can answer.
580
679
 
@@ -592,9 +691,7 @@ def _answered_round(
592
691
  round_payload = {**payload, "message": message, "conversation": turns}
593
692
  _run_answer_session(
594
693
  config, repo, session_root=session_root,
595
- context=render_context(
596
- round_payload, repo_dir=Path(config.repo_dir),
597
- ),
694
+ context=render_context(round_payload, repo_dir=repo_view),
598
695
  out_path=out_path, run_id=run_id,
599
696
  resume=any((session_root / DRAFT_SESSION_DIR).glob("*.jsonl")),
600
697
  )
@@ -622,7 +719,7 @@ def _answered_round(
622
719
  def _apply_check(
623
720
  config: RunnerConfig, repo: str, *, session_root: Path, payload: dict,
624
721
  run_id: str, issues: tuple[DraftIssue, ...], warning: str | None,
625
- reply: str,
722
+ reply: str, repo_view: Path,
626
723
  ) -> tuple[tuple[DraftIssue, ...], str, str | None, str]:
627
724
  """Judge the draft; on a failure rewrite it ONCE and judge again.
628
725
 
@@ -645,9 +742,7 @@ def _apply_check(
645
742
  try:
646
743
  _run_answer_session(
647
744
  config, repo, session_root=session_root,
648
- context=render_context(rewrite_payload, repo_dir=Path(
649
- config.repo_dir,
650
- )),
745
+ context=render_context(rewrite_payload, repo_dir=repo_view),
651
746
  out_path=session_root / DRAFT_ANSWER_FILE, run_id=run_id,
652
747
  resume=True,
653
748
  )
@@ -26,7 +26,7 @@ import json
26
26
  import re
27
27
  import subprocess
28
28
 
29
- from orbi import gh_response, language, user_summary
29
+ from orbi import gh_response, language, provider_balance, user_summary
30
30
  from orbi.comment_kind import parse_versioned_block
31
31
 
32
32
  SCHEMA_VERSION = 1
@@ -57,6 +57,8 @@ REASON_CODES = frozenset({
57
57
  "human_decision_required",
58
58
  # The GitHub/provider credential is missing or rejected.
59
59
  "credential_missing",
60
+ # The model provider ACCOUNT has no balance (#2283).
61
+ provider_balance.REASON_CODE,
60
62
  # The model provider quota is exhausted (429/RESOURCE_EXHAUSTED).
61
63
  "provider_quota",
62
64
  # The configured base branch does not exist in the repository
@@ -87,6 +89,8 @@ ACTION_CODES = frozenset({
87
89
  "decide",
88
90
  # Verify and repair the credential, then retry.
89
91
  "check_credentials",
92
+ # Top up the provider account (or switch the key), then retry.
93
+ provider_balance.ACTION_CODE,
90
94
  # Retry after the provider quota window resets.
91
95
  "wait_quota",
92
96
  })
@@ -178,9 +182,7 @@ def _validate(record: Failure) -> None:
178
182
  if record.action_code not in ACTION_CODES:
179
183
  raise FailureError(f"unknown action_code: {record.action_code!r}")
180
184
  if type(record.retry_safe) is not bool:
181
- raise FailureError(
182
- f"retry_safe must be a boolean, got {record.retry_safe!r}"
183
- )
185
+ raise FailureError(f"retry_safe must be a boolean, got {record.retry_safe!r}")
184
186
 
185
187
 
186
188
  def parse(body: object) -> Failure | None:
@@ -218,30 +220,24 @@ def _parse_block(data: dict) -> Failure:
218
220
  # The classifier: exception detail -> closed reason/action codes
219
221
  # --------------------------------------------------------------------------
220
222
 
221
- # Failure-reason markers. The classifier reads only the bounded
222
- # exception detail; the caller (the runner, which owns the exception
223
- # classes) passes the type-derived flags that win over these patterns, so
224
- # a code is never derived from a guess.
223
+ # Failure-reason markers. The classifier reads only the bounded exception
224
+ # detail; the caller (the runner, which owns the exception classes) passes
225
+ # the type-derived flags that win over these patterns, so no code is guessed.
225
226
  _PROVIDER_QUOTA_RE = re.compile(
226
227
  r"\b429\b|quota|resource_exhausted|retry in|usage limit has been reached",
227
228
  re.IGNORECASE,
228
229
  )
229
230
  # The word markers `pi_process`'s early-exit classifier
230
- # (`_classify_startup_exit`) matches: the provider's own words stay the Pi
231
- # startup classification's (Issue #1465), read here by the one regex below.
231
+ # (`_classify_startup_exit`) matches, read here by the one regex below
232
+ # (Issue #1465).
232
233
  PROVIDER_AUTH_WORDS = ("unauthorized", "forbidden", "api key")
233
234
 
234
- # The text-only credential markers. GitHub failures no longer read this
235
- # one: they carry the exact response status (`gh_response`), while
236
- # `forbidden` and `credential` matched a branch or check name in the
237
- # command's argv (Issue #1760). The remaining markers serve the Pi /
238
- # model-provider detail, which only gives text (Issue #1465); `forbidden`
239
- # stays in `PROVIDER_AUTH_WORDS` for `pi_process`'s startup classifier.
240
- # `api key` is the provider's own missing/rejected-key sentence ("No API
241
- # key found for provider …"), the marker `PROVIDER_AUTH_WORDS` still
242
- # lists; only `incorrect api key` survived #1762, so the plain sentence
243
- # regressed to `unclassified` (Issue #1768). An argv word cannot carry
244
- # it — the space keeps it out of a branch, label or check name.
235
+ # The text-only credential markers. GitHub failures no longer read this one:
236
+ # they carry the exact response status (`gh_response`), while `forbidden`
237
+ # and `credential` matched a branch or check name in the command's argv
238
+ # (Issue #1760). The remaining markers serve the Pi / model-provider detail,
239
+ # which only gives text (Issue #1465). `api key` is the provider's own
240
+ # missing-key sentence, which no argv word can carry across the space (#1768).
245
241
  _CREDENTIAL_MISSING_RE = re.compile(
246
242
  r"bad credentials"
247
243
  r"|(?:http|status)\s+401\b"
@@ -320,6 +316,7 @@ DISPOSITIONS: dict[str, tuple[str, bool]] = {
320
316
  "review_budget_exhausted": ("decide", False),
321
317
  "human_decision_required": ("decide", False),
322
318
  "credential_missing": ("check_credentials", False),
319
+ "provider_balance": (provider_balance.ACTION_CODE, False),
323
320
  "provider_quota": ("wait_quota", True),
324
321
  "base_branch_missing": ("fix_ticket", False),
325
322
  "base_ci_red": ("fix_ticket", False),
@@ -409,6 +406,10 @@ def classify(detail: str, *, outcome: str = "blocked",
409
406
  # cannot grant: the existing `credential_missing` /
410
407
  # `check_credentials` category, a repair required before retry.
411
408
  reason_code = "credential_missing"
409
+ elif provider_balance.is_stop(detail):
410
+ # The provider ACCOUNT has no balance (a 402 refusal, #2283): its
411
+ # own stop, repaired by a top-up, not a credential re-check.
412
+ reason_code = provider_balance.REASON_CODE
412
413
  elif _CREDENTIAL_MISSING_RE.search(detail):
413
414
  reason_code = "credential_missing"
414
415
  elif _timeout_is_text_only(error) and _TEXT_TIMEOUT_RE.search(detail):
@@ -27,8 +27,8 @@ import logging
27
27
  from pathlib import Path
28
28
 
29
29
  from orbi import (
30
- base_ci_fix, base_ci_red, failure, failure_evidence, language, question,
31
- requeue, runner_health, scene, user_summary,
30
+ base_ci_fix, base_ci_red, failure, failure_evidence, language,
31
+ provider_balance, question, requeue, runner_health, scene, user_summary,
32
32
  )
33
33
  from orbi.blocked_comment import post_blocked_comment
34
34
  from orbi.comment_kind import (
@@ -59,6 +59,7 @@ from orbi.github import (
59
59
  from orbi.journal import LOGGER, event, issue_context, run_command
60
60
  from orbi.pi_activity import activity_snapshot
61
61
  from orbi.pi_process import RateLimitExhaustedError
62
+ from orbi.pr_head_sync import DeliveryBranchChangedError
62
63
  from orbi.progress import (
63
64
  FAILURE_MARKER_PATTERN, RUN_MARKER_PATTERN, ProgressPublisher,
64
65
  bump_failure_repeat, failure_marker, failure_repeat_count,
@@ -534,6 +535,51 @@ def _update_reported_failure(*, number: int, source_repo: str,
534
535
  return False
535
536
 
536
537
 
538
+ def _typed_failure_wording(
539
+ exc: BaseException, *, pr_url: str | None, branch: str | None,
540
+ language_code: str,
541
+ ) -> tuple[bool, bool, tuple[str, str] | None]:
542
+ """The reader-facing Action/Reason of a typed failure (#1651, #2273).
543
+
544
+ Three failures answer the reader themselves instead of with the generic
545
+ wording: the GitHub App Actions-workflow refusal (an authorization only
546
+ a human can grant, so the repair path names the permission), the
547
+ delivery branch changed outside this run (Git answers with a "Note
548
+ about fast-forwards" hint that names neither the cause nor the next
549
+ step) and the model provider's balance refusal (its exit's stderr is the
550
+ provider's `insufficient_balance_error` payload, not a reason a person
551
+ can act on, Issue #2278). Returns
552
+ `(terminal, milestone_shows_the_action, (action, reason))`, or
553
+ `(False, False, None)` for a failure that keeps the generic wording.
554
+ Only the two external authorizations are terminal; the balance stop
555
+ keeps the recovery its exit already had.
556
+ """
557
+ if failure.workflow_permission_refused(failure_detail(exc)):
558
+ return True, True, (
559
+ failure.workflow_permission_action(
560
+ pr_url, language_code=language_code),
561
+ failure.workflow_permission_cause(language_code),
562
+ )
563
+ if isinstance(exc, DeliveryBranchChangedError):
564
+ cause = language.text(
565
+ language_code, "failure.delivery_branch_changed_cause",
566
+ branch=branch or "-",
567
+ )
568
+ return True, False, (
569
+ language.text(
570
+ language_code, "failure.delivery_branch_changed_action",
571
+ cause=cause,
572
+ ),
573
+ cause,
574
+ )
575
+ if provider_balance.is_stop(failure_detail(exc)):
576
+ return False, False, (
577
+ provider_balance.action(language_code),
578
+ provider_balance.cause(language_code),
579
+ )
580
+ return False, False, None
581
+
582
+
537
583
  def report_delivery_failure(
538
584
  exc: BaseException, *, issue: dict, source_repo: str,
539
585
  run_id: str | None, pr_url: str | None, worktree: Path | None,
@@ -607,24 +653,22 @@ def report_delivery_failure(
607
653
  number = int(issue["number"])
608
654
  title = issue["title"]
609
655
  priority = issue_priority(issue)
610
- # Keep `cause` as a compatibility input for callers outside the three
611
- # production paths; new callers provide the three named parts.
656
+ # `cause` stays a compatibility input; new callers name the parts.
612
657
  if reason is None:
613
658
  reason = cause or failure_detail(exc)
614
659
  if diagnosis is None:
615
660
  diagnosis = cause or failure_detail(exc)
616
661
  blocked = not classify or is_unrecoverable_failure(exc)
617
- # The GitHub App Actions-workflow refusal is an authorization only a
618
- # human can grant: it is terminal (`ai-blocked`) whichever path
619
- # caught it, and its reader-facing cause and repair differ from the
620
- # generic credential wording. One canonical explanation below feeds
621
- # the detailed comment, the terminal progress scene and the short
622
- # milestone so the three surfaces cannot disagree (Issue #1651).
623
- workflow_refusal = failure.workflow_permission_refused(failure_detail(exc))
624
- if workflow_refusal:
662
+ # A typed failure carries its own cause and repair; the two external
663
+ # authorizations are terminal (`ai-blocked`) whichever path caught them
664
+ # (Issues #1651, #2273).
665
+ typed_terminal, milestone_shows_action, wording = _typed_failure_wording(
666
+ exc, pr_url=pr_url, branch=branch, language_code=language_code,
667
+ )
668
+ if typed_terminal:
625
669
  blocked = True
626
- action = failure.workflow_permission_action(pr_url, language_code=language_code)
627
- reason = failure.workflow_permission_cause(language_code)
670
+ if wording is not None:
671
+ action, reason = wording
628
672
  # Issue #2220: a stop that carries one structured question shows its
629
673
  # one-sentence summary as the visible Reason and — when the class is not
630
674
  # 'authority' and one recommended option is executable in place — answers
@@ -664,12 +708,14 @@ def report_delivery_failure(
664
708
  streak = _failure_streak(history, run_id, fingerprint, repo=source_repo)
665
709
  if streak + 1 >= FAILURE_STREAK_LIMIT:
666
710
  blocked = True
667
- reason += language.text(
668
- language_code,
669
- "delivery.failure_streak_escalation",
670
- count=streak + 1, run_id=run_id,
671
- fingerprint=fingerprint,
672
- )
711
+ # A typed failure already answered the reader (#2278).
712
+ if wording is None:
713
+ reason += language.text(
714
+ language_code,
715
+ "delivery.failure_streak_escalation",
716
+ count=streak + 1, run_id=run_id,
717
+ fingerprint=fingerprint,
718
+ )
673
719
  event(
674
720
  "failure_streak_escalated", level=logging.ERROR,
675
721
  issue=number, run_id=run_id, streak=streak + 1,
@@ -745,7 +791,7 @@ def report_delivery_failure(
745
791
  # the bare cause. Computed here, after the #825 guard may have
746
792
  # extended `reason`.
747
793
  milestone_summary = (
748
- action if workflow_refusal and action
794
+ action if milestone_shows_action and action
749
795
  else failure_summary(reason, language_code)
750
796
  )
751
797
  scene = scene_line() or "- run: `-`"