doubled-graph 3.1.2__tar.gz → 3.1.5__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 (179) hide show
  1. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/PKG-INFO +1 -1
  2. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/pyproject.toml +1 -1
  3. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/integrations/service.py +178 -19
  4. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/setup.py +73 -4
  5. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/uninstall.py +25 -2
  6. doubled_graph-3.1.5/tests/launchd_stub/fake_launchctl.py +307 -0
  7. doubled_graph-3.1.5/tests/launchd_stub/launchctl +14 -0
  8. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_cli_daemon.py +127 -0
  9. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_service.py +108 -1
  10. doubled_graph-3.1.5/tests/test_service_async_unload.py +268 -0
  11. doubled_graph-3.1.5/tests/test_service_start_fallback.py +92 -0
  12. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_setup_coverage.py +49 -0
  13. doubled_graph-3.1.5/tests/test_setup_launchd_e2e.py +339 -0
  14. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_uninstall.py +68 -1
  15. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/.gitignore +0 -0
  16. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/ARTICLE.md +0 -0
  17. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/INDEX.md +0 -0
  18. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/LICENSE +0 -0
  19. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/README.md +0 -0
  20. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/for-ai-existing-project/README.md +0 -0
  21. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/for-ai-maintenance/README.md +0 -0
  22. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/for-ai-new-project/README.md +0 -0
  23. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/for-humans/FAQ.md +0 -0
  24. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/for-humans/deep-dive.md +0 -0
  25. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/for-humans/getting-started.md +0 -0
  26. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/README.md +0 -0
  27. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/approval-checkpoints.md +0 -0
  28. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/artifacts.md +0 -0
  29. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/auto-scaling.md +0 -0
  30. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/ci-templates/github-actions.yml +0 -0
  31. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/ci-templates/gitlab-ci.yml +0 -0
  32. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/drift-and-priority.md +0 -0
  33. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/_template.md +0 -0
  34. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/csharp.md +0 -0
  35. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/go.md +0 -0
  36. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/java.md +0 -0
  37. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/python.md +0 -0
  38. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/rust.md +0 -0
  39. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/swift.md +0 -0
  40. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/language-adapters/typescript.md +0 -0
  41. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/principles.md +0 -0
  42. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/roles.md +0 -0
  43. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/runtime-adapters/_template.md +0 -0
  44. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/runtime-adapters/claude-code.md +0 -0
  45. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/runtime-adapters/codex.md +0 -0
  46. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/runtime-adapters/continue.md +0 -0
  47. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/runtime-adapters/cursor.md +0 -0
  48. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/runtime-adapters/local-llm.md +0 -0
  49. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/runtime-adapters/windsurf.md +0 -0
  50. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/tools.md +0 -0
  51. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/methodology/workflow.md +0 -0
  52. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/maintenance/on-after-edit.md +0 -0
  53. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/maintenance/on-before-edit.md +0 -0
  54. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/maintenance/on-drift-detected.md +0 -0
  55. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/maintenance/on-user-manual-edit.md +0 -0
  56. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/migrate-existing-project/00-entry-prompt.md +0 -0
  57. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/migrate-existing-project/01-discover.md +0 -0
  58. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/migrate-existing-project/02-reconstruct-intent.md +0 -0
  59. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/migrate-existing-project/03-draft-plan.md +0 -0
  60. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/migrate-existing-project/04-markup-codebase.md +0 -0
  61. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/migrate-existing-project/05-verification-and-logs.md +0 -0
  62. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/migrate-existing-project/06-validation-gates.md +0 -0
  63. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/00-entry-prompt.md +0 -0
  64. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/01-intent-interview.md +0 -0
  65. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/02-requirements.md +0 -0
  66. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/03-technology.md +0 -0
  67. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/04-development-plan.md +0 -0
  68. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/05-verification-plan.md +0 -0
  69. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/06-generate.md +0 -0
  70. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/new-project/07-post-init-sync.md +0 -0
  71. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/upgrade-methodology/00-entry-prompt.md +0 -0
  72. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/prompts/upgrade-methodology/01-content-gaps.md +0 -0
  73. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/__init__.py +0 -0
  74. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/__main__.py +0 -0
  75. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/artifacts_repair.py +0 -0
  76. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/cli.py +0 -0
  77. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/config.py +0 -0
  78. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/contracts.py +0 -0
  79. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/daemon/__init__.py +0 -0
  80. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/daemon/index_store.py +0 -0
  81. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/daemon/main.py +0 -0
  82. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/daemon/server.py +0 -0
  83. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/data/skills/doubled-graph-after-edit/SKILL.md +0 -0
  84. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/data/skills/doubled-graph-before-edit/SKILL.md +0 -0
  85. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/data/skills/doubled-graph-drift/SKILL.md +0 -0
  86. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/data/skills/doubled-graph-guide/SKILL.md +0 -0
  87. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/data/skills/doubled-graph-manual-edit/SKILL.md +0 -0
  88. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/data/skills/doubled-graph-refactor/SKILL.md +0 -0
  89. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/data/skills/doubled-graph-verify/SKILL.md +0 -0
  90. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/graphs/__init__.py +0 -0
  91. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/graphs/anchors.py +0 -0
  92. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/graphs/crossref.py +0 -0
  93. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/graphs/declared.py +0 -0
  94. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/graphs/grace4.py +0 -0
  95. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/health.py +0 -0
  96. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/hooks_installer.py +0 -0
  97. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/index/__init__.py +0 -0
  98. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/index/discovery.py +0 -0
  99. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/index/linker.py +0 -0
  100. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/index/manifest.py +0 -0
  101. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/index/parse_cache.py +0 -0
  102. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/index/parser.py +0 -0
  103. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/index/snapshot.py +0 -0
  104. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/integrations/__init__.py +0 -0
  105. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/integrations/cgc.py +0 -0
  106. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/integrations/grace_cli.py +0 -0
  107. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/integrations/graphd.py +0 -0
  108. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/migrations/__init__.py +0 -0
  109. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/migrations/grace3_to_grace4.py +0 -0
  110. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/policy/__init__.py +0 -0
  111. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/policy/agents_md.py +0 -0
  112. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/policy/phase.py +0 -0
  113. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/server.py +0 -0
  114. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/storage/__init__.py +0 -0
  115. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/storage/paths.py +0 -0
  116. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/__init__.py +0 -0
  117. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/_meta.py +0 -0
  118. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/analyze.py +0 -0
  119. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/analyze_sync.py +0 -0
  120. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/check_drift.py +0 -0
  121. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/context.py +0 -0
  122. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/impact.py +0 -0
  123. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/index_status.py +0 -0
  124. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/post_tool.py +0 -0
  125. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/src/doubled_graph/tools/provenance.py +0 -0
  126. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/__init__.py +0 -0
  127. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/conftest.py +0 -0
  128. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_analyze_sync.py +0 -0
  129. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_anchors.py +0 -0
  130. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_artifacts_repair.py +0 -0
  131. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_bom_support.py +0 -0
  132. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_cgc_backend.py +0 -0
  133. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_cgc_contract.py +0 -0
  134. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_cgc_lifecycle.py +0 -0
  135. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_check_drift.py +0 -0
  136. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_cli_entrypoint.py +0 -0
  137. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_cli_surface.py +0 -0
  138. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_command_surface.py +0 -0
  139. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_contracts.py +0 -0
  140. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_crossref_drift.py +0 -0
  141. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_daemon.py +0 -0
  142. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_daemon_main.py +0 -0
  143. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_declared_coverage.py +0 -0
  144. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_doc_contract.py +0 -0
  145. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_e2e_acceptance.py +0 -0
  146. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_grace4_artifacts.py +0 -0
  147. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_grace_cli_coverage.py +0 -0
  148. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_grace_cli_engine.py +0 -0
  149. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_graphd_client.py +0 -0
  150. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_health.py +0 -0
  151. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_hook_public_coverage.py +0 -0
  152. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_index_core.py +0 -0
  153. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_index_graph.py +0 -0
  154. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_index_manifest.py +0 -0
  155. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_integration_daemon_cgc.py +0 -0
  156. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mcp_transport.py +0 -0
  157. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mcp_validation.py +0 -0
  158. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_migration_coverage.py +0 -0
  159. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_migration_grace3_to_grace4.py +0 -0
  160. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_gate_script.py +0 -0
  161. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_kill_cgc_edges.py +0 -0
  162. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_kill_cgc_fallback.py +0 -0
  163. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_kill_cgc_misc.py +0 -0
  164. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_kill_context.py +0 -0
  165. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_kill_crossref.py +0 -0
  166. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_kill_hooks.py +0 -0
  167. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_kill_impact.py +0 -0
  168. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_mutation_probes.py +0 -0
  169. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_packaging.py +0 -0
  170. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_platform_branches.py +0 -0
  171. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_protocol_v2.py +0 -0
  172. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_provenance.py +0 -0
  173. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_release_edges.py +0 -0
  174. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_release_script.py +0 -0
  175. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_repo_hygiene.py +0 -0
  176. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_setup_artifacts.py +0 -0
  177. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_setup_failure_semantics.py +0 -0
  178. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_smoke.py +0 -0
  179. {doubled_graph-3.1.2 → doubled_graph-3.1.5}/tests/test_snapshot_oracle.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: doubled-graph
3
- Version: 3.1.2
3
+ Version: 3.1.5
4
4
  Summary: MCP facade over CodeGraphContext + GRACE 4 (.grace artifacts): impact, context, drift-detect, migration for LLM-driven codebases.
5
5
  Project-URL: Homepage, https://github.com/rour/doubled-graph-mcp
6
6
  Project-URL: Repository, https://github.com/rour/doubled-graph-mcp
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "doubled-graph"
7
- version = "3.1.2"
7
+ version = "3.1.5"
8
8
  description = "MCP facade over CodeGraphContext + GRACE 4 (.grace artifacts): impact, context, drift-detect, migration for LLM-driven codebases."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -53,6 +53,19 @@ DEFAULT_WAIT_TIMEOUT_S = 60.0
53
53
  #: `daemon.json`, not thousands.
54
54
  MAX_WAIT_INTERVAL_S = 2.0
55
55
 
56
+ #: `launchctl bootout` returns before launchd actually removes the job and
57
+ #: before the daemon process exits. Bootstrapping in that window fails with
58
+ #: "Bootstrap failed: 5: Input/output error", and a retry started immediately
59
+ #: hits the same window. Poll the supervisor instead of trusting the exit code.
60
+ #: Five seconds is enough for a normal unload. A wait that times out is
61
+ #: reported (``stop`` as failed, a bootstrap as its real refusal), never as a
62
+ #: silent success.
63
+ STOP_TIMEOUT_S = 5.0
64
+ STOP_POLL_INTERVAL_S = 0.05
65
+ #: One short pause after a refused bootstrap, for launchd's throttle of a job
66
+ #: that was booted out moments ago.
67
+ BOOTSTRAP_RETRY_DELAY_S = 0.25
68
+
56
69
  #: Statuses each restart step may report without making the restart a failure.
57
70
  #: ``stop`` accepts ``not_installed``: a first `setup` has nothing to stop, and
58
71
  #: that is not an error. Everything else must be the real supervisor action.
@@ -371,6 +384,82 @@ class ServiceManager:
371
384
  step["removed"] = removed
372
385
  return step
373
386
 
387
+ def _wait_until_unloaded(self, timeout: float | None = None) -> bool:
388
+ """Wait until the supervisor no longer reports the job as loaded.
389
+
390
+ ``bootout``/``disable --now`` return before the supervisor has
391
+ finished; a bootstrap in between is refused. Polling is the only
392
+ portable signal available through the manager API.
393
+ """
394
+ deadline = time.monotonic() + (STOP_TIMEOUT_S if timeout is None else timeout)
395
+ while True:
396
+ if not self._loaded():
397
+ return True
398
+ if time.monotonic() >= deadline:
399
+ return False
400
+ time.sleep(STOP_POLL_INTERVAL_S)
401
+
402
+ def _wait_until_running(self, timeout: float | None = None) -> bool:
403
+ """Wait until the supervisor reports the daemon as running."""
404
+ deadline = time.monotonic() + (STOP_TIMEOUT_S if timeout is None else timeout)
405
+ while True:
406
+ if self._running():
407
+ return True
408
+ if time.monotonic() >= deadline:
409
+ return False
410
+ time.sleep(STOP_POLL_INTERVAL_S)
411
+
412
+ def _wait_until_stopped(self, timeout: float | None = None) -> bool:
413
+ """Wait until the supervisor reports the daemon as no longer running.
414
+
415
+ ``bootout`` returns before launchd finishes; reporting ``stopped`` on
416
+ the exit code alone made a subsequent ``bootstrap`` race the unload.
417
+ Recorded foreground PIDs are deliberately not waited for here:
418
+ ``cleanup`` keeps their state files, and they are not ours to kill.
419
+ """
420
+ deadline = time.monotonic() + (STOP_TIMEOUT_S if timeout is None else timeout)
421
+ while True:
422
+ if not self._running():
423
+ return True
424
+ if time.monotonic() >= deadline:
425
+ return False
426
+ time.sleep(STOP_POLL_INTERVAL_S)
427
+
428
+ def _wait_after_stop(self) -> bool:
429
+ """Backend-specific post-stop wait.
430
+
431
+ ``launchctl bootout`` only removes the job asynchronously, so a
432
+ generic "state != running" check is not enough for launchd. systemd
433
+ keeps the unit enabled after ``stop``, so waiting for ``_loaded()``
434
+ there would be wrong. Subclasses override this when their supervisor
435
+ has an extra asynchronous step.
436
+ """
437
+ return True
438
+
439
+ def _bootstrap_fresh(self) -> CommandResult:
440
+ """Load the unit, healing a refused bootstrap after an async unload.
441
+
442
+ This is the repair for the launchd race behind the cross-project
443
+ incident: repo B's ``setup`` booted out the shared job, then
444
+ ``bootstrap`` in the unload window failed with code 5. If the first
445
+ load is refused while the old job is still in the table, drop it and
446
+ poll until the supervisor has really finished before retrying.
447
+ """
448
+ result = self._bootstrap()
449
+ if result.ok:
450
+ return result
451
+ if self._loaded():
452
+ # The bootstrap was refused because the old job is still in the
453
+ # table. Drop it and wait for the unload, not just for the process.
454
+ self._bootout()
455
+ if not self._wait_until_unloaded():
456
+ return result
457
+ return self._bootstrap()
458
+ # launchd also throttles a job that was booted out moments ago; one
459
+ # short retry distinguishes throttling from a real unit error.
460
+ time.sleep(BOOTSTRAP_RETRY_DELAY_S)
461
+ return self._bootstrap()
462
+
374
463
  def _loaded(self) -> bool:
375
464
  raise NotImplementedError
376
465
 
@@ -411,7 +500,7 @@ class ServiceManager:
411
500
  except OSError:
412
501
  return
413
502
  if previous is not None and was_loaded:
414
- self._bootstrap()
503
+ self._bootstrap_fresh()
415
504
 
416
505
  # -- public API -----------------------------------------------------
417
506
 
@@ -435,9 +524,7 @@ class ServiceManager:
435
524
  self._write_unit(desired)
436
525
  except OSError as exc:
437
526
  return self._report("failed", detail=f"{type(exc).__name__}: {exc}")
438
- if loaded:
439
- self._bootout()
440
- result = self._bootstrap()
527
+ result = self._bootstrap_fresh()
441
528
  if not result.ok:
442
529
  if "already" in result.output.lower() or "loaded" in result.output.lower():
443
530
  result = self._kickstart()
@@ -465,6 +552,17 @@ class ServiceManager:
465
552
  )
466
553
  report["returncode"] = result.returncode
467
554
  return report
555
+ if not self._wait_until_unloaded():
556
+ # `bootout` returned 0 but launchd still has the job. Deleting
557
+ # the plist now would leave a loaded service with no unit to
558
+ # inspect or unload; keep it and report the real state.
559
+ return self._report(
560
+ "failed",
561
+ detail=(
562
+ "the supervisor accepted bootout, but the job is still "
563
+ f"loaded after {STOP_TIMEOUT_S:g}s; unit kept"
564
+ ),
565
+ )
468
566
  if path is not None:
469
567
  try:
470
568
  path.unlink()
@@ -532,11 +630,37 @@ class ServiceManager:
532
630
  # unloaded (after `daemon stop`) must still be startable.
533
631
  if not self.unit_present():
534
632
  return self._report("not_installed")
535
- result = self._kickstart() if self._loaded() else self._bootstrap()
633
+ first: CommandResult | None = None
634
+ if self._loaded():
635
+ result = self._kickstart()
636
+ if result.ok:
637
+ return self._report("started")
638
+ # `bootout` can return 0 while launchd still has the job in its
639
+ # table ("stale" job), and `kickstart` against that half-unloaded
640
+ # job fails. Drop the stale job, wait for the unload to finish,
641
+ # then load the unit from scratch; bootstrapping immediately is
642
+ # what produced "Bootstrap failed: 5" in the incident.
643
+ first = result
644
+ result = self._bootstrap_fresh()
536
645
  if not result.ok:
537
- return self._report("failed", detail=result.output, stderr=result.stderr)
646
+ if first is None:
647
+ return self._report("failed", detail=result.output, stderr=result.stderr)
648
+ # Name both supervisor refusals: the kickstart failure is the
649
+ # reason the fallback ran, not noise to discard.
650
+ detail = "; ".join(
651
+ part
652
+ for part in dict.fromkeys((first.output, result.output))
653
+ if part
654
+ )
655
+ stderr = "\n".join(
656
+ part
657
+ for part in dict.fromkeys((first.stderr, result.stderr))
658
+ if part
659
+ )
660
+ return self._report("failed", detail=detail, stderr=stderr)
538
661
  return self._report("started")
539
662
 
663
+
540
664
  def stop(self) -> dict[str, Any]:
541
665
  if not self.unit_present() and not self._loaded():
542
666
  return self._report("not_installed")
@@ -547,6 +671,22 @@ class ServiceManager:
547
671
  result = self._stop_command()
548
672
  if not result.ok:
549
673
  return self._report("failed", detail=result.output, stderr=result.stderr)
674
+ if not self._wait_until_stopped():
675
+ return self._report(
676
+ "failed",
677
+ detail=(
678
+ "the supervisor accepted the stop, but the daemon is still "
679
+ f"running after {STOP_TIMEOUT_S:g}s"
680
+ ),
681
+ )
682
+ if not self._wait_after_stop():
683
+ return self._report(
684
+ "failed",
685
+ detail=(
686
+ "the supervisor accepted the stop, but the job is still "
687
+ f"loaded after {STOP_TIMEOUT_S:g}s"
688
+ ),
689
+ )
550
690
  return self._report("stopped")
551
691
 
552
692
  def restart(
@@ -569,7 +709,9 @@ class ServiceManager:
569
709
  Since 3.0.3 the operation is also **self-healing**, because a plist on
570
710
  disk is not a loaded job:
571
711
 
572
- 1. ``stop`` — bootout/stop/``/End`` the old process, if any;
712
+ 1. ``stop`` — bootout/stop/``/End`` the old process and wait until the
713
+ supervisor reports it as no longer running (``bootout`` returns
714
+ before launchd finishes);
573
715
  2. ``cleanup`` — delete ``daemon.json``/``daemon.sock``/``graphd.pid``
574
716
  and the stale ``graphd.lock`` *only* when every recorded owner PID
575
717
  is dead (a live foreground daemon keeps its files);
@@ -577,8 +719,10 @@ class ServiceManager:
577
719
  systemd unit, the state that turns ``bootstrap`` into
578
720
  ``Bootstrap failed: 5`` or ``Could not find service``;
579
721
  4. ``install`` — rewrite the unit for this interpreter/``--home``;
580
- 5. ``start`` — bootstrap the job, then (when ``wait_timeout`` > 0)
581
- wait for ``ping`` and require the daemon's package version.
722
+ 5. ``start`` — bootstrap the job only after any previous job is
723
+ really unloaded (refused bootstraps are retried after polling
724
+ ``print``), then (when ``wait_timeout`` > 0) wait for ``ping`` and
725
+ require the daemon's package version.
582
726
 
583
727
  Every step is reported with its own ``status``; a failure keeps the
584
728
  real supervisor ``stderr`` and a diagnostic ``hint`` (``log show`` on
@@ -828,6 +972,9 @@ class LaunchdManager(ServiceManager):
828
972
  "</plist>\n"
829
973
  )
830
974
 
975
+ def _wait_after_stop(self) -> bool:
976
+ return self._wait_until_unloaded()
977
+
831
978
  def _loaded(self) -> bool:
832
979
  return self.run(["launchctl", "print", self._target]).ok
833
980
 
@@ -1070,11 +1217,17 @@ class TaskSchedulerManager(ServiceManager):
1070
1217
 
1071
1218
  def start(self) -> dict[str, Any]:
1072
1219
  result = self.run(["schtasks", "/Run", "/TN", WINDOWS_TASK])
1073
- return self._report(
1074
- "started" if result.ok else "failed",
1075
- detail=result.output,
1076
- stderr=result.stderr,
1077
- )
1220
+ if not result.ok:
1221
+ return self._report("failed", detail=result.output, stderr=result.stderr)
1222
+ if not self._wait_until_running():
1223
+ return self._report(
1224
+ "failed",
1225
+ detail=(
1226
+ "schtasks accepted /Run, but the task is not Running after "
1227
+ f"{STOP_TIMEOUT_S:g}s"
1228
+ ),
1229
+ )
1230
+ return self._report("started")
1078
1231
 
1079
1232
  def stop(self) -> dict[str, Any]:
1080
1233
  if not self._query().ok:
@@ -1085,11 +1238,17 @@ class TaskSchedulerManager(ServiceManager):
1085
1238
  # treat this as a refused stop.
1086
1239
  return self._report("not_running")
1087
1240
  result = self.run(["schtasks", "/End", "/TN", WINDOWS_TASK])
1088
- return self._report(
1089
- "stopped" if result.ok else "failed",
1090
- detail=result.output,
1091
- stderr=result.stderr,
1092
- )
1241
+ if not result.ok:
1242
+ return self._report("failed", detail=result.output, stderr=result.stderr)
1243
+ if not self._wait_until_stopped():
1244
+ return self._report(
1245
+ "failed",
1246
+ detail=(
1247
+ "schtasks accepted /End, but the task is still Running after "
1248
+ f"{STOP_TIMEOUT_S:g}s"
1249
+ ),
1250
+ )
1251
+ return self._report("stopped")
1093
1252
 
1094
1253
 
1095
1254
  class UnsupportedServiceManager(ServiceManager):
@@ -335,6 +335,11 @@ def _process_command(pid: str) -> str | None:
335
335
  return result.stdout.strip()
336
336
 
337
337
 
338
+ #: SIGKILL is observable only after the process is reaped; give the kernel a
339
+ #: short window before claiming the old MCP server is gone.
340
+ _MCP_SIGKILL_WAIT_S = 2.0
341
+
342
+
338
343
  def kill_running_mcp_servers(dry_run: bool = False) -> dict[str, Any]:
339
344
  """Find and SIGTERM (then SIGKILL) any `python -m doubled_graph serve` processes.
340
345
 
@@ -428,10 +433,30 @@ def kill_running_mcp_servers(dry_run: bool = False) -> dict[str, Any]:
428
433
  except (ProcessLookupError, ValueError, PermissionError):
429
434
  continue # already dead, fine
430
435
 
436
+ # SIGKILL is asynchronous for our purposes: a zombie/reaping process can
437
+ # still answer `kill(0)`. Verify death before telling `setup` that the old
438
+ # MCP server is gone (otherwise pip install continues over a live process).
439
+ survived: list[str] = []
440
+ deadline = time.monotonic() + _MCP_SIGKILL_WAIT_S
441
+ pending = set(killed_term)
442
+ while True:
443
+ for pid in list(pending):
444
+ try:
445
+ os.kill(int(pid), 0)
446
+ except (ProcessLookupError, ValueError):
447
+ pending.discard(pid)
448
+ except PermissionError:
449
+ # It exists and is not ours to reap: do not claim it is gone.
450
+ continue
451
+ if not pending or time.monotonic() >= deadline:
452
+ break
453
+ time.sleep(0.05)
454
+ survived = sorted(pending)
431
455
  return {
432
- "status": "killed",
456
+ "status": "killed" if not survived else "failed",
433
457
  "sigterm": killed_term,
434
458
  "sigkill": killed_kill,
459
+ "survived": survived,
435
460
  "hint": "Your IDE will re-spawn the MCP server on next tool call (or after a `/mcp` reconnect).",
436
461
  }
437
462
 
@@ -1053,6 +1078,21 @@ def _ensure_agents_anti_patterns(repo: Path, dry_run: bool) -> dict[str, Any]:
1053
1078
  return ensure_anti_patterns(repo, dry_run=dry_run)
1054
1079
 
1055
1080
 
1081
+ def _attempt_cause(report: dict[str, Any]) -> dict[str, Any]:
1082
+ """The diagnostic part of a failed daemon attempt.
1083
+
1084
+ ``restart`` reports the refusal per step; a retry must not throw that away.
1085
+ Kept as plain JSON values so the setup report stays serialisable.
1086
+ """
1087
+ return {
1088
+ "status": report.get("status"),
1089
+ "failed_steps": list(report.get("failed_steps") or []),
1090
+ "detail": report.get("detail") or "",
1091
+ "stderr": report.get("stderr") or "",
1092
+ "hint": report.get("hint") or "",
1093
+ }
1094
+
1095
+
1056
1096
  def _install_daemon_service(repo: Path, dry_run: bool) -> dict[str, Any]:
1057
1097
  """Restart the OS-supervised graph daemon and register this project.
1058
1098
 
@@ -1073,6 +1113,12 @@ def _install_daemon_service(repo: Path, dry_run: bool) -> dict[str, Any]:
1073
1113
  an "ok": the unit may point at another interpreter, or the old process may
1074
1114
  still own the state directory.
1075
1115
 
1116
+ A failed restart is retried once when the supervisor reports no **running**
1117
+ daemon. The condition is ``running``, not ``loaded``, because launchd can
1118
+ keep a stale job loaded after ``bootout`` returned 0; that state used to
1119
+ suppress the retry. Both causes are preserved: the final attempt is the
1120
+ top-level report, the first one is ``retry.first_attempt``.
1121
+
1076
1122
  ``DOUBLED_GRAPH_NO_SERVICE=1`` is an explicit CI/test escape hatch: the
1077
1123
  suite must never touch the developer's real launchd/systemd, and a
1078
1124
  sandbox that forbids supervisor commands can still run ``setup`` with
@@ -1093,6 +1139,7 @@ def _install_daemon_service(repo: Path, dry_run: bool) -> dict[str, Any]:
1093
1139
  "enable the unit if launchd/systemd has it disabled or masked",
1094
1140
  "install/update the unit for this interpreter and --home",
1095
1141
  "start (bootstrap) and surface the real supervisor stderr on failure",
1142
+ "retry once when the supervisor has no running daemon (stale job included)",
1096
1143
  "wait for the daemon (60 s, backoff)",
1097
1144
  "verify daemon.version == client version",
1098
1145
  "register repo",
@@ -1109,10 +1156,24 @@ def _install_daemon_service(repo: Path, dry_run: bool) -> dict[str, Any]:
1109
1156
  # booted out moments ago, an old unit is still cached). `setup` is the
1110
1157
  # designated repair path, so it retries once instead of asking the user
1111
1158
  # to run `daemon install` by hand.
1112
- if result.get("status") != "running" and not manager.status().get("loaded"):
1159
+ #
1160
+ # The condition is "the supervisor does not report a running daemon",
1161
+ # not "the job is not loaded": `bootout` can return 0 while launchd
1162
+ # keeps the stale job in its table and the process is already dead.
1163
+ # That exact state made 3.1.2 skip the retry and leave the daemon down.
1164
+ status = manager.status()
1165
+ if result.get("status") != "running" and not status.get("running"):
1166
+ first_attempt = _attempt_cause(result)
1113
1167
  retried = ensure_running(manager, repo_path=repo, restart=True)
1114
- if retried.get("status") == "running":
1115
- result = retried
1168
+ # Keep the failed attempt's cause on the success path too. When the
1169
+ # retry fails as well, the retried report becomes the top-level
1170
+ # result (it is the final truth) and the first cause stays nested.
1171
+ retried["retry"] = {
1172
+ "attempted": True,
1173
+ "recovered": retried.get("status") == "running",
1174
+ "first_attempt": first_attempt,
1175
+ }
1176
+ result = retried
1116
1177
  result["service"] = manager.status()
1117
1178
  result["client_version"] = __version__
1118
1179
  daemon_version = (result.get("daemon") or {}).get("version")
@@ -1607,6 +1668,14 @@ def run_setup(
1607
1668
  elif kill_report["status"] == "dry_run":
1608
1669
  n = len(kill_report.get("would_kill", []))
1609
1670
  _log(f"{prefix}[pre] Would kill {n} running MCP server(s).")
1671
+ elif kill_report["status"] == "failed":
1672
+ survived = ", ".join(kill_report.get("survived", []))
1673
+ warning = (
1674
+ "mcp_servers_survived: the old MCP server process(es) "
1675
+ f"{survived} survived SIGKILL; the IDE may keep serving stale code"
1676
+ )
1677
+ report.setdefault("warnings", []).append(warning)
1678
+ _log(f"{prefix}[pre] WARNING: {warning}")
1610
1679
 
1611
1680
  # 1. Grace CLI — slow: subprocess to a JS package manager can take 10–30s.
1612
1681
  _log(f"{prefix}[1/{total}] Installing @osovv/grace-cli (may take 10–30s)…")
@@ -78,6 +78,10 @@ _CONTAINER_DIRS: tuple[str, ...] = (
78
78
  #: Grace period between SIGTERM and SIGKILL for a daemon whose supervisor can
79
79
  #: no longer control it (foreground `daemon run`, crashed supervisor, ...).
80
80
  DAEMON_STOP_TIMEOUT_S = 5.0
81
+ #: SIGKILL is not synchronously observable: the process can still be a zombie
82
+ #: (or not yet reaped) when `kill(0)` answers. Confirm its death before
83
+ #: reporting "killed", otherwise uninstall removes state under a dying DB owner.
84
+ SIGKILL_WAIT_S = 2.0
81
85
  _POLL_INTERVAL_S = 0.1
82
86
 
83
87
  #: Commands that identify a per-repository embedded engine. ``falkor_worker``
@@ -137,11 +141,17 @@ def _terminate(
137
141
  pid: int,
138
142
  *,
139
143
  timeout: float = DAEMON_STOP_TIMEOUT_S,
144
+ kill_timeout: float = SIGKILL_WAIT_S,
140
145
  alive: Callable[[int], bool] | None = None,
141
146
  sleep: Callable[[float], None] | None = None,
142
147
  monotonic: Callable[[], float] | None = None,
143
148
  ) -> dict[str, Any]:
144
- """SIGTERM *pid*, wait up to *timeout*, then SIGKILL if it is still alive."""
149
+ """SIGTERM *pid*, wait up to *timeout*, then SIGKILL and wait *kill_timeout*.
150
+
151
+ ``killed`` is returned only after the process is observed dead. Sending
152
+ SIGKILL and returning immediately made ``stop_orphaned_engines`` inspect a
153
+ still-dying process and remove its database/state while it was alive.
154
+ """
145
155
  alive = alive or _pid_alive
146
156
  sleep = sleep or time.sleep
147
157
  monotonic = monotonic or time.monotonic
@@ -162,7 +172,20 @@ def _terminate(
162
172
  return {"status": "stopped", "pid": pid}
163
173
  except OSError as exc:
164
174
  return {"status": "failed", "pid": pid, "detail": f"{type(exc).__name__}: {exc}"}
165
- return {"status": "killed", "pid": pid}
175
+ if kill_timeout <= 0:
176
+ return {"status": "killed", "pid": pid}
177
+ deadline = monotonic() + kill_timeout
178
+ while monotonic() < deadline:
179
+ if not alive(pid):
180
+ return {"status": "killed", "pid": pid}
181
+ sleep(_POLL_INTERVAL_S)
182
+ if not alive(pid):
183
+ return {"status": "killed", "pid": pid}
184
+ return {
185
+ "status": "failed",
186
+ "pid": pid,
187
+ "detail": "SIGKILL was sent but the process is still alive",
188
+ }
166
189
 
167
190
 
168
191
  def stop_daemon(probe: Callable[[], dict[str, Any]] | None = None) -> dict[str, Any]: