brindle 0.5.1__tar.gz → 0.5.3__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 (199) hide show
  1. {brindle-0.5.1 → brindle-0.5.3}/PKG-INFO +1 -1
  2. {brindle-0.5.1 → brindle-0.5.3}/pyproject.toml +1 -1
  3. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/agents.py +49 -31
  4. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/antigravity.py +1 -1
  5. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/autopilot.py +4 -4
  6. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/check_scope.py +10 -6
  7. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/cli.py +18 -12
  8. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/cloud_login.py +21 -8
  9. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/codex_hook.py +20 -2
  10. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/company_login.py +3 -1
  11. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/config.py +86 -19
  12. brindle-0.5.3/src/brindle/connections.py +533 -0
  13. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/api-schema.json +1739 -609
  14. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/lifecycle.py +2 -0
  15. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/routes_actions.py +311 -96
  16. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/routes_read.py +153 -35
  17. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/session_review.py +23 -23
  18. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/db.py +23 -4
  19. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/gates.py +63 -6
  20. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/git.py +7 -2
  21. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/key_check.py +27 -10
  22. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/keys_cmds.py +61 -3
  23. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/keystore.py +106 -4
  24. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/mcp_server.py +1 -1
  25. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/runner.py +2 -2
  26. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/org_permissions.py +22 -2
  27. brindle-0.5.3/src/brindle/permission_grants.py +1523 -0
  28. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/permission_groups.py +18 -15
  29. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/permissions.py +207 -69
  30. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pipeline.py +9 -9
  31. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/policy.py +7 -4
  32. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/license.py +48 -0
  33. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/team_policy.py +55 -3
  34. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/profiles.py +7 -1
  35. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/provider_homes.py +35 -0
  36. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/providers.py +48 -1
  37. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/providers_install.py +33 -0
  38. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/service/dto.py +118 -2
  39. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/service/inbox.py +41 -3
  40. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/service/permissions.py +47 -4
  41. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/service/routing.py +6 -3
  42. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/tmux.py +50 -2
  43. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/worker_models.py +30 -13
  44. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/workspaces.py +19 -10
  45. brindle-0.5.1/src/brindle/permission_grants.py +0 -803
  46. {brindle-0.5.1 → brindle-0.5.3}/.gitignore +0 -0
  47. {brindle-0.5.1 → brindle-0.5.3}/LICENSE +0 -0
  48. {brindle-0.5.1 → brindle-0.5.3}/README.md +0 -0
  49. {brindle-0.5.1 → brindle-0.5.3}/SCHEDULE-A +0 -0
  50. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/__init__.py +0 -0
  51. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/__main__.py +0 -0
  52. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/account.py +0 -0
  53. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/airgap.py +0 -0
  54. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/assembler.py +0 -0
  55. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/assets/braid_dark.png +0 -0
  56. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/assets/braid_light.png +0 -0
  57. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/budget.py +0 -0
  58. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/__init__.py +0 -0
  59. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/backend-auditor.md +0 -0
  60. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/coordinator.md +0 -0
  61. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-codex.md +0 -0
  62. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-fable.md +0 -0
  63. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-gemini.md +0 -0
  64. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-heavy.md +0 -0
  65. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-light.md +0 -0
  66. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-local.md +0 -0
  67. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-opencode.md +0 -0
  68. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer-sonnet.md +0 -0
  69. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/developer.md +0 -0
  70. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/qa.md +0 -0
  71. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/reviewer-codex.md +0 -0
  72. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/reviewer-gemini.md +0 -0
  73. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/reviewer-local.md +0 -0
  74. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/reviewer-opencode.md +0 -0
  75. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/reviewer.md +0 -0
  76. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/subagent.md +0 -0
  77. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_agents/supervisor.md +0 -0
  78. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_rules/__init__.py +0 -0
  79. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_rules/security/backend.md +0 -0
  80. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_rules/style/minimal-diff.md +0 -0
  81. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/builtin_rules/tests/only.md +0 -0
  82. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/bus.py +0 -0
  83. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/ci_adapters.py +0 -0
  84. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/ci_client.py +0 -0
  85. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/ci_federation.py +0 -0
  86. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/ci_hosts.py +0 -0
  87. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/clone.py +0 -0
  88. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/cloud_credential.py +0 -0
  89. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/codemap.py +0 -0
  90. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/codemap_docs.py +0 -0
  91. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/company_identity.py +0 -0
  92. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/conflicts.py +0 -0
  93. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/coordinator.py +0 -0
  94. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/cost.py +0 -0
  95. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/cost_estimate.py +0 -0
  96. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/cull.py +0 -0
  97. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/__init__.py +0 -0
  98. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/app.py +0 -0
  99. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/auth.py +0 -0
  100. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/events.py +0 -0
  101. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/holds.py +0 -0
  102. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/peer.py +0 -0
  103. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/routes_org_permissions.py +0 -0
  104. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/schema.py +0 -0
  105. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/daemon/terminal.py +0 -0
  106. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/debuglog.py +0 -0
  107. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/demo.py +0 -0
  108. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/detect.py +0 -0
  109. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/doctor.py +0 -0
  110. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/entry.py +0 -0
  111. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/escapes.py +0 -0
  112. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/events.py +0 -0
  113. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/guardrails.py +0 -0
  114. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/history.py +0 -0
  115. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/identity_lock.py +0 -0
  116. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/inbox.py +0 -0
  117. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/kb.py +0 -0
  118. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/knowledge.py +0 -0
  119. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/launch_health.py +0 -0
  120. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/learned_rules.py +0 -0
  121. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/learning.py +0 -0
  122. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/legacy.py +0 -0
  123. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/local_setup.py +0 -0
  124. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/login_pause.py +0 -0
  125. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/model_access.py +0 -0
  126. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/model_availability.py +0 -0
  127. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/__init__.py +0 -0
  128. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/catalog.py +0 -0
  129. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/client.py +0 -0
  130. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/loop.py +0 -0
  131. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/lsp.py +0 -0
  132. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/permissions.py +0 -0
  133. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/serve.py +0 -0
  134. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/native/tools.py +0 -0
  135. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/opencode.py +0 -0
  136. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pane_auth.py +0 -0
  137. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/permission_asks.py +0 -0
  138. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/permission_routing.py +0 -0
  139. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/picker.py +0 -0
  140. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/plugins.py +0 -0
  141. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pool.py +0 -0
  142. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/preflight.py +0 -0
  143. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pricing.py +0 -0
  144. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/__init__.py +0 -0
  145. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/_files.py +0 -0
  146. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/account.py +0 -0
  147. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/audit_chain.py +0 -0
  148. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/audit_export.py +0 -0
  149. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/auth.py +0 -0
  150. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/brief_learning.py +0 -0
  151. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/cost_centers.py +0 -0
  152. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/credentials.py +0 -0
  153. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/features.py +0 -0
  154. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/keys.py +0 -0
  155. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/learning.py +0 -0
  156. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/loopback.py +0 -0
  157. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/managed_models.py +0 -0
  158. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/org_profiles.py +0 -0
  159. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/orgkey.py +0 -0
  160. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/rollout.py +0 -0
  161. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/route_health.py +0 -0
  162. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/settings_sync.py +0 -0
  163. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/status.py +0 -0
  164. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/pro/team_events.py +0 -0
  165. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/procs.py +0 -0
  166. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/prompt_answer.py +0 -0
  167. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/quota.py +0 -0
  168. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/repo_cmds.py +0 -0
  169. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/repos.py +0 -0
  170. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/rewind.py +0 -0
  171. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/rule_checks.py +0 -0
  172. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/savings.py +0 -0
  173. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/scratch.py +0 -0
  174. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/secrets.py +0 -0
  175. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/self_serve.py +0 -0
  176. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/service/__init__.py +0 -0
  177. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/service/errors.py +0 -0
  178. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/service/sessions.py +0 -0
  179. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/services.py +0 -0
  180. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/sessions.py +0 -0
  181. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/sidebar_follow.py +0 -0
  182. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/sidebar_logo.py +0 -0
  183. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/signin_pause.py +0 -0
  184. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/status_cache.py +0 -0
  185. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/tasks.py +0 -0
  186. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/updates.py +0 -0
  187. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/upgrade.py +0 -0
  188. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/usage.py +0 -0
  189. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/view.py +0 -0
  190. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/wake.py +0 -0
  191. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/watch.py +0 -0
  192. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/watch_costs.py +0 -0
  193. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/web/__init__.py +0 -0
  194. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/web/chat.py +0 -0
  195. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/web/dashboard.py +0 -0
  196. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/web/diff.py +0 -0
  197. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/web/server.py +0 -0
  198. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/web/static/app.js +0 -0
  199. {brindle-0.5.1 → brindle-0.5.3}/src/brindle/web/static/index.html +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brindle
3
- Version: 0.5.1
3
+ Version: 0.5.3
4
4
  Summary: Run coding agents in parallel, each on its own git branch, with a supervisor that delegates, reviews, and merges
5
5
  Project-URL: Homepage, https://pawdelta.com/brindle/
6
6
  Project-URL: Documentation, https://pawdelta.com/brindle/docs/recommended-use
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "brindle"
3
- version = "0.5.1"
3
+ version = "0.5.3"
4
4
  description = "Run coding agents in parallel, each on its own git branch, with a supervisor that delegates, reviews, and merges"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -180,7 +180,7 @@ def worker_guidance(ws: Workspace, report_only: bool = False) -> str:
180
180
  from brindle.config import load_repo_config
181
181
 
182
182
  try:
183
- checks = load_repo_config(ws.repo_root).checks
183
+ checks = load_repo_config(ws.repo_root, branch=ws.base_branch).checks
184
184
  except ValueError:
185
185
  checks = []
186
186
  parts = (codemap.guidance(ws), "" if report_only else test_guidance(checks),
@@ -648,29 +648,39 @@ def _open_window(db: DB, agent: Agent, ws: Workspace, name: str, argv: list[str]
648
648
  from brindle import inbox
649
649
 
650
650
  argv = inbox.without_launcher_inbox(argv)
651
- tmux.ensure_session(ws.tmux_session, ws.path, workspaces.workspace_env(ws))
652
- env, credentials, allow, deny, org_env = _window_environment(agent, ws, m)
653
- with secrets.org_key(org_env):
654
- target = tmux.new_window(ws.tmux_session, name, ws.path, argv, env,
655
- tag=(AGENT_TAG, agent.id),
656
- keep=credentials,
657
- **({"allow": allow} if allow is not None else {}),
658
- **({"deny": deny} if deny else {}))
659
- agent.__dict__.pop("_pane_environment", None)
660
- # The pane id only means anything on the server that issued it (a
661
- # resumed agent may come back on a different one), so record both.
662
- server = tmux.current_server()
663
- db.update_agent(agent.id, tmux_window=target, tmux_server=server)
664
- agent.tmux_window, agent.tmux_server = target, server
665
- if get_provider(agent.provider).startup_prompts and not agent.headless:
666
- from brindle import prompt_answer
667
-
668
- prompt_answer.launched(db, agent)
651
+ # The sidebar splits the window after the CLI's pane exists: hold the CLI
652
+ # until then, or a resumed chat drew its conversation at the full width
653
+ # and was resized under it, which Claude Code shows as a blank screen (#264).
654
+ gate = None
669
655
  if watch_pane:
670
- try:
671
- _ensure_sidebar(db, root_of(db, agent.id), ws, target)
672
- except Exception:
673
- pass
656
+ argv, gate = tmux.gated(argv)
657
+ tmux.ensure_session(ws.tmux_session, ws.path, workspaces.workspace_env(ws))
658
+ try:
659
+ env, credentials, allow, deny, org_env = _window_environment(agent, ws, m)
660
+ with secrets.org_key(org_env):
661
+ target = tmux.new_window(ws.tmux_session, name, ws.path, argv, env,
662
+ tag=(AGENT_TAG, agent.id),
663
+ keep=credentials,
664
+ **({"allow": allow} if allow is not None else {}),
665
+ **({"deny": deny} if deny else {}))
666
+ agent.__dict__.pop("_pane_environment", None)
667
+ # The pane id only means anything on the server that issued it (a
668
+ # resumed agent may come back on a different one), so record both.
669
+ server = tmux.current_server()
670
+ db.update_agent(agent.id, tmux_window=target, tmux_server=server)
671
+ agent.tmux_window, agent.tmux_server = target, server
672
+ if get_provider(agent.provider).startup_prompts and not agent.headless:
673
+ from brindle import prompt_answer
674
+
675
+ prompt_answer.launched(db, agent)
676
+ if watch_pane:
677
+ try:
678
+ _ensure_sidebar(db, root_of(db, agent.id), ws, target)
679
+ except Exception:
680
+ pass
681
+ finally:
682
+ if gate:
683
+ tmux.open_gate(gate)
674
684
  tmux.apply_theme(ws.tmux_session)
675
685
  return target
676
686
 
@@ -2318,7 +2328,7 @@ def warm_checks(ws: Workspace) -> None:
2318
2328
  from brindle.providers import brindle_invocation
2319
2329
 
2320
2330
  try:
2321
- if not load_repo_config(ws.repo_root).checks or git.dirty_files(ws.path):
2331
+ if not load_repo_config(ws.repo_root, branch=ws.base_branch).checks or git.dirty_files(ws.path):
2322
2332
  return
2323
2333
  except (ValueError, git.GitError):
2324
2334
  return
@@ -2906,7 +2916,7 @@ def start_review(db: DB, caller: Agent | None, ws: Workspace, profile: str | Non
2906
2916
  from brindle.providers import brindle_invocation
2907
2917
 
2908
2918
  _review_worktree_present(ws)
2909
- cfg = cfg or load_repo_config(ws.repo_root)
2919
+ cfg = cfg or workspaces.config_for(db, ws)
2910
2920
  if not cfg.checks:
2911
2921
  return request_review(db, caller, ws, profile, focus, cfg, second=second, slot=slot)
2912
2922
  _review_kill_switch(ws)
@@ -3026,7 +3036,7 @@ def review_after_checks(db: DB, caller_id: str | None, ws: Workspace, profile: s
3026
3036
  from brindle import gates, pipeline
3027
3037
  from brindle.config import load_repo_config
3028
3038
 
3029
- cfg = cfg or load_repo_config(ws.repo_root)
3039
+ cfg = cfg or workspaces.config_for(db, ws)
3030
3040
  slot = _review_claim_slot(profile, slot)
3031
3041
  profile = _review_profile(db, ws, profile, cfg)
3032
3042
  with _review_request_run(ws.id, profile, request_id), pipeline.review_run(ws.id):
@@ -3166,7 +3176,7 @@ def _request_review(db: DB, caller: Agent | None, ws: Workspace, profile: str |
3166
3176
 
3167
3177
  _review_worktree_present(ws)
3168
3178
  _review_kill_switch(ws)
3169
- cfg = cfg or load_repo_config(ws.repo_root)
3179
+ cfg = cfg or workspaces.config_for(db, ws)
3170
3180
  slot = _review_claim_slot(profile, slot)
3171
3181
  profile = _review_profile(db, ws, profile, cfg)
3172
3182
  if second and not slot:
@@ -3462,7 +3472,7 @@ def _pre_tool_policy(db: DB, agent: Agent, ws: Workspace | None, payload: dict,
3462
3472
  cfg = load_repo_config(ws.repo_root)
3463
3473
  if cfg.permission_policy != "on":
3464
3474
  return None
3465
- req = permissions.from_claude(payload, worktree=ws.path, repo_root=ws.repo_root)
3475
+ req = permissions.from_claude(payload, worktree=ws.path, repo_root=ws.repo_root, agent=agent.id)
3466
3476
  if req is None:
3467
3477
  return None
3468
3478
  try:
@@ -3546,7 +3556,7 @@ def permission_request_decision(db: DB, agent: Agent, payload: dict,
3546
3556
  if provider == "codex":
3547
3557
  # No tool_use_id in Codex's payload: nothing to pair an approval
3548
3558
  # with, so nothing is kept for learning.
3549
- reqs = permissions.from_codex(payload, worktree=ws.path, repo_root=ws.repo_root)
3559
+ reqs = permissions.from_codex(payload, worktree=ws.path, repo_root=ws.repo_root, agent=agent.id)
3550
3560
  if not reqs:
3551
3561
  return None
3552
3562
  rules = [*permissions.all_rules(ws.repo_root), *profile_rules]
@@ -3629,7 +3639,7 @@ def permission_request_decision(db: DB, agent: Agent, payload: dict,
3629
3639
  if provider == "opencode":
3630
3640
  # Asked before every tool call, not only those OpenCode would prompt
3631
3641
  # for, so only a deny is answered (and recorded): the rest is OpenCode's own.
3632
- reqs = permissions.from_opencode(payload, worktree=ws.path, repo_root=ws.repo_root)
3642
+ reqs = permissions.from_opencode(payload, worktree=ws.path, repo_root=ws.repo_root, agent=agent.id)
3633
3643
  if not reqs:
3634
3644
  return None
3635
3645
  rules = [*permissions.all_rules(ws.repo_root), *profile_rules]
@@ -3650,7 +3660,7 @@ def permission_request_decision(db: DB, agent: Agent, payload: dict,
3650
3660
  _record_permission(db, agent, ws, req.summary(), f"deny: {decision.reason}")
3651
3661
  _note_decision(db, agent, ws, req.kind, req.summary(), decision)
3652
3662
  return {"decision": "deny", "reason": f"brindle: {decision.reason}"}
3653
- req = permissions.from_claude(payload, worktree=ws.path, repo_root=ws.repo_root)
3663
+ req = permissions.from_claude(payload, worktree=ws.path, repo_root=ws.repo_root, agent=agent.id)
3654
3664
  if req is None:
3655
3665
  return None
3656
3666
  if policy:
@@ -4000,6 +4010,13 @@ def _stop_decision(db: DB, agent: Agent, payload: dict, via_inbox: bool = False,
4000
4010
  return None
4001
4011
 
4002
4012
 
4013
+ def _retest_keys(provider: str) -> None:
4014
+ """An auth failure may mean a stored key was revoked: check the provider's stored keys again."""
4015
+ from brindle import keys_cmds
4016
+
4017
+ keys_cmds.retest_provider(provider)
4018
+
4019
+
4003
4020
  def handle_hook(db: DB, agent_id: str, event: str, payload: dict) -> dict | None:
4004
4021
  """Called from ``brindle _hook <event>`` inside the agent's own process tree.
4005
4022
  Returns JSON for Claude Code to read on stdout, or None."""
@@ -4233,6 +4250,7 @@ def handle_hook(db: DB, agent_id: str, event: str, payload: dict) -> dict | None
4233
4250
  from brindle import providers, autopilot as pilot
4234
4251
  if is_auth:
4235
4252
  providers.invalidate_signed_in(agent.provider)
4253
+ _retest_keys(agent.provider)
4236
4254
  err_desc = payload.get("error_details") or payload.get("error") or payload.get("error_type") or "401/403"
4237
4255
  msg = (
4238
4256
  f"[brindle] Agent {agent_id} encountered an authentication failure "
@@ -413,7 +413,7 @@ def pre_tool_decision(db, agent_id: str | None, payload: object, strict: bool =
413
413
  cfg = load_repo_config(ws.repo_root)
414
414
  if cfg.permission_policy != "on" and not strict:
415
415
  return output(None)
416
- req = permissions.from_agy(payload, worktree=ws.path, repo_root=ws.repo_root)
416
+ req = permissions.from_agy(payload, worktree=ws.path, repo_root=ws.repo_root, agent=agent.id)
417
417
  rules = [*permissions.all_rules(ws.repo_root), *profile_rules_for(agent.profile, ws.repo_root)]
418
418
  escalate = False
419
419
  if strict:
@@ -47,7 +47,7 @@ import time
47
47
  from dataclasses import dataclass
48
48
  from pathlib import Path
49
49
 
50
- from brindle.config import CONFIG_DIR, WEIGHTS, RepoConfig, config_root, load_repo_config
50
+ from brindle.config import CONFIG_DIR, WEIGHTS, RepoConfig, config_root, load_repo_config, workspace_config
51
51
  from brindle import bus, escapes, knowledge
52
52
  from brindle.db import DB, Agent, Autopilot, Milestone, Workspace, check_state
53
53
  from brindle.profiles import load_profile
@@ -1310,7 +1310,7 @@ def check_milestones(db: DB, root_id: str, ws: Workspace, position: int | None =
1310
1310
  ap = db.get_autopilot(root_id)
1311
1311
  if ap and ap.state == "done":
1312
1312
  return progress(db, root_id, in_flight=False)
1313
- cfg = cfg or load_repo_config(ws.repo_root)
1313
+ cfg = cfg or workspace_config(ws, session=True)
1314
1314
  ms = db.milestones(root_id)
1315
1315
  if not ms:
1316
1316
  raise AutopilotError("no milestones yet: record the goal with set_goal first")
@@ -1363,7 +1363,7 @@ def check_milestones(db: DB, root_id: str, ws: Workspace, position: int | None =
1363
1363
  # Cached by commit when the checkout is clean, so a check that
1364
1364
  # already passed at this HEAD (as a merge gate, say) isn't re-run.
1365
1365
  try:
1366
- ok, out = gates.run_checked(db, checkout, m.check_cmd, workspaces.workspace_env(checkout),
1366
+ ok, out = gates.run_checked(db, checkout, m.check_cmd, workspaces.workspace_env(checkout, repo_cfg),
1367
1367
  repo_cfg.check_timeout)
1368
1368
  except Exception as e:
1369
1369
  db.record_check(m.id, False, f"$ {m.check_cmd}\n(crashed: {e})", sha,
@@ -1569,7 +1569,7 @@ def start_audit(db: DB, root_id: str, ws: Workspace, cfg: RepoConfig | None = No
1569
1569
  if ap.audit_sha == head:
1570
1570
  return None
1571
1571
  agents.close(db, running.id)
1572
- cfg = cfg or load_repo_config(ws.repo_root)
1572
+ cfg = cfg or workspace_config(ws, session=True)
1573
1573
  profile = agents.default_review_profile(cfg, db.get_agent(root_id), db, ws.repo_root, ap.goal)
1574
1574
  auditor = agents.spawn(db, ws, profile, prompt=audit_prompt(db, ap, head), parent_id=root_id,
1575
1575
  mode="review", background_setup=True)
@@ -14,7 +14,9 @@ left its base decide what runs:
14
14
  - one matches ``INFER_FULL_WHEN`` (conftest, pytest and project config, a
15
15
  lockfile) or is under ``.brindle/``, or the scope can't be worked out: the
16
16
  command runs in full;
17
- - otherwise the command runs on the test files the branch touched plus the
17
+ - otherwise changed files that aren't ``.py`` are ignored (pytest can't be
18
+ affected by them), and if none is left the check is skipped; the command
19
+ runs on the test files the branch touched plus the
18
20
  tests ``graphify affected`` reaches from each changed symbol. A changed file
19
21
  the graph can't map to a test runs the full suite instead.
20
22
 
@@ -61,10 +63,9 @@ _VALUE_OPTIONS = {"-n", "-m", "-k", "-p", "-o", "-c", "--maxfail", "--tb", "--du
61
63
  "--deselect", "--dist", "--cov", "--timeout", "--junitxml", "-W", "--basetemp"}
62
64
  INFER_FULL_WHEN = ["**/conftest.py", "**/pyproject.toml", "**/setup.cfg", "**/pytest.ini", "**/tox.ini",
63
65
  "**/*.lock", "**/*lock.json", "**/requirements*.txt"]
64
- NOTICE = ("brindle can now run only the tests a branch's changes reach for a plain pytest check (`{cmd}`), "
65
- "using the code graph; it will be the default next release. Try it now with "
66
- '`"scoped_checks": "infer"` in .brindle/config.json (or ~/.brindle/config.json), or keep the '
67
- 'current behaviour with `"scoped_checks": "off"`.')
66
+ NOTICE = ("brindle now runs only the tests a worker branch's changes reach for a plain pytest check (`{cmd}`), "
67
+ "using the code graph. To always run it in full, set "
68
+ '`"scoped_checks": "off"` in .brindle/config.json (or ~/.brindle/config.json).')
68
69
 
69
70
 
70
71
  def pytest_selectors(cmd: str) -> bool | None:
@@ -99,7 +100,7 @@ def inferred(cmd: str, mode: str | None) -> CheckScope | None:
99
100
  """The scope ``scoped_checks: "infer"`` gives ``cmd``: pytest on the
100
101
  affected tests when it is a plain pytest command that picks no tests
101
102
  itself (appending targets would not narrow it), else None."""
102
- if mode == "infer" and pytest_selectors(cmd) is False:
103
+ if mode in (None, "infer") and pytest_selectors(cmd) is False:
103
104
  return CheckScope(INFER_FULL_WHEN)
104
105
  return None
105
106
 
@@ -176,6 +177,9 @@ def command(ws: Workspace, cmd: str, scope: CheckScope | None, diff: tuple[str,
176
177
  return None
177
178
  if any(matches(f, ALWAYS_FULL) or matches(f, scope.full_when) for f in changed):
178
179
  return cmd
180
+ changed = [f for f in changed if f.endswith(".py")] # pytest can't be affected by the rest
181
+ if not changed:
182
+ return None
179
183
  tests = pytest_targets(ws, base, changed)
180
184
  return f"{cmd} {_quoted(tests)} || [ $? -eq 5 ]" if tests else cmd # 5: none of them selected
181
185
 
@@ -2333,11 +2333,10 @@ def open_cmd(
2333
2333
  @app.command()
2334
2334
  def setup(workspace: Optional[str] = typer.Argument(None)) -> None:
2335
2335
  """Re-run setup commands in a workspace."""
2336
- from brindle.config import load_repo_config
2337
-
2338
- ws = _ws(DB(), workspace)
2339
- cmds = load_repo_config(ws.repo_root).setup
2340
- res = workspaces.run_commands(cmds, ws.path, workspaces.workspace_env(ws))
2336
+ db = DB()
2337
+ ws = _ws(db, workspace)
2338
+ cfg = workspaces.config_for(db, ws)
2339
+ res = workspaces.run_commands(cfg.setup, ws.path, workspaces.workspace_env(ws, cfg))
2341
2340
  typer.echo(res.log or "(no setup commands)")
2342
2341
  raise typer.Exit(0 if res.ok else 1)
2343
2342
 
@@ -2407,8 +2406,15 @@ def pr(
2407
2406
  draft: bool = typer.Option(False, "--draft"),
2408
2407
  ) -> None:
2409
2408
  """Push and open a pull request against the base branch."""
2410
- ws = _ws(DB(), workspace)
2411
- url = _run(workspaces.pull_request, ws, title, draft)
2409
+ from brindle import gates
2410
+
2411
+ db = DB()
2412
+ ws = _ws(db, workspace)
2413
+ def open_checked() -> str:
2414
+ with gates.pr_checked(db, ws, lambda text: typer.echo(text, err=True)) as sha:
2415
+ return workspaces.pull_request(ws, title, draft, sha=sha)
2416
+
2417
+ url = _run(open_checked)
2412
2418
  typer.echo(url)
2413
2419
  _offer_delete_on_merge(ws.repo_root)
2414
2420
 
@@ -2453,12 +2459,12 @@ def services_cmd(
2453
2459
  ) -> None:
2454
2460
  """Per-worktree Docker services (brindle Pro): list, start or stop a workspace's."""
2455
2461
  from brindle import services as services_mod
2456
- from brindle.config import load_repo_config
2457
2462
 
2458
2463
  if action not in ("ls", "up", "down"):
2459
2464
  _fail("action must be ls, up or down")
2460
- ws = _ws(DB(), workspace)
2461
- cfg = load_repo_config(ws.repo_root)
2465
+ db = DB()
2466
+ ws = _ws(db, workspace)
2467
+ cfg = workspaces.config_for(db, ws)
2462
2468
  if not cfg.services:
2463
2469
  _fail('no services configured; add a "services" list to .brindle/config.json')
2464
2470
  if action == "up":
@@ -3100,7 +3106,7 @@ def review_after_checks_cmd(workspace_id: str, caller: Optional[str] = typer.Opt
3100
3106
  if ws is None:
3101
3107
  return
3102
3108
  try:
3103
- agents.review_after_checks(db, caller, ws, profile, focus, load_repo_config(ws.repo_root),
3109
+ agents.review_after_checks(db, caller, ws, profile, focus, workspaces.config_for(db, ws),
3104
3110
  request_id=request_id, second=second, slot=slot)
3105
3111
  except (agents.AgentError, ValueError) as e:
3106
3112
  from brindle import pipeline
@@ -3170,7 +3176,7 @@ def warm_checks_cmd(workspace_id: str) -> None:
3170
3176
  try:
3171
3177
  # A new commit makes this run's result useless (the review and the
3172
3178
  # gate want the new head), so give up and free the check slot.
3173
- gates.check_summary(db, ws, load_repo_config(ws.repo_root),
3179
+ gates.check_summary(db, ws, workspaces.config_for(db, ws),
3174
3180
  cancel=lambda: gates.head(ws) != sha)
3175
3181
  except gates.Abandoned:
3176
3182
  pass
@@ -191,6 +191,9 @@ def login_command(env: Mapping[str, str]) -> list[str] | None:
191
191
  project = (full.get("GOOGLE_CLOUD_PROJECT") if full.get("BRINDLE_CLOUD_ROUTE") == "vertex"
192
192
  else full.get("ANTHROPIC_VERTEX_PROJECT_ID"))
193
193
  return ["gcloud", "auth", "application-default", "login", *(["--project", project] if project else [])]
194
+ if route == "foundry" and not (full.get("ANTHROPIC_FOUNDRY_API_KEY") or full.get("AZURE_FEDERATED_TOKEN_FILE")):
195
+ # Claude on Foundry signs in with the Azure CLI's login (in AZURE_CONFIG_DIR).
196
+ return azure_login_command(full)
194
197
  if route == "azure":
195
198
  from brindle import opencode
196
199
 
@@ -217,30 +220,40 @@ def interactive_sign_in(*, env: Mapping[str, str] | None = None, run=None, probe
217
220
  The child also holds the lock, so losing the wrapper cannot permit another
218
221
  login while the cloud CLI still runs. An existing login is left alone.
219
222
  """
223
+ return requested_sign_in(env=env, run=run, probe=probe)[1]
224
+
225
+
226
+ def requested_sign_in(*, env: Mapping[str, str] | None = None, run=None, probe=None,
227
+ say=print) -> tuple[str, int]:
228
+ """The sign-in the person asked for, a first one or a renewal: ``(outcome,
229
+ exit code)``, outcome "signed in", "failed", "waiting" (one is already
230
+ running for this login) or "manual" (another system owns this identity).
231
+ ``run(argv, env=, pass_fds=)`` runs the cloud CLI, holding the lock."""
220
232
  full = {**os.environ, **(env or {})}
221
233
  command = login_command(full)
222
234
  lg = _login(None, full, None)
223
235
  if command is None or lg is None:
224
- print("Refresh this identity's configured credentials directly.")
225
- return 1
236
+ say("Refresh this identity's configured credentials directly.")
237
+ return "manual", 1
226
238
  lg.lock.parent.mkdir(parents=True, exist_ok=True)
227
239
  fd = os.open(lg.lock, os.O_RDWR | os.O_CREAT, 0o600)
228
240
  try:
229
241
  if not _locked(fd):
230
- print("A cloud sign-in is already running. Finish it in its existing browser or terminal.")
231
- return 1
242
+ say("A cloud sign-in is already running. Finish it in its existing browser or terminal.")
243
+ return "waiting", 1
232
244
  lg.write({"lapse": lg.fingerprint(), "opened_at": time.time(), "interactive": True})
233
245
  if lg.provider == "azure":
234
246
  s = status("azure", env=full, run=probe or run_bounded)
235
247
  if not s.ok:
236
248
  code = (run or subprocess.run)(azure_login_command(full), env=full, pass_fds=(fd,)).returncode
237
249
  if code:
238
- return code
250
+ return "failed", code
239
251
  s = status("azure", env=full, run=probe or run_bounded)
240
252
  if not s.ok:
241
- print(s.note)
242
- return 1
243
- return (run or subprocess.run)(command, env=full, pass_fds=(fd,)).returncode
253
+ say(s.note)
254
+ return "failed", 1
255
+ code = (run or subprocess.run)(command, env=full, pass_fds=(fd,)).returncode
256
+ return ("failed" if code else "signed in"), code
244
257
  finally:
245
258
  os.close(fd)
246
259
 
@@ -73,6 +73,20 @@ def _home_key(home: Path) -> str:
73
73
  return os.path.realpath(home)
74
74
 
75
75
 
76
+ def _runnable_script(script: str) -> bool:
77
+ if not os.access(script, os.X_OK):
78
+ return False
79
+ try:
80
+ with open(script, "rb") as f:
81
+ first = f.readline(4096)
82
+ except OSError:
83
+ return False
84
+ if first.startswith(b"#!"):
85
+ interpreter = first[2:].split(maxsplit=1)
86
+ return bool(interpreter) and os.access(os.fsdecode(interpreter[0]), os.X_OK)
87
+ return True
88
+
89
+
76
90
  def _stable_invocation() -> list[str]:
77
91
  """brindle_invocation, with the interpreter named the same however brindle
78
92
  was started (a venv's ``python`` and ``python3`` are the same program,
@@ -87,8 +101,12 @@ def _stable_invocation() -> list[str]:
87
101
  # replaces the other's and the next launch of either stops at "Hooks need review".
88
102
  script = os.path.join(os.path.dirname(exe), "brindle")
89
103
  if len(argv) == 1:
90
- return [os.path.realpath(exe)]
91
- if argv[1:] == ["-P", "-m", "brindle"] and os.access(script, os.X_OK):
104
+ if _runnable_script(exe):
105
+ return [os.path.realpath(exe)]
106
+ # Older bundled engines carry a console script with a CI-only shebang.
107
+ exe = os.path.join(os.path.dirname(os.path.realpath(exe)), "python3")
108
+ argv = [exe, "-P", "-m", "brindle"]
109
+ if argv[1:] == ["-P", "-m", "brindle"] and _runnable_script(script):
92
110
  return [os.path.realpath(script)]
93
111
  plain = os.path.join(os.path.dirname(exe), "python")
94
112
  try:
@@ -24,6 +24,7 @@ from pathlib import Path
24
24
  from typing import Callable
25
25
 
26
26
  from brindle import cloud_credential, config
27
+ from brindle.pro.license import request_cached
27
28
 
28
29
  log = logging.getLogger(__name__)
29
30
 
@@ -575,6 +576,7 @@ def route_in_use(org_id: str, setup) -> bool:
575
576
  return isinstance(got, dict) and got.get("org") == org_id
576
577
 
577
578
 
579
+ @request_cached
578
580
  def org_setup(repo_root: str | None = None, store=None, client=None, max_age: float | None = None):
579
581
  """(org id, AgentSetup) for the signed-in org; personal policies supply
580
582
  only federated Claude setup. None when there is no applicable setup;
@@ -583,8 +585,8 @@ def org_setup(repo_root: str | None = None, store=None, client=None, max_age: fl
583
585
  from brindle.pro import credentials, license, team_policy
584
586
 
585
587
  try:
586
- store = store or credentials.default_store()
587
588
  ent = license.current(store=store, client=client, max_age=max_age)
589
+ store = store or credentials.default_store()
588
590
  personal = team_policy.FEATURE not in ent.features
589
591
  if personal and (ent.policy_version <= 0 or (store.load() or {}).get("org_id")
590
592
  or ent.plan in ("team", "enterprise")):