Skip to content

Conversation

@shentongmartin
Copy link
Contributor

@shentongmartin shentongmartin commented Dec 19, 2025

Summary

This PR enables automatic persistence of node inputs when a graph is interrupted using WithGraphInterrupt, allowing nodes to be correctly re-run with their original inputs when resuming from a checkpoint.

Problem

When a graph is interrupted externally via WithGraphInterrupt, the interrupted nodes need to be re-run on resume. However, without persisting the original inputs, the re-run nodes would receive empty or incorrect inputs, leading to incorrect behavior.

Solution

  • Auto-enable persistRerunInput: When WithGraphInterrupt is used, the taskManager automatically enables input persistence for nodes that may need to be re-run
  • Stream input handling: For streaming inputs, the stream is tee'd (copied) so the original input can be persisted while the node processes its copy
  • Context-based inheritance: Subgraphs automatically inherit the behavior through Go's context propagation - no explicit configuration needed

Key Changes

File Changes
compose/graph_manager.go Added persistRerunInput field to taskManager, persist originalInput before node execution
compose/graph_run.go Set persistRerunInput = true when WithGraphInterrupt context is detected
compose/checkpoint_test.go Added comprehensive tests for input persistence scenarios

Behavior

Scenario Input Persistence
WithGraphInterrupt used ✅ Enabled automatically
WithGraphInterrupt NOT used ❌ Disabled (no overhead)
Subgraph with parent using WithGraphInterrupt ✅ Inherited via context

@shentongmartin shentongmartin changed the title Feat/rerun input feat(compose): persist rerun node inputs in checkpoint Dec 19, 2025
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.30%. Comparing base (e26deff) to head (90fc876).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
compose/graph_manager.go 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #634      +/-   ##
==========================================
+ Coverage   80.41%   81.30%   +0.88%     
==========================================
  Files         124      124              
  Lines       11906    11921      +15     
==========================================
+ Hits         9574     9692     +118     
+ Misses       1601     1505      -96     
+ Partials      731      724       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shentongmartin shentongmartin force-pushed the feat/rerun_input branch 3 times, most recently from 0087cde to 60f6442 Compare December 19, 2025 06:32
@shentongmartin shentongmartin force-pushed the feat/rerun_input branch 2 times, most recently from 74c2ada to 3332064 Compare January 6, 2026 13:40
Change-Id: Ifaeb43829a970fb3c0d372fed566861aaae17acc
Change-Id: I0b0e8a5d4a2970289eb6f48021f6ed047f6ebec4
- Modified initTaskManager to automatically enable PersistRerunInput when
  WithGraphInterrupt is used and no explicit CheckpointConfig is set
- This makes external interrupts work correctly by preserving node inputs
- User's explicit CheckpointConfig settings are still respected
- Added TestToolsNodeWithExternalGraphInterrupt test
- Added TestExternalInterruptRespectsExplicitPersistRerunInputFalse test
- Updated TestCancelInterrupt expectations to reflect new behavior

Change-Id: I63d0c1812a5b20934eb6b7c62f53f55299a0c9d5
…nput with WithGraphInterrupt

- Remove CheckpointConfig struct and WithCheckpointConfig option
- Replace checkpointConfig field with persistRerunInput bool in taskManager
- Auto-enable persistRerunInput when WithGraphInterrupt is used
- Subgraphs inherit behavior through context propagation
- Update tests to use WithGraphInterrupt pattern

Change-Id: I15c3e10d815b5aa39768e6fdee1407025e5ea542
@shentongmartin shentongmartin merged commit 39eabc0 into main Jan 13, 2026
19 checks passed
@shentongmartin shentongmartin deleted the feat/rerun_input branch January 13, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants