brainlayer 1.5.67__tar.gz → 1.5.69__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 (264) hide show
  1. {brainlayer-1.5.67 → brainlayer-1.5.69}/.gitignore +1 -0
  2. {brainlayer-1.5.67 → brainlayer-1.5.69}/PKG-INFO +1 -1
  3. {brainlayer-1.5.67 → brainlayer-1.5.69}/pyproject.toml +5 -1
  4. {brainlayer-1.5.67 → brainlayer-1.5.69}/server.json +2 -2
  5. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/__init__.py +1 -1
  6. brainlayer-1.5.69/src/brainlayer/_build.py +1 -0
  7. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/ingest/t3.py +3 -3
  8. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/job_lifecycle_health.py +31 -7
  9. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/maintenance_calendar.py +136 -90
  10. brainlayer-1.5.67/src/brainlayer/_build.py +0 -1
  11. {brainlayer-1.5.67 → brainlayer-1.5.69}/LICENSE +0 -0
  12. {brainlayer-1.5.67 → brainlayer-1.5.69}/README.md +0 -0
  13. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/hotlane_brainbar_daemon.py +0 -0
  14. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/backup-daily.sh +0 -0
  15. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/brainlayer-env-run.sh +0 -0
  16. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/brainlayer.env.example +0 -0
  17. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.backup-daily.plist +0 -0
  18. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.daemon.plist +0 -0
  19. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.decay.plist +0 -0
  20. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.drain.plist +0 -0
  21. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.health-check.plist +0 -0
  22. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.hotlane-brainbar.plist +0 -0
  23. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.index.plist +0 -0
  24. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.jsonl-backup.plist +0 -0
  25. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.log-cap.plist +0 -0
  26. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.maintenance-nightly.plist +0 -0
  27. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.maintenance-weekly.plist +0 -0
  28. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.maintenance.plist +0 -0
  29. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.observability.plist +0 -0
  30. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.p0-counter.plist +0 -0
  31. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.repair-fts.plist +0 -0
  32. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.t3-ingest.plist +0 -0
  33. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.throughput-watchdog.plist +0 -0
  34. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.tier0-watchdog.plist +0 -0
  35. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.wal-checkpoint.plist +0 -0
  36. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.brainlayer.watch.plist +0 -0
  37. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/com.etanhey.brainlayer-fleet-watchdog.plist +0 -0
  38. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/fleet-watchdog.sh +0 -0
  39. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/install.sh +0 -0
  40. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/jsonl-backup.sh +0 -0
  41. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/launchd/throughput-watchdog.py +0 -0
  42. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/release-verify-signatures.sh +0 -0
  43. {brainlayer-1.5.67 → brainlayer-1.5.69}/scripts/tier0-watchdog.sh +0 -0
  44. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/__main__.py +0 -0
  45. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/_helpers.py +0 -0
  46. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/agent_profiles.py +0 -0
  47. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/agent_provenance.py +0 -0
  48. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/alarm.py +0 -0
  49. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/archive_collapse.py +0 -0
  50. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/archive_lifecycle.py +0 -0
  51. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/backup_daily.py +0 -0
  52. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/backup_retention_invariant.py +0 -0
  53. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/badge_state.py +0 -0
  54. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/bitemporal.py +0 -0
  55. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/brainbar_activation.py +0 -0
  56. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/brainbar_auto_activation.py +0 -0
  57. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/brainbar_hybrid_helper.py +0 -0
  58. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/brainbar_identity.py +0 -0
  59. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/cachedelete_purge.swift +0 -0
  60. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/calibrate.py +0 -0
  61. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/chunk_origin.py +0 -0
  62. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/chunk_origin_backfill.py +0 -0
  63. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/chunk_origin_wipe.py +0 -0
  64. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/chunk_write.py +0 -0
  65. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/classify.py +0 -0
  66. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/claude_paths.py +0 -0
  67. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/cli/__init__.py +0 -0
  68. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/cli/wizard.py +0 -0
  69. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/cli_jobs.py +0 -0
  70. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/cli_new.py +0 -0
  71. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/cloud_backfill.py +0 -0
  72. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/clustering.py +0 -0
  73. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/component_jobs.py +0 -0
  74. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/config.py +0 -0
  75. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/consolidation_plan.py +0 -0
  76. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/content_class.py +0 -0
  77. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/correction_judge.py +0 -0
  78. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/data/agents_registry.yaml +0 -0
  79. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/data/sandbox_seeds/skill-eval-baseline.json +0 -0
  80. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/db_shrink.py +0 -0
  81. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/decay.py +0 -0
  82. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/decay_backfill.py +0 -0
  83. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/decay_job.py +0 -0
  84. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/dedupe.py +0 -0
  85. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/dedupe_merge.py +0 -0
  86. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/deploy_drift.py +0 -0
  87. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/doctor.py +0 -0
  88. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/drain.py +0 -0
  89. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/drain_liveness.py +0 -0
  90. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/drive_credentials.py +0 -0
  91. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/embeddings.py +0 -0
  92. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/engine.py +0 -0
  93. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/enrichment_replay.py +0 -0
  94. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/__init__.py +0 -0
  95. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/abcde_enrich_runner.py +0 -0
  96. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/abcde_variants.py +0 -0
  97. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/abcde_variants.yaml +0 -0
  98. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/benchmark.py +0 -0
  99. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/enrichment_gold.py +0 -0
  100. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/enrichment_graders.py +0 -0
  101. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/enrichment_judge.py +0 -0
  102. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/enrichment_llm_judge.py +0 -0
  103. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/enrichment_quality_benchmark.py +0 -0
  104. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/experiment_store.py +0 -0
  105. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/fixtures/README.md +0 -0
  106. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/labeling/enrichment-labeler.html +0 -0
  107. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/__init__.py +0 -0
  108. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/__main__.py +0 -0
  109. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/baseline_store.py +0 -0
  110. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/cli.py +0 -0
  111. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/models.py +0 -0
  112. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/phoenix_client.py +0 -0
  113. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/regression_gate.py +0 -0
  114. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/phoenix_gate/triggers.py +0 -0
  115. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/eval/pilot_artifact_report.py +0 -0
  116. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/fallback_replay.py +0 -0
  117. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/git_learning.py +0 -0
  118. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/health_check.py +0 -0
  119. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/hook_python.py +0 -0
  120. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/hooks/__init__.py +0 -0
  121. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/hooks/indexer.py +0 -0
  122. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/import_sweep.py +0 -0
  123. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/index_admission.py +0 -0
  124. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/index_budget.py +0 -0
  125. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/index_completeness.py +0 -0
  126. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/index_new.py +0 -0
  127. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/index_watchdog.py +0 -0
  128. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/ingest/__init__.py +0 -0
  129. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/ingest/codex.py +0 -0
  130. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/ingest_denylist.py +0 -0
  131. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/ingest_guard.py +0 -0
  132. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/isolation_proof.py +0 -0
  133. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/job_alerts.py +0 -0
  134. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/jobs.py +0 -0
  135. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/jsonl_backup.py +0 -0
  136. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg/__init__.py +0 -0
  137. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg_cleanup.py +0 -0
  138. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg_judge.py +0 -0
  139. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg_promotion.py +0 -0
  140. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg_repo.py +0 -0
  141. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg_review_session.py +0 -0
  142. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg_session_finish.py +0 -0
  143. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/kg_session_harvest.py +0 -0
  144. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/launchd_consolidation.py +0 -0
  145. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/launchd_install.py +0 -0
  146. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/launchd_primitive.py +0 -0
  147. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/launchd_revert.py +0 -0
  148. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/lexical_defense.py +0 -0
  149. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/lexical_defense_dictionary.json +0 -0
  150. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/log_cap.py +0 -0
  151. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/maintenance.py +0 -0
  152. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/maintenance_control.py +0 -0
  153. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/__init__.py +0 -0
  154. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/_format.py +0 -0
  155. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/_shared.py +0 -0
  156. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/enrich_handler.py +0 -0
  157. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/entity_handler.py +0 -0
  158. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/palette.py +0 -0
  159. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/search_handler.py +0 -0
  160. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/store_handler.py +0 -0
  161. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp/tags_handler.py +0 -0
  162. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp_socket_config.py +0 -0
  163. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/mcp_stdio_bridge.py +0 -0
  164. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/memory_types.py +0 -0
  165. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/migrate.py +0 -0
  166. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/migration_custody.py +0 -0
  167. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/migration_journal.py +0 -0
  168. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/migration_runtime.py +0 -0
  169. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/notification_policy.py +0 -0
  170. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/observability_backup.py +0 -0
  171. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/observability_surface.py +0 -0
  172. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/observability_transport.py +0 -0
  173. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/p0_longitudinal_count.py +0 -0
  174. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/parent_death.py +0 -0
  175. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/paths.py +0 -0
  176. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pause.py +0 -0
  177. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/phonetic.py +0 -0
  178. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/__init__.py +0 -0
  179. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/agent_enrichment.py +0 -0
  180. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/analyze_communication.py +0 -0
  181. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/batch_extraction.py +0 -0
  182. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/brain_graph.py +0 -0
  183. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/chat_tags.py +0 -0
  184. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/chunk.py +0 -0
  185. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/classify.py +0 -0
  186. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/cloud_scrub.py +0 -0
  187. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/cluster_sampling.py +0 -0
  188. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/code_intelligence.py +0 -0
  189. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/correction_detection.py +0 -0
  190. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/correction_mining.py +0 -0
  191. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/digest.py +0 -0
  192. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/enrichment_prompts.py +0 -0
  193. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/enrichment_results.py +0 -0
  194. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/enrichment_tiers.py +0 -0
  195. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/entity_extraction.py +0 -0
  196. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/entity_resolution.py +0 -0
  197. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/extract.py +0 -0
  198. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/extract_claude_desktop.py +0 -0
  199. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/extract_corrections.py +0 -0
  200. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/extract_markdown.py +0 -0
  201. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/extract_whatsapp.py +0 -0
  202. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/frustration_mining.py +0 -0
  203. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/git_overlay.py +0 -0
  204. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/kg_extraction.py +0 -0
  205. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/kg_extraction_groq.py +0 -0
  206. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/longitudinal_analyzer.py +0 -0
  207. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/obsidian_export.py +0 -0
  208. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/operation_grouping.py +0 -0
  209. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/plan_linking.py +0 -0
  210. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/rate_limiter.py +0 -0
  211. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/relation_backfill.py +0 -0
  212. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/relation_verification.py +0 -0
  213. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/sanitize.py +0 -0
  214. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/secret_scrub.py +0 -0
  215. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/semantic_style.py +0 -0
  216. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/sentiment.py +0 -0
  217. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/session_history.py +0 -0
  218. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/style_embed.py +0 -0
  219. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/style_index.py +0 -0
  220. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/tag_entity_promotion.py +0 -0
  221. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/temporal_chains.py +0 -0
  222. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/time_batcher.py +0 -0
  223. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/unified_timeline.py +0 -0
  224. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/pipeline/write_queue.py +0 -0
  225. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/provenance.py +0 -0
  226. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/provenance_autosupersede.py +0 -0
  227. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/provenance_integration.py +0 -0
  228. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/queue_io.py +0 -0
  229. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/queue_merge.py +0 -0
  230. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/reembed_backfill.py +0 -0
  231. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/retired_services.py +0 -0
  232. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/runtime_store.py +0 -0
  233. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/sandbox_db.py +0 -0
  234. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/scoping.py +0 -0
  235. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/scrub_at_rest.py +0 -0
  236. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/search_fanout.py +0 -0
  237. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/search_profile.py +0 -0
  238. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/search_repo.py +0 -0
  239. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/service_supervisor.py +0 -0
  240. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/session_repo.py +0 -0
  241. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/setup.py +0 -0
  242. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/socket_hygiene.py +0 -0
  243. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/source_class_migration.py +0 -0
  244. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/spotlight.py +0 -0
  245. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/storage.py +0 -0
  246. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/store.py +0 -0
  247. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/supervisor_adapters.py +0 -0
  248. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/supervisor_child.py +0 -0
  249. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/supervisor_guard.py +0 -0
  250. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/supervisor_jobs.py +0 -0
  251. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/system_prompt_guard.py +0 -0
  252. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/t3_linkage_alarm.py +0 -0
  253. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/t3_provenance.py +0 -0
  254. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/t3_sources.py +0 -0
  255. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/tag_normalization.py +0 -0
  256. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/taxonomy.json +0 -0
  257. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/telemetry.py +0 -0
  258. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/timestamp_iso.py +0 -0
  259. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/types.py +0 -0
  260. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/vector_store.py +0 -0
  261. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/wal_checkpoint.py +0 -0
  262. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/watcher.py +0 -0
  263. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/watcher_bridge.py +0 -0
  264. {brainlayer-1.5.67 → brainlayer-1.5.69}/src/brainlayer/writer_telemetry.py +0 -0
@@ -8,6 +8,7 @@ venv/
8
8
  env/
9
9
 
10
10
  # Build
11
+ .build.noindex/
11
12
  dist/
12
13
  # Release build-sha stamp (written by publish.yml, shipped in the wheel, never committed)
13
14
  src/brainlayer/_build.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: brainlayer
3
- Version: 1.5.67
3
+ Version: 1.5.69
4
4
  Summary: Persistent local memory for AI agents — 16 BrainBar MCP tools, semantic search, knowledge graph, SQLite
5
5
  Project-URL: Homepage, https://brainlayer.etanheyman.com
6
6
  Project-URL: Repository, https://github.com/EtanHey/brainlayer
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "brainlayer"
3
- version = "1.5.67"
3
+ version = "1.5.69"
4
4
  description = "Persistent local memory for AI agents — 16 BrainBar MCP tools, semantic search, knowledge graph, SQLite"
5
5
  license = {text = "Apache-2.0"}
6
6
  readme = "README.md"
@@ -117,7 +117,11 @@ per-file-ignores = {"src/brainlayer/cli/__init__.py" = ["F401"]}
117
117
  [tool.pytest.ini_options]
118
118
  asyncio_mode = "auto"
119
119
  pythonpath = ["src"]
120
+ testpaths = ["tests"]
121
+ # Keep pytest's default exclusions as well as the worktree-owned build output boundary.
122
+ norecursedirs = ["*.egg", ".*", "_darcs", "build", "CVS", "dist", "node_modules", "venv", "{arch}", ".build.noindex"]
120
123
  # Keep temp trees only for failed tests: passing full-suite runs left 40+ GiB basetemps (2026-10-19).
124
+ # tests/conftest.py routes default and explicit basetemps beneath <worktree>/.build.noindex/pytest/ before fixtures start.
121
125
  tmp_path_retention_policy = "failed"
122
126
  markers = [
123
127
  "crash_sweep: exhaustive migration/revert SIGKILL cuts (separate required CI gate; retained by local pre-push)",
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.etanhey/brainlayer",
4
4
  "title": "BrainLayer",
5
5
  "description": "Persistent local memory for AI agents \u2014 semantic search, knowledge graph, and 16 BrainBar MCP tools with ToolAnnotations over SQLite.",
6
- "version": "1.5.67",
6
+ "version": "1.5.69",
7
7
  "websiteUrl": "https://brainlayer.etanheyman.com",
8
8
  "repository": {
9
9
  "url": "https://github.com/EtanHey/brainlayer",
@@ -14,7 +14,7 @@
14
14
  "registryType": "pypi",
15
15
  "registryBaseUrl": "https://pypi.org",
16
16
  "identifier": "brainlayer",
17
- "version": "1.5.67",
17
+ "version": "1.5.69",
18
18
  "runtimeHint": "pipx",
19
19
  "transport": {
20
20
  "type": "stdio"
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- __version__ = "1.5.67"
5
+ __version__ = "1.5.69"
6
6
  # Git sha the distributed package was built from; stamped by the release build, None in a source tree.
7
7
  # scripts/sprint_gate.py reads it in "keg" mode to prove the served package is the code under test.
8
8
  # No runtime `str | None` annotation: launchd/install.sh imports this under /usr/bin/python3 (3.9).
@@ -0,0 +1 @@
1
+ BUILD_SHA = "4d24dad7392232dcdfc27401b65406d444af85d9"
@@ -159,7 +159,7 @@ class T3Reader:
159
159
  self._fail(
160
160
  "t3_schema_drift",
161
161
  "T3 schema changed while the reader was taking its snapshot",
162
- {"sqlite_error": str(error)},
162
+ {"sqlite_error": _scrubbed_error_text(error)[:500]},
163
163
  error,
164
164
  )
165
165
  self._fail(
@@ -341,7 +341,7 @@ class T3Reader:
341
341
  "code": code,
342
342
  "message": message,
343
343
  "error_type": type(error).__name__,
344
- "error": str(error),
344
+ "error": _scrubbed_error_text(error)[:500],
345
345
  **context,
346
346
  }
347
347
  self._failures.append(failure)
@@ -561,7 +561,7 @@ def ingest_t3(
561
561
  except BrainLayerAlarm as exc:
562
562
  failed_path = exc.context["state_db_path"]
563
563
  failed_reader = T3Reader(failed_path, health_path=health_path, projection_version=1)
564
- failed_reader._failures.append({"code": exc.code, "message": str(exc)})
564
+ failed_reader._failures.append({"code": exc.code, "message": _scrubbed_error_text(exc)[:500]})
565
565
  failed_reader._write_health(alerting=True, alert_reasons=["source_selection_failure"])
566
566
  raise
567
567
  reader = T3Reader(sources[0][0], health_path=health_path, projection_version=sources[0][1])
@@ -141,11 +141,28 @@ def _failure(
141
141
  return None, last_exit
142
142
 
143
143
 
144
+ NIGHTLY_LABELS = frozenset({"com.brainlayer.maintenance"})
145
+
146
+
147
+ def _escalation(label: str, episode: dict[str, Any]) -> str:
148
+ exit_code = episode.get("last_exit_code", "unknown")
149
+ count = episode.get("consecutive")
150
+ if episode.get("interval") and type(count) is int:
151
+ if label in NIGHTLY_LABELS:
152
+ # Once a night is not a crashloop; the daemon-oriented reason would repeat the exit.
153
+ return f"{label}: failed {count} nights in a row; last exit {exit_code}"
154
+ failures = f"{count} failed runs"
155
+ else:
156
+ # Pre-fix persisted interval episodes carry no count; failed_heals implies the threshold.
157
+ failures = f"{MAX_HEAL_ATTEMPTS} " + (
158
+ "failed runs" if episode.get("interval") else "heal attempts failed to restore a healthy job"
159
+ )
160
+ return f"{label}: {episode.get('reason', 'job unavailable')}; last exit code {exit_code}; {failures}"
161
+
162
+
144
163
  def _escalations(state: dict[str, dict[str, Any]]) -> list[str]:
145
164
  return [
146
- f"{label}: {episode.get('reason', 'job unavailable')}; last exit code "
147
- f"{episode.get('last_exit_code', 'unknown')}; {MAX_HEAL_ATTEMPTS} "
148
- f"{'failed runs' if episode.get('interval') else 'heal attempts failed to restore a healthy job'}"
165
+ _escalation(label, episode)
149
166
  for label, episode in state.items()
150
167
  if isinstance(episode, dict) and episode.get("failed_heals")
151
168
  ]
@@ -213,7 +230,6 @@ def scan_job_lifecycle(
213
230
  interval = "StartInterval" in plist or "StartCalendarInterval" in plist
214
231
  prior = previous_state.get(label, {})
215
232
  prior_runs = prior.get("runs")
216
- advanced = prior_runs is not None and runs > prior_runs
217
233
  reason, last_exit = _failure(
218
234
  _output(printed),
219
235
  current_keg,
@@ -223,15 +239,23 @@ def scan_job_lifecycle(
223
239
  if label == "com.brainlayer.daemon"
224
240
  else None,
225
241
  )
242
+ if interval and _pid(_output(printed)) is not None:
243
+ # The live invocation has no exit yet; last_exit belongs to runs - 1.
244
+ # Consume that completion only once, independently of the live PID's keg.
245
+ if prior_runs is None:
246
+ state[label] = {**prior, "runs": max(0, runs - 1)}
247
+ continue
248
+ if runs <= prior_runs + 1:
249
+ continue
250
+ runs -= 1
251
+ reason = None
252
+ advanced = prior_runs is not None and runs > prior_runs
226
253
  if reason and reason.startswith("keg mapping unavailable"):
227
254
  if interval:
228
255
  continue # A running interval script may not have loaded a keg library yet.
229
256
  # Preserve this uncertain episode without healing it; known jobs still progress.
230
257
  scan_errors.append(f"{label}: {reason}")
231
258
  continue
232
- if interval and reason and reason.startswith("stale keg"):
233
- # Defer counting until launchd reports a completed, advanced run.
234
- continue
235
259
  if reason is None and advanced and last_exit not in (None, 0):
236
260
  reason = f"crashloop, last exit code {last_exit}"
237
261
  if reason is None and (last_exit in (None, 0) or (not interval and not advanced)):
@@ -9,6 +9,7 @@ import signal
9
9
  import time
10
10
  from contextlib import asynccontextmanager
11
11
  from dataclasses import dataclass, field, replace
12
+ from functools import partial
12
13
  from pathlib import Path
13
14
 
14
15
  from . import maintenance_control
@@ -244,7 +245,7 @@ async def _execute_step(
244
245
  if child is not None:
245
246
  deadline = time.monotonic() + shutdown_timeout
246
247
  try:
247
- os.write(guard.stdin.fileno(), b"Q\n" if stop.is_set() else b"H\n")
248
+ os.write(guard.stdin.fileno(), b"H\n") # Guard shutdown follows the finish worker.
248
249
  except BrokenPipeError:
249
250
  stop.set()
250
251
  await stop_group(child, 0.2, lambda: (deadline, shutdown_timeout / 2))
@@ -267,6 +268,7 @@ def finish(directory, state, step, code, date, defer_after, missed=False, stoppe
267
268
  detail = {key: value for key, value in dict(reason=reason, replaces=replaces).items() if value is not None}
268
269
  record(directory, event="finished", step=step.name, status=status, returncode=code, **detail)
269
270
  key = KEYS.get(step.name)
271
+ notice = None
270
272
  if key and not stopped:
271
273
  if code == 75:
272
274
  prior = state["deferrals"].get(key, {})
@@ -274,11 +276,32 @@ def finish(directory, state, step, code, date, defer_after, missed=False, stoppe
274
276
  count = prior.get("count", 0) + 1 if gap == 1 else max(1, prior.get("count", 0)) if gap == 0 else 1
275
277
  state["deferrals"][key] = dict(date=date.isoformat(), count=count)
276
278
  if missed or count >= defer_after:
277
- report(key, f"BrainLayer {step.name}: quiet window missed" if missed else f"Deferred {count} nights")
279
+ notice = (key, f"BrainLayer {step.name}: quiet window missed" if missed else f"Deferred {count} nights")
278
280
  else:
279
281
  state["deferrals"].pop(key, None)
280
- report(key, None if code == 0 else f"BrainLayer {step.name} exited {code}; see its log")
282
+ notice = (key, None if code == 0 else f"BrainLayer {step.name} exited {code}; see its log")
281
283
  _atomic_write(directory / "state.json", state)
284
+ if notice is not None:
285
+ try:
286
+ report(*notice)
287
+ except OSError as exc:
288
+ # An alert-file failure does not undo a completed step or imply lost custody.
289
+ record(directory, event="alert-error", step=step.name, error=type(exc).__name__)
290
+ return status
291
+
292
+
293
+ async def _finish_step(*args, **kwargs):
294
+ # Shield the executor future itself so repeated cancellation cannot abandon state writes.
295
+ worker = asyncio.get_running_loop().run_in_executor(None, partial(finish, *args, **kwargs))
296
+ cancelled = None
297
+ while True:
298
+ try:
299
+ status = await asyncio.shield(worker)
300
+ break
301
+ except asyncio.CancelledError as exc:
302
+ cancelled = exc
303
+ if cancelled is not None:
304
+ raise cancelled
282
305
  return status
283
306
 
284
307
 
@@ -326,8 +349,9 @@ async def run_calendar(
326
349
  except BlockingIOError:
327
350
  record(directory, event="already-running", scheduled_date=date.isoformat())
328
351
  return 0
329
- stop, handlers, results = asyncio.Event(), {}, {}
352
+ stop, heartbeat_stop, handlers, results = asyncio.Event(), asyncio.Event(), {}, {}
330
353
  guard, heartbeat = None, None
354
+ active_step, runner_failed = None, 0
331
355
  loop = asyncio.get_running_loop()
332
356
  try:
333
357
  custody.recover(min(1, shutdown_timeout / 2)) # Reap stale writers before reacquiring their lease.
@@ -345,7 +369,7 @@ async def run_calendar(
345
369
  client = maintenance_control.control_client()
346
370
  logs.mkdir(parents=True, exist_ok=True)
347
371
  guard = launch_guard(custody, guard_timeout, 0.2, shutdown_timeout, lease_control=True)
348
- heartbeat = asyncio.create_task(pulse(guard, stop, min(0.1, guard_timeout / 4)))
372
+ heartbeat = asyncio.create_task(pulse(guard, heartbeat_stop, min(0.1, guard_timeout / 4)))
349
373
  record(directory, event="runner", guard=guard.pid, scheduled_date=date.isoformat())
350
374
  if install_signals:
351
375
  for sig in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP):
@@ -358,84 +382,84 @@ async def run_calendar(
358
382
  )
359
383
  env.pop("BRAINLAYER_BACKUP_SUPERVISED_CHILD", None)
360
384
  for step in steps:
385
+ active_step = step.name
361
386
  if stop.is_set():
362
387
  record(directory, event="finished", step=step.name, status="skipped", returncode=None)
363
388
  continue
364
- code, missed, reason = 1, False, None
389
+ code, missed, reason, step_failed = 1, False, None, False
365
390
  try:
391
+ bounded = step
366
392
  if step.name == "index":
367
393
  bounded = _bounded_index_step(step, now_fn(), shutdown_timeout)
368
- if bounded is None:
369
- results[step.name] = finish(
370
- directory, state, step, 75, date, defer_after, reason="maintenance-window"
371
- )
372
- continue
373
- step = bounded
374
- if step.name == "backup-snapshot":
394
+ elif step.name == "backup-snapshot":
375
395
  bounded = _bounded_snapshot_step(step, now_fn(), shutdown_timeout)
376
- if bounded is None:
377
- results[step.name] = finish(
378
- directory, state, step, 75, date, defer_after, reason="maintenance-window"
379
- )
380
- continue
381
- step = bounded
382
- disabled = client._disabled(client.request(), include_paused=False)
383
- if f"com.brainlayer.{_service_name(step)}" in disabled or "com.brainlayer.maintenance" in disabled:
384
- code, reason = 75, "disabled"
385
- elif not await _window(directory, step, now_fn, sleep_fn, stop):
386
- code, missed = (143, False) if stop.is_set() else (75, True)
387
- if missed:
388
- reason = "index-overran-window" if index_overran_window else "quiet-window-missed"
389
- elif step.name in HELD_STEPS and maintenance_control.hold_budget(now_fn()) <= 0:
390
- code, reason = 75, "maintenance-window" # Outside the window, or no bounded hold fits.
396
+ if bounded is None:
397
+ code, reason = 75, "maintenance-window"
391
398
  else:
392
- child_env = (
393
- env
394
- | step.env
395
- | dict(
396
- BRAINLAYER_LAUNCHD_SERVICE=_service_name(step),
397
- XPC_SERVICE_NAME=f"com.brainlayer.{_service_name(step)}",
399
+ step = bounded
400
+ disabled = client._disabled(client.request(), include_paused=False)
401
+ if f"com.brainlayer.{_service_name(step)}" in disabled or "com.brainlayer.maintenance" in disabled:
402
+ code, reason = 75, "disabled"
403
+ elif not await _window(directory, step, now_fn, sleep_fn, stop):
404
+ code, missed = (143, False) if stop.is_set() else (75, True)
405
+ if missed:
406
+ reason = "index-overran-window" if index_overran_window else "quiet-window-missed"
407
+ elif step.name in HELD_STEPS and maintenance_control.hold_budget(now_fn()) <= 0:
408
+ code, reason = 75, "maintenance-window" # Outside the window, or no bounded hold fits.
409
+ else:
410
+ child_env = (
411
+ env
412
+ | step.env
413
+ | dict(
414
+ BRAINLAYER_LAUNCHD_SERVICE=_service_name(step),
415
+ XPC_SERVICE_NAME=f"com.brainlayer.{_service_name(step)}",
416
+ )
398
417
  )
399
- )
400
- try:
401
- async with step_hold(client, guard, child_env, step, now_fn) as held_env:
402
- if stop.is_set():
403
- code = 143
404
- else:
405
- started = now_fn()
406
- index_log = logs / "index.out.log"
407
- index_offset = (
408
- index_log.stat().st_size if step.name == "index" and index_log.exists() else 0
409
- )
410
- code = await _execute_step(
411
- step,
412
- held_env,
413
- directory=directory,
414
- logs=logs,
415
- custody=custody,
416
- guard=guard,
417
- stop=stop,
418
- guard_timeout=guard_timeout,
419
- shutdown_timeout=shutdown_timeout,
420
- deadline=float(held_env["BRAINLAYER_MAINTENANCE_HOLD_DEADLINE"])
421
- if "BRAINLAYER_MAINTENANCE_HOLD_DEADLINE" in held_env
422
- else None,
423
- )
424
- ended = now_fn()
425
- if step.name == "index":
426
- if code == 75:
427
- reason = _index_deferral_reason(index_log, index_offset)
428
- # Only attribute the miss to indexing when its measured interval
429
- # crossed this day's window end. Backup delays get a generic reason.
430
- window_end = started.replace(hour=6, minute=0, second=0, microsecond=0)
431
- index_overran_window = started < window_end <= ended
432
- except maintenance_control.HoldWindowClosed:
433
- # The window closed between the check and the grant: defer, keep the plan going.
434
- code, reason = 75, "maintenance-window"
418
+ try:
419
+ async with step_hold(client, guard, child_env, step, now_fn) as held_env:
420
+ if stop.is_set():
421
+ code = 143
422
+ else:
423
+ started = now_fn()
424
+ index_log = logs / "index.out.log"
425
+ index_offset = (
426
+ index_log.stat().st_size if step.name == "index" and index_log.exists() else 0
427
+ )
428
+ code = await _execute_step(
429
+ step,
430
+ held_env,
431
+ directory=directory,
432
+ logs=logs,
433
+ custody=custody,
434
+ guard=guard,
435
+ stop=stop,
436
+ guard_timeout=guard_timeout,
437
+ shutdown_timeout=shutdown_timeout,
438
+ deadline=float(held_env["BRAINLAYER_MAINTENANCE_HOLD_DEADLINE"])
439
+ if "BRAINLAYER_MAINTENANCE_HOLD_DEADLINE" in held_env
440
+ else None,
441
+ )
442
+ ended = now_fn()
443
+ if step.name == "index":
444
+ if code == 75:
445
+ reason = _index_deferral_reason(index_log, index_offset)
446
+ # Only attribute the miss to indexing when its measured interval
447
+ # crossed this day's window end. Backup delays get a generic reason.
448
+ window_end = started.replace(hour=6, minute=0, second=0, microsecond=0)
449
+ index_overran_window = started < window_end <= ended
450
+ except maintenance_control.HoldWindowClosed:
451
+ # The window closed between the check and the grant: defer, keep the plan going.
452
+ code, reason = 75, "maintenance-window"
435
453
  except (OSError, RuntimeError, ValueError) as exc:
436
454
  record(directory, event="step-error", step=step.name, error=type(exc).__name__)
455
+ code = 1
456
+ step_failed = True
437
457
  stop.set() # Custody/protocol failures abort; ordinary child failures remain isolated.
438
- results[step.name] = finish(
458
+ # Receipt fsync, alert locking and osascript must not starve the guard heartbeat.
459
+ stopped = stop.is_set() and not step_failed
460
+ if code not in (0, 75) and not stopped:
461
+ results[step.name] = "failed" # Retain the child failure even if completion is cancelled.
462
+ results[step.name] = await _finish_step(
439
463
  directory,
440
464
  state,
441
465
  step,
@@ -443,33 +467,55 @@ async def run_calendar(
443
467
  date,
444
468
  defer_after,
445
469
  missed,
446
- stop.is_set(),
470
+ stopped,
447
471
  reason=reason,
448
472
  replaces="maintenance-nightly" if weekly_substitution and step.name == "maintenance-weekly" else None,
449
473
  )
474
+ active_step = None
450
475
  if all(results.get(n) == "ok" for n in ("maintenance-weekly", "decay", "repair-fts")):
451
476
  state["last_weekly"] = (date - dt.timedelta(days=(date.weekday() + 1) % 7)).isoformat()
452
477
  _atomic_write(directory / "state.json", state)
453
478
  failed = sum(v == "failed" for v in results.values())
454
- record(directory, event="summary", failed=failed, deferred=sum(v == "deferred" for v in results.values()))
455
479
  return int(failed > 0 or stop.is_set())
480
+ except Exception as exc:
481
+ if active_step is not None:
482
+ results[active_step] = "failed"
483
+ else:
484
+ runner_failed = 1
485
+ record(directory, event="runner-error", step=active_step, error=type(exc).__name__)
486
+ raise
456
487
  finally:
457
- stop.set()
458
- if heartbeat:
459
- await asyncio.gather(heartbeat, return_exceptions=True)
460
488
  try:
461
- if guard:
462
- guard.lease_channel.close() # Parent EOF is independent of pipes inherited by children.
463
- if guard and guard.poll() is None:
464
- os.write(guard.stdin.fileno(), b"Q\n")
465
- guard.stdin.close()
466
- deadline = time.monotonic() + shutdown_timeout
467
- while guard.poll() is None and time.monotonic() < deadline:
468
- await asyncio.sleep(0.02)
469
- if guard.poll() is None:
470
- raise RuntimeError("calendar guard retains unresolved custody")
489
+ stop.set()
490
+ heartbeat_stop.set() # All finish workers have exited; bounded guard shutdown can begin.
491
+ if heartbeat:
492
+ await asyncio.gather(heartbeat, return_exceptions=True)
493
+ try:
494
+ if guard:
495
+ guard.lease_channel.close() # Parent EOF is independent of pipes inherited by children.
496
+ if guard and guard.poll() is None:
497
+ os.write(guard.stdin.fileno(), b"Q\n")
498
+ guard.stdin.close()
499
+ deadline = time.monotonic() + shutdown_timeout
500
+ while guard.poll() is None and time.monotonic() < deadline:
501
+ await asyncio.sleep(0.02)
502
+ if guard.poll() is None:
503
+ raise RuntimeError("calendar guard retains unresolved custody")
504
+ finally:
505
+ for sig, previous in handlers.items():
506
+ loop.remove_signal_handler(sig)
507
+ signal.signal(sig, previous)
508
+ except Exception as exc:
509
+ runner_failed += 1
510
+ record(directory, event="runner-error", phase="cleanup", error=type(exc).__name__)
511
+ raise
471
512
  finally:
472
- for sig, previous in handlers.items():
473
- loop.remove_signal_handler(sig)
474
- signal.signal(sig, previous)
475
- custody.__exit__(None, None, None)
513
+ try:
514
+ record(
515
+ directory,
516
+ event="summary",
517
+ failed=sum(v == "failed" for v in results.values()) + runner_failed,
518
+ deferred=sum(v == "deferred" for v in results.values()),
519
+ )
520
+ finally:
521
+ custody.__exit__(None, None, None)
@@ -1 +0,0 @@
1
- BUILD_SHA = "7cff5b2c60cec1d8b3a3a4ede74e7e8746affe9e"
File without changes
File without changes