webbee 0.7.22__tar.gz → 0.7.23__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 (205) hide show
  1. {webbee-0.7.22 → webbee-0.7.23}/CHANGELOG.md +7 -0
  2. {webbee-0.7.22 → webbee-0.7.23}/PKG-INFO +1 -1
  3. {webbee-0.7.22 → webbee-0.7.23}/pyproject.toml +1 -1
  4. webbee-0.7.23/src/webbee/__init__.py +1 -0
  5. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/session.py +15 -1
  6. webbee-0.7.23/src/webbee/stallwatch.py +123 -0
  7. webbee-0.7.23/tests/test_stallwatch.py +79 -0
  8. {webbee-0.7.22 → webbee-0.7.23}/uv.lock +1 -1
  9. webbee-0.7.22/src/webbee/__init__.py +0 -1
  10. {webbee-0.7.22 → webbee-0.7.23}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  11. {webbee-0.7.22 → webbee-0.7.23}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  12. {webbee-0.7.22 → webbee-0.7.23}/.github/pull_request_template.md +0 -0
  13. {webbee-0.7.22 → webbee-0.7.23}/.github/workflows/os-check.yml +0 -0
  14. {webbee-0.7.22 → webbee-0.7.23}/.github/workflows/publish.yml +0 -0
  15. {webbee-0.7.22 → webbee-0.7.23}/.gitignore +0 -0
  16. {webbee-0.7.22 → webbee-0.7.23}/LICENSE +0 -0
  17. {webbee-0.7.22 → webbee-0.7.23}/PRIVACY.md +0 -0
  18. {webbee-0.7.22 → webbee-0.7.23}/README.md +0 -0
  19. {webbee-0.7.22 → webbee-0.7.23}/SECURITY.md +0 -0
  20. {webbee-0.7.22 → webbee-0.7.23}/assets/architecture.png +0 -0
  21. {webbee-0.7.22 → webbee-0.7.23}/assets/demo.gif +0 -0
  22. {webbee-0.7.22 → webbee-0.7.23}/assets/hero.png +0 -0
  23. {webbee-0.7.22 → webbee-0.7.23}/assets/social-preview.png +0 -0
  24. {webbee-0.7.22 → webbee-0.7.23}/ci/__init__.py +0 -0
  25. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/__init__.py +0 -0
  26. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/drivers.py +0 -0
  27. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/fixture.py +0 -0
  28. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/fixture_long.py +0 -0
  29. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/fixture_wait.py +0 -0
  30. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/provision_user.py +0 -0
  31. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/registry.py +0 -0
  32. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/replay.py +0 -0
  33. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/run.py +0 -0
  34. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/scenarios_account.py +0 -0
  35. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/scenarios_code.py +0 -0
  36. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/scenarios_contract.py +0 -0
  37. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/scenarios_long.py +0 -0
  38. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/scenarios_wait.py +0 -0
  39. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/test_drivers.py +0 -0
  40. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/test_fixture.py +0 -0
  41. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/test_fixture_long.py +0 -0
  42. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/test_fixture_wait.py +0 -0
  43. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/test_registry.py +0 -0
  44. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/test_replay.py +0 -0
  45. {webbee-0.7.22 → webbee-0.7.23}/ci/field_gate/wipe.py +0 -0
  46. {webbee-0.7.22 → webbee-0.7.23}/ci/os_check.py +0 -0
  47. {webbee-0.7.22 → webbee-0.7.23}/dev-webbee +0 -0
  48. {webbee-0.7.22 → webbee-0.7.23}/install.sh +0 -0
  49. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/__main__.py +0 -0
  50. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/_launch.py +0 -0
  51. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/account.py +0 -0
  52. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/active_sessions.py +0 -0
  53. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/autoupdate.py +0 -0
  54. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/banner_art.py +0 -0
  55. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/boot.py +0 -0
  56. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/browser.py +0 -0
  57. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/checkpoints.py +0 -0
  58. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/cli.py +0 -0
  59. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/clipboard.py +0 -0
  60. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/clipboard_read.py +0 -0
  61. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/clipboard_session.py +0 -0
  62. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/coding_context.py +0 -0
  63. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/commands.py +0 -0
  64. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/config.py +0 -0
  65. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/consent.py +0 -0
  66. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/details.py +0 -0
  67. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/events.py +0 -0
  68. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/expand.py +0 -0
  69. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/frames.py +0 -0
  70. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/home.py +0 -0
  71. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/home_view.py +0 -0
  72. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/http.py +0 -0
  73. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/instance_lock.py +0 -0
  74. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/__init__.py +0 -0
  75. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/graph.py +0 -0
  76. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/outline.py +0 -0
  77. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/query.py +0 -0
  78. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/service.py +0 -0
  79. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/store.py +0 -0
  80. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/tree.py +0 -0
  81. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/intel/watch.py +0 -0
  82. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/loop_errors.py +0 -0
  83. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/media.py +0 -0
  84. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/modals.py +0 -0
  85. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/mode_store.py +0 -0
  86. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/native_files.py +0 -0
  87. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/native_read.py +0 -0
  88. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/newtab_mode.py +0 -0
  89. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/output_pane.py +0 -0
  90. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/pricing_constants.py +0 -0
  91. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/queue_panel.py +0 -0
  92. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/reflow.py +0 -0
  93. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/remote.py +0 -0
  94. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/render.py +0 -0
  95. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/repl.py +0 -0
  96. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/repo.py +0 -0
  97. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/selection.py +0 -0
  98. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/sessions.py +0 -0
  99. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/sizing.py +0 -0
  100. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/slots.py +0 -0
  101. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/steer.py +0 -0
  102. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/stream.py +0 -0
  103. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/tab_store.py +0 -0
  104. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/tabs.py +0 -0
  105. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/thread.py +0 -0
  106. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/tier_store.py +0 -0
  107. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/todo_panel.py +0 -0
  108. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/tokens.py +0 -0
  109. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/tools.py +0 -0
  110. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/tui.py +0 -0
  111. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/update.py +0 -0
  112. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/urlopen.py +0 -0
  113. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/wallet.py +0 -0
  114. {webbee-0.7.22 → webbee-0.7.23}/src/webbee/worktrees.py +0 -0
  115. {webbee-0.7.22 → webbee-0.7.23}/tests/__init__.py +0 -0
  116. {webbee-0.7.22 → webbee-0.7.23}/tests/conftest.py +0 -0
  117. {webbee-0.7.22 → webbee-0.7.23}/tests/test_account.py +0 -0
  118. {webbee-0.7.22 → webbee-0.7.23}/tests/test_active_sessions.py +0 -0
  119. {webbee-0.7.22 → webbee-0.7.23}/tests/test_append_file.py +0 -0
  120. {webbee-0.7.22 → webbee-0.7.23}/tests/test_audit_2026_07_25_findings.py +0 -0
  121. {webbee-0.7.22 → webbee-0.7.23}/tests/test_autoupdate.py +0 -0
  122. {webbee-0.7.22 → webbee-0.7.23}/tests/test_checkpoints.py +0 -0
  123. {webbee-0.7.22 → webbee-0.7.23}/tests/test_checkpoints_nested_1030.py +0 -0
  124. {webbee-0.7.22 → webbee-0.7.23}/tests/test_cli.py +0 -0
  125. {webbee-0.7.22 → webbee-0.7.23}/tests/test_clipboard.py +0 -0
  126. {webbee-0.7.22 → webbee-0.7.23}/tests/test_clipboard_read.py +0 -0
  127. {webbee-0.7.22 → webbee-0.7.23}/tests/test_code_map_fresh.py +0 -0
  128. {webbee-0.7.22 → webbee-0.7.23}/tests/test_coding_context.py +0 -0
  129. {webbee-0.7.22 → webbee-0.7.23}/tests/test_commands.py +0 -0
  130. {webbee-0.7.22 → webbee-0.7.23}/tests/test_config.py +0 -0
  131. {webbee-0.7.22 → webbee-0.7.23}/tests/test_cpc_contract_stable.py +0 -0
  132. {webbee-0.7.22 → webbee-0.7.23}/tests/test_cpc_outline.py +0 -0
  133. {webbee-0.7.22 → webbee-0.7.23}/tests/test_cross_loop_token.py +0 -0
  134. {webbee-0.7.22 → webbee-0.7.23}/tests/test_details.py +0 -0
  135. {webbee-0.7.22 → webbee-0.7.23}/tests/test_events.py +0 -0
  136. {webbee-0.7.22 → webbee-0.7.23}/tests/test_expand.py +0 -0
  137. {webbee-0.7.22 → webbee-0.7.23}/tests/test_field_test_1113.py +0 -0
  138. {webbee-0.7.22 → webbee-0.7.23}/tests/test_freeze_fix.py +0 -0
  139. {webbee-0.7.22 → webbee-0.7.23}/tests/test_home.py +0 -0
  140. {webbee-0.7.22 → webbee-0.7.23}/tests/test_home_view.py +0 -0
  141. {webbee-0.7.22 → webbee-0.7.23}/tests/test_home_view_mouse.py +0 -0
  142. {webbee-0.7.22 → webbee-0.7.23}/tests/test_inspect_page.py +0 -0
  143. {webbee-0.7.22 → webbee-0.7.23}/tests/test_instance_lock.py +0 -0
  144. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_any_folder.py +0 -0
  145. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_cache_and_sync_worker.py +0 -0
  146. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_checksum_tree.py +0 -0
  147. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_chunker.py +0 -0
  148. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_embed.py +0 -0
  149. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_folder_1106.py +0 -0
  150. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_graph.py +0 -0
  151. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_no_numpy.py +0 -0
  152. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_query.py +0 -0
  153. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_service.py +0 -0
  154. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_store.py +0 -0
  155. {webbee-0.7.22 → webbee-0.7.23}/tests/test_intel_watch.py +0 -0
  156. {webbee-0.7.22 → webbee-0.7.23}/tests/test_launch.py +0 -0
  157. {webbee-0.7.22 → webbee-0.7.23}/tests/test_loop_errors.py +0 -0
  158. {webbee-0.7.22 → webbee-0.7.23}/tests/test_marathon.py +0 -0
  159. {webbee-0.7.22 → webbee-0.7.23}/tests/test_modals_e2e.py +0 -0
  160. {webbee-0.7.22 → webbee-0.7.23}/tests/test_mode_and_remote_0_6_8.py +0 -0
  161. {webbee-0.7.22 → webbee-0.7.23}/tests/test_mode_store.py +0 -0
  162. {webbee-0.7.22 → webbee-0.7.23}/tests/test_native_files.py +0 -0
  163. {webbee-0.7.22 → webbee-0.7.23}/tests/test_newtab_mode.py +0 -0
  164. {webbee-0.7.22 → webbee-0.7.23}/tests/test_packaging.py +0 -0
  165. {webbee-0.7.22 → webbee-0.7.23}/tests/test_probe_cost.py +0 -0
  166. {webbee-0.7.22 → webbee-0.7.23}/tests/test_queue_manage_0337.py +0 -0
  167. {webbee-0.7.22 → webbee-0.7.23}/tests/test_reflow.py +0 -0
  168. {webbee-0.7.22 → webbee-0.7.23}/tests/test_remote_code_reads.py +0 -0
  169. {webbee-0.7.22 → webbee-0.7.23}/tests/test_render.py +0 -0
  170. {webbee-0.7.22 → webbee-0.7.23}/tests/test_repl.py +0 -0
  171. {webbee-0.7.22 → webbee-0.7.23}/tests/test_repo.py +0 -0
  172. {webbee-0.7.22 → webbee-0.7.23}/tests/test_resilient_http.py +0 -0
  173. {webbee-0.7.22 → webbee-0.7.23}/tests/test_review_fixes_1030.py +0 -0
  174. {webbee-0.7.22 → webbee-0.7.23}/tests/test_session.py +0 -0
  175. {webbee-0.7.22 → webbee-0.7.23}/tests/test_session_review_1030.py +0 -0
  176. {webbee-0.7.22 → webbee-0.7.23}/tests/test_sessions.py +0 -0
  177. {webbee-0.7.22 → webbee-0.7.23}/tests/test_sizing.py +0 -0
  178. {webbee-0.7.22 → webbee-0.7.23}/tests/test_slots.py +0 -0
  179. {webbee-0.7.22 → webbee-0.7.23}/tests/test_ssh_guard.py +0 -0
  180. {webbee-0.7.22 → webbee-0.7.23}/tests/test_steer.py +0 -0
  181. {webbee-0.7.22 → webbee-0.7.23}/tests/test_stream.py +0 -0
  182. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tab_bar_stability.py +0 -0
  183. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tab_restore_0337.py +0 -0
  184. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tabs.py +0 -0
  185. {webbee-0.7.22 → webbee-0.7.23}/tests/test_terminal_ux_0336.py +0 -0
  186. {webbee-0.7.22 → webbee-0.7.23}/tests/test_thread.py +0 -0
  187. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tier_invalidation.py +0 -0
  188. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tier_store.py +0 -0
  189. {webbee-0.7.22 → webbee-0.7.23}/tests/test_todo_panel.py +0 -0
  190. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tokens.py +0 -0
  191. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tool_ack.py +0 -0
  192. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tools.py +0 -0
  193. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tools_eol_cancel_1030.py +0 -0
  194. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tools_vision_websearch.py +0 -0
  195. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tray_1126.py +0 -0
  196. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tui.py +0 -0
  197. {webbee-0.7.22 → webbee-0.7.23}/tests/test_tui_hardening.py +0 -0
  198. {webbee-0.7.22 → webbee-0.7.23}/tests/test_update.py +0 -0
  199. {webbee-0.7.22 → webbee-0.7.23}/tests/test_update_badge_0340.py +0 -0
  200. {webbee-0.7.22 → webbee-0.7.23}/tests/test_urlopen.py +0 -0
  201. {webbee-0.7.22 → webbee-0.7.23}/tests/test_version.py +0 -0
  202. {webbee-0.7.22 → webbee-0.7.23}/tests/test_version_badge_corner.py +0 -0
  203. {webbee-0.7.22 → webbee-0.7.23}/tests/test_voice_outcome.py +0 -0
  204. {webbee-0.7.22 → webbee-0.7.23}/tests/test_wallet.py +0 -0
  205. {webbee-0.7.22 → webbee-0.7.23}/tests/test_worktrees.py +0 -0
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.23
4
+
5
+ * The terminal writes down where it stands when it stops answering. A watch outside its event loop notes two facts -
6
+ the loop has not turned for 15 s, or one stage of a turn (running a tool, posting its result) has lasted 300 s -
7
+ and then writes every thread's stack once to `~/.cache/webbee/stalls/stall-<time>-<pid>.txt` and says so in the
8
+ terminal. `kill -USR1 <pid>` writes the same file on demand. Nothing is sent anywhere.
9
+
3
10
  ## 0.7.22
4
11
 
5
12
  * Signing out by itself is closed in the shell (imperal-mcp 0.9.22, raised here): one token refresh at a time on a
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: webbee
3
- Version: 0.7.22
3
+ Version: 0.7.23
4
4
  Summary: Webbee 🐝 — the Imperal Cloud coding agent in your terminal
5
5
  Project-URL: Homepage, https://imperal.io/webbee-code
6
6
  Project-URL: Documentation, https://docs.imperal.io
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "webbee"
3
- version = "0.7.22"
3
+ version = "0.7.23"
4
4
  description = "Webbee 🐝 — the Imperal Cloud coding agent in your terminal"
5
5
  readme = "README.md"
6
6
  license = "GPL-3.0-or-later"
@@ -0,0 +1 @@
1
+ __version__ = "0.7.23"
@@ -574,6 +574,13 @@ class AgentSession:
574
574
  if line:
575
575
  _loop.call_soon_threadsafe(_live, line)
576
576
  executor.on_output = _heard
577
+ # where the terminal stands when it stops answering is written down by the terminal itself (stallwatch)
578
+ from webbee import stallwatch as _sw
579
+
580
+ def _stalled(path: str, why: str, _loop=loop, _note=getattr(sink, "note", None)) -> None:
581
+ if _note is not None:
582
+ _loop.call_soon_threadsafe(_note, f"⚠ the terminal stalled: {why} — the stacks are in {path}")
583
+ _sw.ensure(loop, on_stall=_stalled)
577
584
  _last_own = loop.time() # M7: the turn's own last activity
578
585
  _quiet_noted = False
579
586
  _held_final = "" # the newest answer of a marathon turn, shown if a stop follows it
@@ -693,6 +700,7 @@ class AgentSession:
693
700
  pass
694
701
  if tool in _WRITE_TIER:
695
702
  await asyncio.to_thread(store.mark_started, rid, tool)
703
+ _sw.mark(f"tool {tool}")
696
704
  try:
697
705
  out = await asyncio.to_thread(handle_tool_request, frame, executor)
698
706
  except asyncio.CancelledError:
@@ -700,6 +708,8 @@ class AgentSession:
700
708
  # kill the command it runs, then let the cancel through.
701
709
  _cancel_running(executor)
702
710
  raise
711
+ finally:
712
+ _sw.mark("")
703
713
  out = _cap_result(out)
704
714
  # H6: written BEFORE the post -- a crash after this line
705
715
  # re-sends the result instead of running the tool again.
@@ -728,7 +738,11 @@ class AgentSession:
728
738
  except Exception:
729
739
  pass
730
740
  _remember(seen, rid, out)
731
- await self._post_result(client, session_id, out, sink=sink, tool=tool)
741
+ _sw.mark(f"post the result of {tool}")
742
+ try:
743
+ await self._post_result(client, session_id, out, sink=sink, tool=tool)
744
+ finally:
745
+ _sw.mark("")
732
746
  _last_own, _quiet_noted = loop.time(), False
733
747
 
734
748
  elif ftype == "confirm_request":
@@ -0,0 +1,123 @@
1
+ """Where the terminal stands when it stops answering -- written down by the terminal itself.
2
+
3
+ Live 2026-11-26/27, five times in one day on one machine: the kernel sent a command, the terminal never answered and
4
+ never said why; the connection stayed open. From the outside nothing tells where the client stood -- its event loop
5
+ blocked, a tool that never returned, a result that could not be posted. So the client says it: a thread outside the
6
+ loop watches two facts and, when one of them holds too long, writes every thread's stack to a file once.
7
+
8
+ * the LOOP does not turn: a callback handed to it is not run within ``LOOP_S``;
9
+ * a STAGE lasts too long: the turn said what it is doing (``mark("tool bash")``, ``mark("post result")``) and has
10
+ not said anything else for ``STAGE_S``.
11
+
12
+ The file is ``~/.cache/webbee/stalls/stall-<time>.txt``: the stage, how long, the version, the stacks. Nothing is
13
+ sent anywhere; the person (or `webbee doctor`) reads it. ``SIGUSR1`` writes the same file on demand where the
14
+ platform has it. Python 3.7 syntax; never raises into the client."""
15
+ import faulthandler
16
+ import os
17
+ import sys
18
+ import threading
19
+ import time
20
+
21
+ LOOP_S = 15.0 # a blocked loop is a frozen terminal: said after this long
22
+ STAGE_S = 300.0 # a tool of five minutes is long but real; the stack then shows what it waits on
23
+ TICK_S = 1.0
24
+ KEPT = 20 # stall files kept (newest)
25
+
26
+ _state = {"stage": "", "since": 0.0, "beat": 0.0, "started": False, "dir": ""}
27
+ _lock = threading.Lock()
28
+
29
+
30
+ def stalls_dir() -> str:
31
+ return _state["dir"] or os.path.join(os.path.expanduser("~"), ".cache", "webbee", "stalls")
32
+
33
+
34
+ def mark(stage: str = "") -> None:
35
+ """What the turn is doing now ("" -- nothing that can stall: it is reading the stream)."""
36
+ with _lock:
37
+ _state["stage"], _state["since"] = str(stage or ""), time.monotonic()
38
+
39
+
40
+ def _version() -> str:
41
+ try:
42
+ from webbee import __version__
43
+ return str(__version__)
44
+ except Exception:
45
+ return "?"
46
+
47
+
48
+ def dump(why: str, directory: str = "") -> str:
49
+ """Write every thread's stack to a new file; its path, or "" when it could not be written."""
50
+ try:
51
+ d = directory or stalls_dir()
52
+ os.makedirs(d, exist_ok=True)
53
+ path = os.path.join(d, "stall-%s-%d.txt" % (time.strftime("%Y%m%d-%H%M%S"), os.getpid()))
54
+ with open(path, "w") as f:
55
+ f.write("webbee %s python %s pid %d\n%s\nthreads:\n" % (
56
+ _version(), sys.version.split()[0], os.getpid(), why))
57
+ f.flush()
58
+ faulthandler.dump_traceback(file=f, all_threads=True)
59
+ old = sorted(n for n in os.listdir(d) if n.startswith("stall-"))[:-KEPT]
60
+ for n in old:
61
+ try:
62
+ os.unlink(os.path.join(d, n))
63
+ except OSError:
64
+ pass
65
+ return path
66
+ except Exception:
67
+ return ""
68
+
69
+
70
+ def verdict(now: float, beat: float, stage: str, since: float, loop_s: float = LOOP_S, stage_s: float = STAGE_S) -> str:
71
+ """PURE. Why the client is stalled at ``now``, or "" while it is not."""
72
+ if now - beat >= loop_s:
73
+ return "the event loop has not turned for %.0f s (stage: %s)" % (now - beat, stage or "reading the stream")
74
+ if stage and now - since >= stage_s:
75
+ return "the stage '%s' has lasted %.0f s" % (stage, now - since)
76
+ return ""
77
+
78
+
79
+ def ensure(loop, on_stall=None, loop_s: float = LOOP_S, stage_s: float = STAGE_S, tick: float = TICK_S,
80
+ directory: str = "") -> bool:
81
+ """Start the watch for this process once. ``on_stall(path, why)`` is called from the watch thread after a file
82
+ was written (a surface may show a note). False when it was already running."""
83
+ with _lock:
84
+ if _state["started"]:
85
+ return False
86
+ _state["started"], _state["beat"], _state["dir"] = True, time.monotonic(), directory
87
+
88
+ def pong() -> None:
89
+ _state["beat"] = time.monotonic()
90
+
91
+ def watch() -> None:
92
+ said = ""
93
+ while True:
94
+ time.sleep(tick)
95
+ try:
96
+ if loop.is_closed():
97
+ return
98
+ loop.call_soon_threadsafe(pong)
99
+ except Exception:
100
+ return
101
+ with _lock:
102
+ stage, since = _state["stage"], _state["since"]
103
+ why = verdict(time.monotonic(), _state["beat"], stage, since, loop_s, stage_s)
104
+ key = why.split(" for ")[0].split(" has lasted ")[0] # one file per stall, not one a second
105
+ if why and key != said:
106
+ said = key
107
+ path = dump(why, directory)
108
+ if path and on_stall is not None:
109
+ try:
110
+ on_stall(path, why)
111
+ except Exception:
112
+ pass
113
+ elif not why:
114
+ said = ""
115
+
116
+ threading.Thread(target=watch, name="webbee-stall-watch", daemon=True).start()
117
+ try: # on demand, where the platform has the signal
118
+ import signal
119
+ if hasattr(signal, "SIGUSR1"):
120
+ signal.signal(signal.SIGUSR1, lambda *_: dump("asked for by SIGUSR1 (stage: %s)" % (_state["stage"] or "-")))
121
+ except Exception:
122
+ pass
123
+ return True
@@ -0,0 +1,79 @@
1
+ """The terminal writes down where it stands when it stops answering (2026-11-27).
2
+
3
+ Five times in one day the kernel sent a command and the terminal never answered; nothing told where it stood. A
4
+ thread outside the event loop watches whether the loop turns and how long the turn's stage has lasted, and writes
5
+ every thread's stack to a file once per stall."""
6
+ import asyncio
7
+ import os
8
+ import threading
9
+ import time
10
+
11
+ from webbee import stallwatch as sw
12
+
13
+
14
+ def test_the_verdict_is_a_fact_of_two_clocks():
15
+ assert sw.verdict(100.0, 99.0, "", 0.0) == "" # the loop turns, no stage
16
+ assert sw.verdict(100.0, 99.0, "tool bash", 90.0) == "" # a stage of ten seconds
17
+ assert "event loop has not turned for 20 s" in sw.verdict(100.0, 80.0, "", 0.0)
18
+ assert "reading the stream" in sw.verdict(100.0, 80.0, "", 0.0)
19
+ assert sw.verdict(1000.0, 999.5, "tool bash", 600.0) == "the stage \'tool bash\' has lasted 400 s"
20
+ assert "tool bash" in sw.verdict(1000.0, 900.0, "tool bash", 990.0) # a blocked loop names its stage
21
+
22
+
23
+ def test_a_dump_names_the_reason_and_every_thread(tmp_path):
24
+ hold = threading.Event()
25
+ t = threading.Thread(target=hold.wait, name="a-waiting-thread", daemon=True)
26
+ t.start()
27
+ try:
28
+ path = sw.dump("the stage \'tool bash\' has lasted 400 s", str(tmp_path))
29
+ finally:
30
+ hold.set()
31
+ text = open(path).read()
32
+ assert path.startswith(str(tmp_path)) and os.path.basename(path).startswith("stall-")
33
+ assert "tool bash" in text and "webbee " in text and "threads:" in text
34
+ assert text.count("Thread 0x") + text.count("Current thread") >= 2 and "wait" in text
35
+
36
+
37
+ def test_only_the_newest_files_are_kept(tmp_path):
38
+ for i in range(sw.KEPT + 5):
39
+ open(os.path.join(str(tmp_path), "stall-20260101-0000%02d-1.txt" % i), "w").close()
40
+ sw.dump("x", str(tmp_path))
41
+ assert len(os.listdir(str(tmp_path))) == sw.KEPT
42
+
43
+
44
+ def test_a_blocked_loop_is_written_down_once_and_a_running_one_never(tmp_path, monkeypatch):
45
+ monkeypatch.setitem(sw._state, "started", False)
46
+ said = []
47
+
48
+ async def main():
49
+ loop = asyncio.get_running_loop()
50
+ assert sw.ensure(loop, on_stall=lambda path, why: said.append((path, why)),
51
+ loop_s=0.3, stage_s=60.0, tick=0.05, directory=str(tmp_path)) is True
52
+ assert sw.ensure(loop) is False # one watch a process
53
+ await asyncio.sleep(0.5) # the loop turns: nothing is written
54
+ assert said == []
55
+ sw.mark("tool bash")
56
+ time.sleep(0.9) # the loop is BLOCKED (a sync wait on it)
57
+ sw.mark("")
58
+ await asyncio.sleep(0.2)
59
+
60
+ asyncio.run(main())
61
+ assert len(said) == 1 and "event loop has not turned" in said[0][1] and "tool bash" in said[0][1]
62
+ text = open(said[0][0]).read() # the stack names the place that blocks the loop
63
+ assert " in main" in text and "test_stallwatch.py" in text and "webbee-stall-watch" not in said[0][1]
64
+
65
+
66
+ def test_a_stage_that_lasts_too_long_is_written_down_while_the_loop_turns(tmp_path, monkeypatch):
67
+ monkeypatch.setitem(sw._state, "started", False)
68
+ said = []
69
+
70
+ async def main():
71
+ sw.ensure(asyncio.get_running_loop(), on_stall=lambda path, why: said.append(why),
72
+ loop_s=60.0, stage_s=0.3, tick=0.05, directory=str(tmp_path))
73
+ sw.mark("tool read_file")
74
+ await asyncio.sleep(0.8) # the loop turns, the stage does not end
75
+ sw.mark("")
76
+ await asyncio.sleep(0.2)
77
+
78
+ asyncio.run(main())
79
+ assert len(said) == 1 and said[0].startswith("the stage \'tool read_file\' has lasted")
@@ -1505,7 +1505,7 @@ wheels = [
1505
1505
 
1506
1506
  [[package]]
1507
1507
  name = "webbee"
1508
- version = "0.7.22"
1508
+ version = "0.7.23"
1509
1509
  source = { editable = "." }
1510
1510
  dependencies = [
1511
1511
  { name = "asyncssh", marker = "python_full_version >= '3.10'" },
@@ -1 +0,0 @@
1
- __version__ = "0.7.22"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes