stepfork 0.1.0a5__tar.gz → 0.2.0__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 (258) hide show
  1. {stepfork-0.1.0a5 → stepfork-0.2.0}/.gitignore +2 -0
  2. {stepfork-0.1.0a5 → stepfork-0.2.0}/CHANGELOG.md +84 -0
  3. {stepfork-0.1.0a5 → stepfork-0.2.0}/PKG-INFO +83 -19
  4. {stepfork-0.1.0a5 → stepfork-0.2.0}/README.md +82 -18
  5. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/cli.md +95 -2
  6. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/community/early-adopter-guide.md +1 -1
  7. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/development.md +1 -1
  8. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/examples.md +19 -2
  9. stepfork-0.2.0/docs/fork.md +545 -0
  10. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/getting-started.md +5 -5
  11. stepfork-0.2.0/docs/hybrid.md +59 -0
  12. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/index.md +1 -1
  13. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/integrations.md +10 -7
  14. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/langgraph.md +143 -29
  15. stepfork-0.2.0/docs/minimize.md +266 -0
  16. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/openai.md +5 -2
  17. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/pytest-export.md +28 -0
  18. stepfork-0.2.0/docs/real-llm-case-study.md +145 -0
  19. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/recording.md +22 -0
  20. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/release-checklist.md +1 -0
  21. stepfork-0.2.0/docs/releases/v0.1.0a6.md +46 -0
  22. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/replay.md +66 -2
  23. stepfork-0.2.0/examples/model_decision/README.md +32 -0
  24. stepfork-0.2.0/examples/model_decision/__init__.py +1 -0
  25. stepfork-0.2.0/examples/model_decision/agent.py +156 -0
  26. stepfork-0.2.0/examples/model_decision/demo.py +108 -0
  27. stepfork-0.2.0/examples/real-llm-case-study/.gitignore +13 -0
  28. stepfork-0.2.0/examples/real-llm-case-study/.python-version +1 -0
  29. stepfork-0.2.0/examples/real-llm-case-study/CASE_STUDY.md +348 -0
  30. stepfork-0.2.0/examples/real-llm-case-study/README.md +144 -0
  31. stepfork-0.2.0/examples/real-llm-case-study/RESULTS.md +160 -0
  32. stepfork-0.2.0/examples/real-llm-case-study/agent.py +292 -0
  33. stepfork-0.2.0/examples/real-llm-case-study/counters.py +19 -0
  34. stepfork-0.2.0/examples/real-llm-case-study/evidence/README.md +25 -0
  35. stepfork-0.2.0/examples/real-llm-case-study/evidence/clean_install_verification.txt +152 -0
  36. stepfork-0.2.0/examples/real-llm-case-study/evidence/divergence.txt +6 -0
  37. stepfork-0.2.0/examples/real-llm-case-study/evidence/fix.diff +30 -0
  38. stepfork-0.2.0/examples/real-llm-case-study/evidence/frozen_replay.txt +32 -0
  39. stepfork-0.2.0/examples/real-llm-case-study/evidence/full_suite.txt +2 -0
  40. stepfork-0.2.0/examples/real-llm-case-study/evidence/green_pass.txt +2 -0
  41. stepfork-0.2.0/examples/real-llm-case-study/evidence/hybrid_comparison.json +54 -0
  42. stepfork-0.2.0/examples/real-llm-case-study/evidence/red_failure.txt +110 -0
  43. stepfork-0.2.0/examples/real-llm-case-study/expected.json +20 -0
  44. stepfork-0.2.0/examples/real-llm-case-study/fix.diff +30 -0
  45. stepfork-0.2.0/examples/real-llm-case-study/fixtures/deployments.json +29 -0
  46. stepfork-0.2.0/examples/real-llm-case-study/fixtures/runbooks.json +16 -0
  47. stepfork-0.2.0/examples/real-llm-case-study/fixtures/services.json +44 -0
  48. stepfork-0.2.0/examples/real-llm-case-study/provider.py +147 -0
  49. stepfork-0.2.0/examples/real-llm-case-study/pyproject.toml +22 -0
  50. stepfork-0.2.0/examples/real-llm-case-study/scenario_a.py +32 -0
  51. stepfork-0.2.0/examples/real-llm-case-study/scenario_b.py +41 -0
  52. stepfork-0.2.0/examples/real-llm-case-study/scripts/hybrid_prompt_comparison.py +70 -0
  53. stepfork-0.2.0/examples/real-llm-case-study/scripts/record_incident.py +63 -0
  54. stepfork-0.2.0/examples/real-llm-case-study/scripts/verify_frozen.py +46 -0
  55. stepfork-0.2.0/examples/real-llm-case-study/snapshots/agent_buggy.py +299 -0
  56. stepfork-0.2.0/examples/real-llm-case-study/snapshots/agent_fixed.py +292 -0
  57. stepfork-0.2.0/examples/real-llm-case-study/tests/test_frozen_replay_guards.py +42 -0
  58. stepfork-0.2.0/examples/real-llm-case-study/tests/test_incident_regression.py +68 -0
  59. stepfork-0.2.0/examples/real-llm-case-study/tests/test_scenario_a_refactor.py +23 -0
  60. stepfork-0.2.0/examples/real-llm-case-study/tests/test_scenario_b_divergence.py +32 -0
  61. stepfork-0.2.0/examples/real-llm-case-study/traces/incident-triage.sftrace/events.jsonl +14 -0
  62. stepfork-0.2.0/examples/real-llm-case-study/traces/incident-triage.sftrace/integrity.json +9 -0
  63. stepfork-0.2.0/examples/real-llm-case-study/traces/incident-triage.sftrace/manifest.json +21 -0
  64. stepfork-0.2.0/examples/real-llm-case-study/uv.lock +636 -0
  65. {stepfork-0.1.0a5 → stepfork-0.2.0}/mkdocs.yml +3 -0
  66. {stepfork-0.1.0a5 → stepfork-0.2.0}/pyproject.toml +6 -0
  67. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/__init__.py +8 -1
  68. stepfork-0.2.0/src/stepfork/assertions.py +235 -0
  69. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/cli/export.py +32 -0
  70. stepfork-0.2.0/src/stepfork/cli/fork.py +152 -0
  71. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/cli/main.py +4 -0
  72. stepfork-0.2.0/src/stepfork/cli/minimize.py +220 -0
  73. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/cli/replay.py +27 -3
  74. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/export/generator.py +41 -0
  75. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/export/runtime.py +25 -2
  76. stepfork-0.2.0/src/stepfork/fork/__init__.py +25 -0
  77. stepfork-0.2.0/src/stepfork/fork/engine.py +258 -0
  78. stepfork-0.2.0/src/stepfork/fork/models.py +76 -0
  79. stepfork-0.2.0/src/stepfork/fork/overrides.py +186 -0
  80. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/integrations/langgraph.py +83 -36
  81. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/integrations/openai.py +46 -1
  82. stepfork-0.2.0/src/stepfork/minimize/__init__.py +27 -0
  83. stepfork-0.2.0/src/stepfork/minimize/delta_debug.py +251 -0
  84. stepfork-0.2.0/src/stepfork/minimize/engine.py +278 -0
  85. stepfork-0.2.0/src/stepfork/minimize/models.py +151 -0
  86. stepfork-0.2.0/src/stepfork/minimize/signature.py +222 -0
  87. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/recorder/__init__.py +2 -1
  88. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/recorder/llm.py +38 -1
  89. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/recorder/session.py +51 -9
  90. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/recorder/tooling.py +2 -0
  91. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/replay/__init__.py +2 -0
  92. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/replay/session.py +167 -17
  93. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/version.py +1 -1
  94. stepfork-0.2.0/tests/golden/successful_run.sftrace/redactions.json +4 -0
  95. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_docs_assets.py +4 -3
  96. stepfork-0.2.0/tests/integration/test_docs_langgraph_example.py +110 -0
  97. stepfork-0.2.0/tests/integration/test_fork_integration.py +169 -0
  98. stepfork-0.2.0/tests/integration/test_minimize_integration.py +193 -0
  99. stepfork-0.2.0/tests/integration/test_model_decision_demo.py +20 -0
  100. stepfork-0.2.0/tests/unit/test_assertions.py +134 -0
  101. stepfork-0.2.0/tests/unit/test_async_boundaries.py +168 -0
  102. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_cli_export.py +92 -0
  103. stepfork-0.2.0/tests/unit/test_cli_minimize.py +243 -0
  104. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_cli_replay.py +25 -0
  105. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_export.py +40 -2
  106. stepfork-0.2.0/tests/unit/test_fork_edge_cases.py +209 -0
  107. stepfork-0.2.0/tests/unit/test_fork_engine.py +214 -0
  108. stepfork-0.2.0/tests/unit/test_fork_overrides.py +212 -0
  109. stepfork-0.2.0/tests/unit/test_hybrid_replay.py +129 -0
  110. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_langgraph_integration.py +29 -6
  111. stepfork-0.2.0/tests/unit/test_live_tool_authorization.py +168 -0
  112. stepfork-0.2.0/tests/unit/test_minimize_delta_debug.py +199 -0
  113. stepfork-0.2.0/tests/unit/test_minimize_signature.py +180 -0
  114. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_openai_integration.py +35 -0
  115. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_trace_tool.py +13 -0
  116. stepfork-0.1.0a5/src/stepfork/fork/__init__.py +0 -4
  117. stepfork-0.1.0a5/src/stepfork/minimize/__init__.py +0 -4
  118. {stepfork-0.1.0a5 → stepfork-0.2.0}/CODE_OF_CONDUCT.md +0 -0
  119. {stepfork-0.1.0a5 → stepfork-0.2.0}/CONTRIBUTING.md +0 -0
  120. {stepfork-0.1.0a5 → stepfork-0.2.0}/LICENSE +0 -0
  121. {stepfork-0.1.0a5 → stepfork-0.2.0}/SECURITY.md +0 -0
  122. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/.gitkeep +0 -0
  123. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/architecture.md +0 -0
  124. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/assets/stepfork-logo.png +0 -0
  125. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/assets/stepfork-workflow.png +0 -0
  126. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/concepts.md +0 -0
  127. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/diff.md +0 -0
  128. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/pypi-publishing.md +0 -0
  129. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/releases/v0.1.0a1.md +0 -0
  130. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/releases/v0.1.0a2.md +0 -0
  131. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/releases/v0.1.0a3.md +0 -0
  132. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/releases/v0.1.0a4.md +0 -0
  133. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/releases/v0.1.0a5.md +0 -0
  134. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/security.md +0 -0
  135. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/trace-format.md +0 -0
  136. {stepfork-0.1.0a5 → stepfork-0.2.0}/docs/troubleshooting.md +0 -0
  137. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/__init__.py +0 -0
  138. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/booking_agent/__init__.py +0 -0
  139. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/booking_agent/agent.py +0 -0
  140. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/booking_agent/demo.py +0 -0
  141. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/booking_agent/expected.json +0 -0
  142. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/README.md +0 -0
  143. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/__init__.py +0 -0
  144. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/agent.py +0 -0
  145. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/demo.py +0 -0
  146. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/expected.json +0 -0
  147. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/events.jsonl +0 -0
  148. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/integrity.json +0 -0
  149. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/manifest.json +0 -0
  150. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/regression/langgraph_failure.sftrace/redactions.json +0 -0
  151. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/langgraph_agent/regression/test_langgraph_regression.py +0 -0
  152. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/openai_chat/README.md +0 -0
  153. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/openai_chat/__init__.py +0 -0
  154. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/openai_chat/agent.py +0 -0
  155. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/openai_chat/demo.py +0 -0
  156. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/openai_chat/expected.json +0 -0
  157. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/quickstart/README.md +0 -0
  158. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/quickstart/__init__.py +0 -0
  159. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/quickstart/agent.py +0 -0
  160. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/quickstart/demo.py +0 -0
  161. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/quickstart/expected.json +0 -0
  162. {stepfork-0.1.0a5/tests/golden/diff_baseline.sftrace → stepfork-0.2.0/examples/real-llm-case-study/traces/incident-triage.sftrace}/redactions.json +0 -0
  163. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/refund_agent/__init__.py +0 -0
  164. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/refund_agent/agent.py +0 -0
  165. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/refund_agent/demo.py +0 -0
  166. {stepfork-0.1.0a5 → stepfork-0.2.0}/examples/refund_agent/expected.json +0 -0
  167. {stepfork-0.1.0a5 → stepfork-0.2.0}/scripts/terminal-demo/README.md +0 -0
  168. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/__main__.py +0 -0
  169. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/cli/__init__.py +0 -0
  170. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/cli/diff.py +0 -0
  171. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/cli/inspect.py +0 -0
  172. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/cli/validate.py +0 -0
  173. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/diff/__init__.py +0 -0
  174. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/diff/compare.py +0 -0
  175. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/diff/engine.py +0 -0
  176. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/diff/models.py +0 -0
  177. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/export/__init__.py +0 -0
  178. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/export/entrypoint.py +0 -0
  179. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/inspect/__init__.py +0 -0
  180. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/inspect/inspector.py +0 -0
  181. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/inspect/models.py +0 -0
  182. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/integrations/__init__.py +0 -0
  183. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/py.typed +0 -0
  184. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/replay/exceptions.py +0 -0
  185. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/replay/plan.py +0 -0
  186. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/__init__.py +0 -0
  187. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/canonical.py +0 -0
  188. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/hashing.py +0 -0
  189. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/integrity.py +0 -0
  190. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/jsonable.py +0 -0
  191. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/manifest.py +0 -0
  192. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/models.py +0 -0
  193. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/redaction.py +0 -0
  194. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/replay_policy.py +0 -0
  195. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/schema.py +0 -0
  196. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/storage.py +0 -0
  197. {stepfork-0.1.0a5 → stepfork-0.2.0}/src/stepfork/trace/validation.py +0 -0
  198. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/.gitkeep +0 -0
  199. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/README.md +0 -0
  200. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/build_fixtures.py +0 -0
  201. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/diff_baseline.sftrace/events.jsonl +0 -0
  202. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/diff_baseline.sftrace/integrity.json +0 -0
  203. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/diff_baseline.sftrace/manifest.json +0 -0
  204. {stepfork-0.1.0a5/tests/golden/diff_changed.sftrace → stepfork-0.2.0/tests/golden/diff_baseline.sftrace}/redactions.json +0 -0
  205. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/diff_changed.sftrace/events.jsonl +0 -0
  206. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/diff_changed.sftrace/integrity.json +0 -0
  207. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/diff_changed.sftrace/manifest.json +0 -0
  208. {stepfork-0.1.0a5/tests/golden/failed_llm_run.sftrace → stepfork-0.2.0/tests/golden/diff_changed.sftrace}/redactions.json +0 -0
  209. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/failed_llm_run.sftrace/events.jsonl +0 -0
  210. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/failed_llm_run.sftrace/integrity.json +0 -0
  211. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/failed_llm_run.sftrace/manifest.json +0 -0
  212. {stepfork-0.1.0a5/tests/golden/legacy_v01.sftrace → stepfork-0.2.0/tests/golden/failed_llm_run.sftrace}/redactions.json +0 -0
  213. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/failed_tool_run.sftrace/events.jsonl +0 -0
  214. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/failed_tool_run.sftrace/integrity.json +0 -0
  215. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/failed_tool_run.sftrace/manifest.json +0 -0
  216. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/failed_tool_run.sftrace/redactions.json +0 -0
  217. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/legacy_v01.sftrace/events.jsonl +0 -0
  218. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/legacy_v01.sftrace/manifest.json +0 -0
  219. {stepfork-0.1.0a5/tests/golden/partial_run.sftrace → stepfork-0.2.0/tests/golden/legacy_v01.sftrace}/redactions.json +0 -0
  220. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/partial_run.sftrace/events.jsonl +0 -0
  221. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/partial_run.sftrace/integrity.json +0 -0
  222. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/partial_run.sftrace/manifest.json +0 -0
  223. {stepfork-0.1.0a5/tests/golden/successful_run.sftrace → stepfork-0.2.0/tests/golden/partial_run.sftrace}/redactions.json +0 -0
  224. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/successful_run.sftrace/events.jsonl +0 -0
  225. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/successful_run.sftrace/integrity.json +0 -0
  226. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/golden/successful_run.sftrace/manifest.json +0 -0
  227. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/.gitkeep +0 -0
  228. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_failure_to_test.py +0 -0
  229. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_golden_fixtures.py +0 -0
  230. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_langgraph_agent.py +0 -0
  231. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_quickstart_failure_to_test.py +0 -0
  232. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_refund_failure_to_test.py +0 -0
  233. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_secure_trace_roundtrip.py +0 -0
  234. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_trace_infrastructure_flow.py +0 -0
  235. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/integration/test_trace_roundtrip.py +0 -0
  236. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/property/.gitkeep +0 -0
  237. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/property/test_trace_properties.py +0 -0
  238. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_canonical.py +0 -0
  239. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_cli.py +0 -0
  240. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_cli_diff.py +0 -0
  241. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_cli_inspect.py +0 -0
  242. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_cli_validate.py +0 -0
  243. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_diff.py +0 -0
  244. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_hashing.py +0 -0
  245. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_inspector.py +0 -0
  246. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_integrity.py +0 -0
  247. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_invalid_bundles.py +0 -0
  248. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_jsonable.py +0 -0
  249. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_llm_request.py +0 -0
  250. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_manifest.py +0 -0
  251. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_recording_session.py +0 -0
  252. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_redaction.py +0 -0
  253. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_replay_plan.py +0 -0
  254. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_replay_tool.py +0 -0
  255. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_schema.py +0 -0
  256. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_storage.py +0 -0
  257. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_trace_models.py +0 -0
  258. {stepfork-0.1.0a5 → stepfork-0.2.0}/tests/unit/test_validation.py +0 -0
@@ -56,6 +56,8 @@ examples/booking_agent/.artifacts/
56
56
  examples/refund_agent/.artifacts/
57
57
  examples/openai_chat/.artifacts/
58
58
  examples/langgraph_agent/.artifacts/
59
+ examples/model_decision/.artifacts/
59
60
 
60
61
  # Quickstart demo artifacts
61
62
  examples/quickstart/.artifacts/
63
+ research_langgraph.py
@@ -4,6 +4,90 @@ All notable changes to Stepfork are recorded here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/), and this project adheres to
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.2.0] - 2026-10-12
8
+
9
+ Automatic failure minimization and fork-at-step debugging with optional overrides.
10
+
11
+ ### Added
12
+
13
+ - **Failure minimization** via `stepfork minimize` command that automatically
14
+ finds the smallest reproducible trace preserving the original failure.
15
+ - Dependency-aware delta debugging algorithm that respects parent-child event
16
+ relationships and structural integrity.
17
+ - Failure signature detection supporting exception-based, replay-divergence,
18
+ and output-mismatch failures.
19
+ - Minimization orchestrator with timeout handling, nondeterminism detection,
20
+ and iteration limits.
21
+ - Comprehensive unit tests, integration tests, and CLI tests for minimization.
22
+ - Complete documentation in `docs/minimize.md` and updated CLI reference.
23
+ - **Fork-at-step** debugging via `stepfork fork` command that creates new traces
24
+ at specific execution points while preserving all valid history before the fork.
25
+ - Fork points can be specified by step number (`--at-step N`) or event ID
26
+ (`--at-event ID`).
27
+ - Typed override system (Python API only) to modify tool_result and llm_response
28
+ outputs in forked traces via `OverrideSpec`.
29
+ - Provenance tracking with `ForkInfo` metadata linking forked traces to parent
30
+ trace, fork point, timestamp, and applied overrides.
31
+ - Structural validation ensures no broken parent dependencies and maintains
32
+ trace integrity.
33
+ - 43 fork-specific tests covering fork engine, overrides, edge cases, and
34
+ integration scenarios.
35
+ - Complete documentation in `docs/fork.md` with CLI and Python API examples.
36
+
37
+ ### Changed
38
+
39
+ - README roadmap updated to reflect v0.2 implementation status.
40
+
41
+ ### Limitations
42
+
43
+ - Minimization requires replay to fail consistently. Highly nondeterministic
44
+ failures may not minimize reliably.
45
+ - Delta debugging uses binary search with dependency preservation. Very large
46
+ traces (1000+ events) may require significant replay attempts.
47
+ - Timeout handling uses SIGALRM on Unix systems; Windows support is limited.
48
+ - Fork-at-step overrides are only available via Python API, not CLI.
49
+ - Fork creates modified traces but does not automatically continue execution from
50
+ the fork point; replay must be invoked separately.
51
+ - Overrides can only modify outputs (tool_result, llm_response), not inputs
52
+ (tool_call arguments or llm_request prompts).
53
+ - No automatic divergence detection when replaying forked traces with overrides.
54
+
55
+ ## [0.1.0a6] - 2026-10-10
56
+
57
+ Behavioral assertions and selective live-model evaluation, with no trace
58
+ format change.
59
+
60
+ ### Added
61
+
62
+ - Public assertions over the actual replay trajectory: tool presence, absence,
63
+ count, arguments, ordering, exact or subsequence matching, and maximum steps.
64
+ Exported pytest tests accept reviewed JSON trajectory expectations.
65
+ - Async recording and frozen replay for instrumented tools, LLM requests,
66
+ agent entrypoints, and supported OpenAI and LangGraph adapter paths.
67
+ - Opt-in hybrid replay that re-executes explicitly selected LLMs while keeping
68
+ recorded tool responses frozen. The offline LangGraph fake-provider example
69
+ demonstrates a model-driven failure and a reviewed regression expectation.
70
+ - Explicit `allow_live_tools` authorization for tool execution in legacy
71
+ `mode="live"`, with matching CLI and pytest-export options.
72
+
73
+ ### Changed
74
+
75
+ - Live replay now denies instrumented tool bodies by default. Existing callers
76
+ that intentionally execute them must name each tool through
77
+ `allow_live_tools={...}` or `--allow-live-tool NAME`. This is an API behavior
78
+ change for live mode; frozen replay remains the default.
79
+
80
+ ### Limitations
81
+
82
+ - Hybrid replay is not deterministic; selected live models may incur network
83
+ calls, token costs, and latency. Changed model output can diverge from the
84
+ recorded tool path rather than finding a different recorded response.
85
+ - A live-tool allowlist does not sandbox arbitrary code or intercept
86
+ uninstrumented side effects. Async concurrent calls retain strict invocation
87
+ order matching, but task scheduling itself is not frozen.
88
+
89
+ [0.1.0a6]: https://github.com/utsab345/stepfork/releases/tag/v0.1.0a6
90
+
7
91
  ## [0.1.0a5] - 2026-10-09
8
92
 
9
93
  Replay correctness and developer trust fixes. No new integrations or trace
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: stepfork
3
- Version: 0.1.0a5
3
+ Version: 0.2.0
4
4
  Summary: Behavioral regression testing for AI agents.
5
5
  Project-URL: Homepage, https://github.com/utsab345/stepfork
6
6
  Project-URL: Repository, https://github.com/utsab345/stepfork
@@ -93,12 +93,43 @@ Compare → Define Expected Behavior → Export pytest → Verify Fix
93
93
  you want frozen with `@trace_tool` or `llm_request`.
94
94
  - **Behavioral diff** compares a buggy run against a corrected run and reports
95
95
  exactly which behaviors changed.
96
+ - **Failure minimization** automatically finds the smallest trace that still
97
+ reproduces a failure via dependency-aware delta debugging.
98
+ - **Fork-at-step** creates new traces at specific execution points with optional
99
+ output overrides for "what-if" debugging scenarios.
96
100
  - **pytest export** turns a recorded failure into a regression test that
97
101
  asserts the corrected behavior.
98
102
  - **Best-effort redaction** of known credential-shaped values at record time.
99
103
  - **Integrity verification** via SHA-256 digests that make tampering evident.
100
104
  - **Python 3.11, 3.12, and 3.13** support.
101
105
 
106
+ ## What a replay can establish
107
+
108
+ | Failure class | Frozen replay | Hybrid replay with a selected live LLM |
109
+ | --- | --- | --- |
110
+ | Deterministic application logic | Reproduces with recorded dependencies | Can test against reviewed output |
111
+ | Tool-result parsing | Reproduces with recorded tool output | Same if the tool remains frozen |
112
+ | Tool arguments and orchestration | Strictly matches recorded calls; trajectory assertions check execution | New tool calls diverge before instrumented tool bodies run |
113
+ | Model judgment | Repeats the recorded answer only | Re-runs the selected model; outcome is variable |
114
+ | Prompt-change evaluation | Rejects a changed prompt as divergence | Allows the selected LLM prompt to change and checks reviewed expectations |
115
+ | Uninstrumented side effects | Not intercepted | Not intercepted |
116
+ | Nondeterministic execution | May diverge when call order changes | May diverge; model output is also variable |
117
+
118
+ **Frozen replay** substitutes recorded dependency responses and tests the
119
+ application logic around them. It cannot prove that a prompt improves model
120
+ quality. **Hybrid replay** explicitly selects LLM boundaries to run again while
121
+ tools stay frozen and strictly matched. It is not deterministic and may incur
122
+ network calls, token cost, and latency. **Live evaluation** means assessing a
123
+ new model response against reviewed output and trajectory expectations; it is a
124
+ testing practice using the hybrid API, not a separate replay mode. See
125
+ [hybrid replay](docs/hybrid.md).
126
+
127
+ The existing `mode="live"` re-executes matching LLM calls. Live tool bodies
128
+ now require explicit authorization by name with `allow_live_tools={...}` or
129
+ `--allow-live-tool NAME`. An authorized tool can send email, charge a card, or
130
+ change an external system; the allowlist does not sandbox it. See
131
+ [live-tool authorization](docs/replay.md#modes) for migration guidance.
132
+
102
133
  ## Installation
103
134
 
104
135
  Stepfork is published on PyPI. Install the current alpha with:
@@ -115,7 +146,7 @@ The `--pre` flag is required while Stepfork is a pre-release. You can also
115
146
  install from the tagged GitHub repository:
116
147
 
117
148
  ```bash
118
- pip install "git+https://github.com/utsab345/stepfork.git@v0.1.0a5"
149
+ pip install "git+https://github.com/utsab345/stepfork.git@v0.1.0a6"
119
150
  ```
120
151
 
121
152
  Requires Python 3.11, 3.12, or 3.13. This installs the `stepfork` CLI and the
@@ -242,7 +273,7 @@ minimal example agent:
242
273
 
243
274
  ![Stepfork terminal demo](scripts/terminal-demo/stepfork-demo.gif)
244
275
 
245
- Five runnable demo agents ship in this repository (all fully offline, with a
276
+ Six runnable demo agents ship in this repository (all fully offline, with a
246
277
  fake provider standing in for a real model):
247
278
 
248
279
  - `examples/quickstart` - a single-tool order-notification agent; the minimal
@@ -255,6 +286,8 @@ fake provider standing in for a real model):
255
286
  fake OpenAI-shaped sync client; no API key or network call required.
256
287
  - `examples/langgraph_agent` - a real LangGraph `StateGraph` traced through the
257
288
  optional LangGraph adapter; makes a wrong refund decision.
289
+ - `examples/model_decision` - a LangGraph model-decision failure tested with
290
+ hybrid replay and a deterministic fake provider.
258
291
 
259
292
  ```bash
260
293
  git clone https://github.com/utsab345/stepfork.git
@@ -265,14 +298,47 @@ uv run python examples/booking_agent/demo.py
265
298
  uv run python examples/refund_agent/demo.py
266
299
  uv run python examples/openai_chat/demo.py
267
300
  uv run python examples/langgraph_agent/demo.py
301
+ uv run python examples/model_decision/demo.py
268
302
  ```
269
303
 
270
- Each demo records the buggy run, freeze-replays it without touching the
271
- external dependency body, diffs it against the corrected run, and exports a
272
- regression test that fails on the buggy entrypoint and passes on the fixed one.
304
+ Each demo records a buggy run and exports a regression test that fails on the
305
+ buggy entrypoint and passes on the fixed one. The model-decision example also
306
+ shows the limit of frozen replay and a selected live LLM in hybrid replay.
273
307
  The demos print real results from real subprocesses; they never fabricate
274
308
  output.
275
309
 
310
+ ## Real-LLM Case Study: The Model Was Right, the Agent Was Wrong
311
+
312
+ A complete, offline-reproducible example of Stepfork in practice. A real Google
313
+ Gemini 2.5 Flash request (`gemini-2.5-flash` through the OpenAI SDK adapter)
314
+ correctly classified a synthetic production checkout incident as **P0**. A
315
+ deliberately introduced three-line Python postprocessing bug then downgraded
316
+ that to **P1** and disabled escalation. Stepfork recorded the LLM interaction
317
+ and the instrumented tool calls, and a generated pytest regression test failed
318
+ against the buggy logic and passed after the fix - using the same recorded
319
+ trace.
320
+
321
+ Frozen replay made **zero** additional model requests and executed **zero**
322
+ instrumented tool bodies.
323
+
324
+ ```text
325
+ Real Gemini response: P0
326
+ Buggy application: P1, escalation=false
327
+ Regression test: FAILED
328
+
329
+ Fixed application: P0, escalation=true
330
+ Same regression test: PASSED
331
+
332
+ Additional LLM calls during frozen replay: 0
333
+ ```
334
+
335
+ Start with the example
336
+ [README](examples/real-llm-case-study/README.md) or read the full
337
+ [CASE_STUDY.md](examples/real-llm-case-study/CASE_STUDY.md). The incident and
338
+ operational data are synthetic and the application bug was introduced on
339
+ purpose; only the model request was real. Stepfork does not know the correct
340
+ business outcome - it lives in `expected.json`, defined by a human.
341
+
276
342
  ## CLI Reference
277
343
 
278
344
  | Command | Purpose |
@@ -281,7 +347,7 @@ output.
281
347
  | `stepfork inspect [PATH] [--json] [--events] [--errors-only] [--step N]` | Review a bundle locally. |
282
348
  | `stepfork replay [PATH] --entrypoint MODULE:FUNCTION [--mode M]` | Rerun the entrypoint with dependencies answered from the trace. |
283
349
  | `stepfork diff [BASELINE] [CANDIDATE] [--json]` | Compare the behavior of two runs. |
284
- | `stepfork export [PATH] --pytest --entrypoint MODULE:FUNCTION [--expect-output JSON] [--output FILE] [--overwrite]` | Generate an executable pytest regression test. |
350
+ | `stepfork export [PATH] --pytest --entrypoint MODULE:FUNCTION [--expect-output JSON] [--expect-trajectory JSON] [--output FILE] [--overwrite]` | Generate an executable pytest regression test. |
285
351
 
286
352
  The full reference (arguments, examples, expected output, and common errors)
287
353
  is in [docs/cli.md](docs/cli.md).
@@ -333,7 +399,7 @@ sources live in `docs/`.
333
399
  - [Release checklist](docs/release-checklist.md)
334
400
  - [PyPI publishing checklist](docs/pypi-publishing.md)
335
401
  - [Early adopter guide](docs/community/early-adopter-guide.md)
336
- - [Latest release notes (v0.1.0a5)](docs/releases/v0.1.0a5.md)
402
+ - [Latest release notes (v0.1.0a6)](docs/releases/v0.1.0a6.md)
337
403
  - [Changelog](CHANGELOG.md)
338
404
 
339
405
  ## Security and Limitations
@@ -343,19 +409,17 @@ before v1.0.
343
409
 
344
410
  - **Alpha on PyPI.** `pip install --pre stepfork` installs the current
345
411
  pre-release; the API and trace format may still change.
346
- - **No automatic failure minimization.** The exported regression test uses the
347
- recorded steps. Reducing it to the smallest failing subset and fork-at-step
348
- are planned work, not automatic behavior.
349
412
  - **Limited integrations.** Optional adapters cover the OpenAI Python SDK
350
- (synchronous, non-streaming `chat.completions.create`) and LangGraph
351
- (synchronous `BaseChatModel` generation and function-based tools). OpenAI
352
- Agents, MCP, streaming, async, and other providers are planned work. See
413
+ (synchronous and asynchronous, non-streaming `chat.completions.create`) and
414
+ LangGraph (synchronous and asynchronous `BaseChatModel` generation and
415
+ function-based tools). OpenAI Agents, MCP, streaming, and other providers
416
+ are planned work. See
353
417
  [docs/integrations.md](docs/integrations.md).
354
418
  - **Replay is not a sandbox.** Running an entrypoint under replay executes
355
419
  your own code with your own privileges. Trace data is never executed, but
356
420
  the entrypoint you name is.
357
421
  - **Only instrumented boundaries are frozen.** Frozen replay substitutes calls
358
- made through `@trace_tool` and `llm_request`. Any external call your code
422
+ made through `@trace_tool`, `llm_request`, and `allm_request`. Any external call your code
359
423
  makes outside those boundaries is not recorded and is not intercepted.
360
424
  - **Redaction is best-effort.** Pattern-based redaction can miss sensitive
361
425
  information embedded in unusual tool outputs or domain-specific payloads.
@@ -390,11 +454,11 @@ bundles, are in [docs/security.md](docs/security.md).
390
454
  - Offline examples for both adapters
391
455
  - Example GitHub Actions regression workflow
392
456
 
393
- ### v0.2
457
+ ### v0.2 (Current)
394
458
 
395
- - Failure minimization
396
- - Fork-at-step
397
- - Baselines
459
+ - **Failure minimization** - Automatic delta debugging to find minimal traces ([docs/minimize.md](docs/minimize.md))
460
+ - **Fork-at-step** - Create new traces at specific execution points with optional overrides ([docs/fork.md](docs/fork.md))
461
+ - Baselines (planned)
398
462
 
399
463
  ### v0.3
400
464
 
@@ -62,12 +62,43 @@ Compare → Define Expected Behavior → Export pytest → Verify Fix
62
62
  you want frozen with `@trace_tool` or `llm_request`.
63
63
  - **Behavioral diff** compares a buggy run against a corrected run and reports
64
64
  exactly which behaviors changed.
65
+ - **Failure minimization** automatically finds the smallest trace that still
66
+ reproduces a failure via dependency-aware delta debugging.
67
+ - **Fork-at-step** creates new traces at specific execution points with optional
68
+ output overrides for "what-if" debugging scenarios.
65
69
  - **pytest export** turns a recorded failure into a regression test that
66
70
  asserts the corrected behavior.
67
71
  - **Best-effort redaction** of known credential-shaped values at record time.
68
72
  - **Integrity verification** via SHA-256 digests that make tampering evident.
69
73
  - **Python 3.11, 3.12, and 3.13** support.
70
74
 
75
+ ## What a replay can establish
76
+
77
+ | Failure class | Frozen replay | Hybrid replay with a selected live LLM |
78
+ | --- | --- | --- |
79
+ | Deterministic application logic | Reproduces with recorded dependencies | Can test against reviewed output |
80
+ | Tool-result parsing | Reproduces with recorded tool output | Same if the tool remains frozen |
81
+ | Tool arguments and orchestration | Strictly matches recorded calls; trajectory assertions check execution | New tool calls diverge before instrumented tool bodies run |
82
+ | Model judgment | Repeats the recorded answer only | Re-runs the selected model; outcome is variable |
83
+ | Prompt-change evaluation | Rejects a changed prompt as divergence | Allows the selected LLM prompt to change and checks reviewed expectations |
84
+ | Uninstrumented side effects | Not intercepted | Not intercepted |
85
+ | Nondeterministic execution | May diverge when call order changes | May diverge; model output is also variable |
86
+
87
+ **Frozen replay** substitutes recorded dependency responses and tests the
88
+ application logic around them. It cannot prove that a prompt improves model
89
+ quality. **Hybrid replay** explicitly selects LLM boundaries to run again while
90
+ tools stay frozen and strictly matched. It is not deterministic and may incur
91
+ network calls, token cost, and latency. **Live evaluation** means assessing a
92
+ new model response against reviewed output and trajectory expectations; it is a
93
+ testing practice using the hybrid API, not a separate replay mode. See
94
+ [hybrid replay](docs/hybrid.md).
95
+
96
+ The existing `mode="live"` re-executes matching LLM calls. Live tool bodies
97
+ now require explicit authorization by name with `allow_live_tools={...}` or
98
+ `--allow-live-tool NAME`. An authorized tool can send email, charge a card, or
99
+ change an external system; the allowlist does not sandbox it. See
100
+ [live-tool authorization](docs/replay.md#modes) for migration guidance.
101
+
71
102
  ## Installation
72
103
 
73
104
  Stepfork is published on PyPI. Install the current alpha with:
@@ -84,7 +115,7 @@ The `--pre` flag is required while Stepfork is a pre-release. You can also
84
115
  install from the tagged GitHub repository:
85
116
 
86
117
  ```bash
87
- pip install "git+https://github.com/utsab345/stepfork.git@v0.1.0a5"
118
+ pip install "git+https://github.com/utsab345/stepfork.git@v0.1.0a6"
88
119
  ```
89
120
 
90
121
  Requires Python 3.11, 3.12, or 3.13. This installs the `stepfork` CLI and the
@@ -211,7 +242,7 @@ minimal example agent:
211
242
 
212
243
  ![Stepfork terminal demo](scripts/terminal-demo/stepfork-demo.gif)
213
244
 
214
- Five runnable demo agents ship in this repository (all fully offline, with a
245
+ Six runnable demo agents ship in this repository (all fully offline, with a
215
246
  fake provider standing in for a real model):
216
247
 
217
248
  - `examples/quickstart` - a single-tool order-notification agent; the minimal
@@ -224,6 +255,8 @@ fake provider standing in for a real model):
224
255
  fake OpenAI-shaped sync client; no API key or network call required.
225
256
  - `examples/langgraph_agent` - a real LangGraph `StateGraph` traced through the
226
257
  optional LangGraph adapter; makes a wrong refund decision.
258
+ - `examples/model_decision` - a LangGraph model-decision failure tested with
259
+ hybrid replay and a deterministic fake provider.
227
260
 
228
261
  ```bash
229
262
  git clone https://github.com/utsab345/stepfork.git
@@ -234,14 +267,47 @@ uv run python examples/booking_agent/demo.py
234
267
  uv run python examples/refund_agent/demo.py
235
268
  uv run python examples/openai_chat/demo.py
236
269
  uv run python examples/langgraph_agent/demo.py
270
+ uv run python examples/model_decision/demo.py
237
271
  ```
238
272
 
239
- Each demo records the buggy run, freeze-replays it without touching the
240
- external dependency body, diffs it against the corrected run, and exports a
241
- regression test that fails on the buggy entrypoint and passes on the fixed one.
273
+ Each demo records a buggy run and exports a regression test that fails on the
274
+ buggy entrypoint and passes on the fixed one. The model-decision example also
275
+ shows the limit of frozen replay and a selected live LLM in hybrid replay.
242
276
  The demos print real results from real subprocesses; they never fabricate
243
277
  output.
244
278
 
279
+ ## Real-LLM Case Study: The Model Was Right, the Agent Was Wrong
280
+
281
+ A complete, offline-reproducible example of Stepfork in practice. A real Google
282
+ Gemini 2.5 Flash request (`gemini-2.5-flash` through the OpenAI SDK adapter)
283
+ correctly classified a synthetic production checkout incident as **P0**. A
284
+ deliberately introduced three-line Python postprocessing bug then downgraded
285
+ that to **P1** and disabled escalation. Stepfork recorded the LLM interaction
286
+ and the instrumented tool calls, and a generated pytest regression test failed
287
+ against the buggy logic and passed after the fix - using the same recorded
288
+ trace.
289
+
290
+ Frozen replay made **zero** additional model requests and executed **zero**
291
+ instrumented tool bodies.
292
+
293
+ ```text
294
+ Real Gemini response: P0
295
+ Buggy application: P1, escalation=false
296
+ Regression test: FAILED
297
+
298
+ Fixed application: P0, escalation=true
299
+ Same regression test: PASSED
300
+
301
+ Additional LLM calls during frozen replay: 0
302
+ ```
303
+
304
+ Start with the example
305
+ [README](examples/real-llm-case-study/README.md) or read the full
306
+ [CASE_STUDY.md](examples/real-llm-case-study/CASE_STUDY.md). The incident and
307
+ operational data are synthetic and the application bug was introduced on
308
+ purpose; only the model request was real. Stepfork does not know the correct
309
+ business outcome - it lives in `expected.json`, defined by a human.
310
+
245
311
  ## CLI Reference
246
312
 
247
313
  | Command | Purpose |
@@ -250,7 +316,7 @@ output.
250
316
  | `stepfork inspect [PATH] [--json] [--events] [--errors-only] [--step N]` | Review a bundle locally. |
251
317
  | `stepfork replay [PATH] --entrypoint MODULE:FUNCTION [--mode M]` | Rerun the entrypoint with dependencies answered from the trace. |
252
318
  | `stepfork diff [BASELINE] [CANDIDATE] [--json]` | Compare the behavior of two runs. |
253
- | `stepfork export [PATH] --pytest --entrypoint MODULE:FUNCTION [--expect-output JSON] [--output FILE] [--overwrite]` | Generate an executable pytest regression test. |
319
+ | `stepfork export [PATH] --pytest --entrypoint MODULE:FUNCTION [--expect-output JSON] [--expect-trajectory JSON] [--output FILE] [--overwrite]` | Generate an executable pytest regression test. |
254
320
 
255
321
  The full reference (arguments, examples, expected output, and common errors)
256
322
  is in [docs/cli.md](docs/cli.md).
@@ -302,7 +368,7 @@ sources live in `docs/`.
302
368
  - [Release checklist](docs/release-checklist.md)
303
369
  - [PyPI publishing checklist](docs/pypi-publishing.md)
304
370
  - [Early adopter guide](docs/community/early-adopter-guide.md)
305
- - [Latest release notes (v0.1.0a5)](docs/releases/v0.1.0a5.md)
371
+ - [Latest release notes (v0.1.0a6)](docs/releases/v0.1.0a6.md)
306
372
  - [Changelog](CHANGELOG.md)
307
373
 
308
374
  ## Security and Limitations
@@ -312,19 +378,17 @@ before v1.0.
312
378
 
313
379
  - **Alpha on PyPI.** `pip install --pre stepfork` installs the current
314
380
  pre-release; the API and trace format may still change.
315
- - **No automatic failure minimization.** The exported regression test uses the
316
- recorded steps. Reducing it to the smallest failing subset and fork-at-step
317
- are planned work, not automatic behavior.
318
381
  - **Limited integrations.** Optional adapters cover the OpenAI Python SDK
319
- (synchronous, non-streaming `chat.completions.create`) and LangGraph
320
- (synchronous `BaseChatModel` generation and function-based tools). OpenAI
321
- Agents, MCP, streaming, async, and other providers are planned work. See
382
+ (synchronous and asynchronous, non-streaming `chat.completions.create`) and
383
+ LangGraph (synchronous and asynchronous `BaseChatModel` generation and
384
+ function-based tools). OpenAI Agents, MCP, streaming, and other providers
385
+ are planned work. See
322
386
  [docs/integrations.md](docs/integrations.md).
323
387
  - **Replay is not a sandbox.** Running an entrypoint under replay executes
324
388
  your own code with your own privileges. Trace data is never executed, but
325
389
  the entrypoint you name is.
326
390
  - **Only instrumented boundaries are frozen.** Frozen replay substitutes calls
327
- made through `@trace_tool` and `llm_request`. Any external call your code
391
+ made through `@trace_tool`, `llm_request`, and `allm_request`. Any external call your code
328
392
  makes outside those boundaries is not recorded and is not intercepted.
329
393
  - **Redaction is best-effort.** Pattern-based redaction can miss sensitive
330
394
  information embedded in unusual tool outputs or domain-specific payloads.
@@ -359,11 +423,11 @@ bundles, are in [docs/security.md](docs/security.md).
359
423
  - Offline examples for both adapters
360
424
  - Example GitHub Actions regression workflow
361
425
 
362
- ### v0.2
426
+ ### v0.2 (Current)
363
427
 
364
- - Failure minimization
365
- - Fork-at-step
366
- - Baselines
428
+ - **Failure minimization** - Automatic delta debugging to find minimal traces ([docs/minimize.md](docs/minimize.md))
429
+ - **Fork-at-step** - Create new traces at specific execution points with optional overrides ([docs/fork.md](docs/fork.md))
430
+ - Baselines (planned)
367
431
 
368
432
  ### v0.3
369
433
 
@@ -1,7 +1,7 @@
1
1
  # CLI Reference
2
2
 
3
3
  The `stepfork` CLI manages `.sftrace` bundles. This page documents every
4
- command as of v0.1.0a5. Run `stepfork --help` for an up-to-date summary.
4
+ command as of v0.1.0a6. Run `stepfork --help` for an up-to-date summary.
5
5
 
6
6
  ```text
7
7
  Usage: stepfork [OPTIONS] COMMAND [ARGS]...
@@ -21,6 +21,7 @@ Commands:
21
21
  - [validate](#validate)
22
22
  - [inspect](#inspect)
23
23
  - [replay](#replay)
24
+ - [minimize](#minimize)
24
25
  - [diff](#diff)
25
26
  - [export](#export)
26
27
 
@@ -183,6 +184,7 @@ Options:
183
184
  |---|---|
184
185
  | `--entrypoint <str>` | Trusted local `MODULE:FUNCTION` to execute under replay. Required. |
185
186
  | `--mode <str>` | Replay mode: `frozen`, `live`, `forbidden`, or `manual`. Default `frozen`. |
187
+ | `--allow-live-tool <name>` | Authorize a named tool to execute in `live` mode. Repeat for each tool. |
186
188
  | `--verbose` | Show full diagnostic fingerprints instead of abbreviated ones. |
187
189
  | `--help` | Show command help and exit. |
188
190
 
@@ -190,7 +192,9 @@ Modes:
190
192
 
191
193
  - `frozen` answers every dependency call from the recording; mismatches fail
192
194
  loudly (recommended for regression work).
193
- - `live` lets unrecorded calls pass through to the real dependency.
195
+ - `live` re-executes matching LLM calls. Matching tools run only when named by
196
+ `--allow-live-tool`; other tool calls fail before their bodies run. It does
197
+ not allow unrecorded calls.
194
198
  - `forbidden` rejects any dependency call.
195
199
  - `manual` requires approval for each call.
196
200
  - `derived` exists in the data model but is not supported in v0.1.
@@ -237,6 +241,92 @@ Common errors:
237
241
 
238
242
  ---
239
243
 
244
+ ## minimize
245
+
246
+ Minimize a failing trace to the smallest reproducible subset.
247
+
248
+ ```text
249
+ Usage: stepfork minimize [OPTIONS] PATH --entrypoint MODULE:FUNCTION
250
+ ```
251
+
252
+ Arguments:
253
+
254
+ | Argument | Description |
255
+ |---|---|
256
+ | `PATH` | Path to the `.sftrace` directory bundle to minimize. Required. |
257
+ | `--entrypoint`, `-e` | Agent entrypoint as `MODULE:FUNCTION`. Required. |
258
+
259
+ Options:
260
+
261
+ | Option | Description |
262
+ |---|---|
263
+ | `--expect-output FILE` | JSON file with expected output for comparison. |
264
+ | `--mode`, `-m` | Replay mode: `frozen`, `live`, or `hybrid`. Default: `frozen`. |
265
+ | `--output`, `-o` | Path for the minimized `.sftrace` bundle. Default: `<path>-minimized.sftrace`. |
266
+ | `--overwrite` | Overwrite the output bundle if it exists. Default: `false`. |
267
+ | `--timeout SECONDS` | Timeout in seconds for each replay attempt. Default: `30.0`. |
268
+ | `--attempts N` | Number of attempts per subset test (for nondeterminism). Default: `1`. |
269
+ | `--help` | Show command help and exit. |
270
+
271
+ Minimization uses dependency-aware delta debugging to find the smallest set of
272
+ events that preserves the original failure. The process:
273
+
274
+ 1. Detects the failure signature by replaying the original trace
275
+ 2. Systematically tests smaller event subsets while preserving dependencies
276
+ 3. Verifies the minimized trace reproduces the same failure
277
+ 4. Saves the minimal trace and reports reduction statistics
278
+
279
+ Example:
280
+
281
+ ```bash
282
+ echo '{"order_id": "ORD-1001", "should_notify": true}' > expected.json
283
+
284
+ stepfork minimize failure.sftrace \
285
+ --entrypoint quickstart:run_agent \
286
+ --expect-output expected.json \
287
+ --output minimal.sftrace
288
+ ```
289
+
290
+ ```text
291
+ Stepfork Minimize
292
+
293
+ Original trace: failure.sftrace
294
+ Agent: notify-agent
295
+ Events: 8
296
+ Entrypoint: quickstart:run_agent
297
+ Mode: frozen
298
+
299
+ Detecting failure signature...
300
+ Minimizing trace...
301
+
302
+ ╭─ Minimization Report ─────────╮
303
+ │ Original Events 8 │
304
+ │ Minimized Events 5 │
305
+ │ Reduction 37.5% │
306
+ │ Replay Attempts 15 │
307
+ │ Failure Signature Output Mismatch │
308
+ │ Minimal Yes │
309
+ ╰────────────────────────────────╯
310
+
311
+ ✓ Minimized trace saved to: minimal.sftrace
312
+ ```
313
+
314
+ Exit codes:
315
+
316
+ - `0` minimization succeeded and produced a valid minimal trace.
317
+ - `1` minimization failed (no failure detected, or minimization error).
318
+ - `2` invalid input, unreadable trace, or unresolvable entrypoint.
319
+
320
+ Common errors:
321
+
322
+ - `Failed to detect original failure signature: trace replay completed successfully; no failure to minimize` - the trace does not fail when replayed.
323
+ - `cannot resolve entrypoint ...` - the entrypoint specification is invalid or the module cannot be imported.
324
+ - `Minimized trace does not reproduce the original failure` - rare internal error during delta debugging.
325
+
326
+ See [docs/minimize.md](minimize.md) for detailed documentation and examples.
327
+
328
+ ---
329
+
240
330
  ## diff
241
331
 
242
332
  Compare the behavior of two recorded agent runs.
@@ -302,9 +392,11 @@ Options:
302
392
  | `--pytest` / `--no-pytest` | Export a pytest test (the only v0.1 format). |
303
393
  | `--entrypoint <str>` | Trusted local `MODULE:FUNCTION` the generated test executes. |
304
394
  | `--expect-output <path>` | JSON file defining the expected regression outcome. |
395
+ | `--expect-trajectory <path>` | Reviewed JSON file defining tool and step assertions. |
305
396
  | `--output <path>` | Destination test file. Default `./test_<trace>_regression.py`. |
306
397
  | `--overwrite` | Replace the output file if it already exists. |
307
398
  | `--mode <str>` | Replay mode used by the generated test. Default `frozen`. |
399
+ | `--allow-live-tool <name>` | Embed authorization for a named tool in a generated `live` test. Repeat for each tool. |
308
400
  | `--help` | Show command help and exit. |
309
401
 
310
402
  Example:
@@ -341,6 +433,7 @@ Common errors:
341
433
  - `An executable regression test needs --entrypoint MODULE:FUNCTION.`
342
434
  - `<path> already exists; pass --overwrite to replace it.`
343
435
  - `--expect-output is not valid JSON: <detail>`.
436
+ - `Invalid --expect-trajectory: <detail>` when the JSON shape is unsupported.
344
437
 
345
438
  ---
346
439
 
@@ -39,7 +39,7 @@ stepfork --version
39
39
 
40
40
  The `--pre` flag is required while Stepfork is a pre-release. Alternatively,
41
41
  install the tagged repository build:
42
- `pip install "git+https://github.com/utsab345/stepfork.git@v0.1.0a5"`.
42
+ `pip install "git+https://github.com/utsab345/stepfork.git@v0.1.0a6"`.
43
43
 
44
44
  Requires Python 3.11, 3.12, or 3.13.
45
45
 
@@ -17,7 +17,7 @@ uv run pytest --cov=stepfork --cov-branch --cov-report=term-missing
17
17
  uv build
18
18
  ```
19
19
 
20
- The suite currently has 415 tests and 93% combined statement/branch coverage, including
20
+ The suite currently has 444 tests and 92% combined statement/branch coverage, including
21
21
  Hypothesis property tests under `tests/property/`.
22
22
 
23
23
  Format changed files: