Skip to content

Feat/time travel execution#1303

Closed
vakrahul wants to merge 21 commits intoaden-hive:mainfrom
vakrahul:feat/time-travel-execution
Closed

Feat/time travel execution#1303
vakrahul wants to merge 21 commits intoaden-hive:mainfrom
vakrahul:feat/time-travel-execution

Conversation

@vakrahul
Copy link
Contributor

Description

This PR transforms the GraphExecutor from a linear runner into a Time-Travel Execution Engine. It introduces the ability to snapshot state at every step, rewind execution, and "fork" new execution paths from previous states. This is a foundational feature for advanced debugging and "Human-in-the-Loop" optimizations.

Additionally, this PR applies comprehensive linting fixes to executor.py and node.py to satisfy ruff requirements (fixing line lengths, import sorting, and trailing newlines).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes - linting fixes)

Related Issues

Fixes #949

Changes Made

1. Time-Travel Logic (core/framework/graph/executor.py)

  • ExecutionSnapshot: Added a dataclass to store immutable point-in-time state (step index, node ID, memory copy, timestamp).
  • History Tracking: Updated the execute loop to capture a SharedMemory.snapshot() before every node execution and append it to ExecutionResult.history.
  • fork_execution API: Implemented a method to resume execution from any snapshot. It restores the memory state, sets the entry point to the snapshot's node, and allows injecting input_overrides to fix data on the fly.

2. Memory Management (core/framework/graph/node.py)

  • Immutable Snapshots: Added SharedMemory.snapshot() which uses copy.deepcopy to ensure forked execution branches do not mutate the history of the original run.

3. Code Quality & Linting

  • executor.py: Restored type safety checks for session state and fixed all ruff errors (line lengths, newlines).
  • node.py: Fixed severe line length violations (E501), sorted imports (I001), and ensured proper formatting for complex Pydantic field definitions and logger messages.

Testing

Describe the tests you ran to verify your changes:

  • Unit tests pass (cd core && pytest tests/)
  • Lint passes (cd core && ruff check framework/graph/executor.py framework/graph/node.py)
  • Manual testing performed: Verified fork_execution successfully resumes from a specific node ID with restored memory.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from a13d26f to b5c43a4 Compare January 27, 2026 14:42
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from 619f618 to 73e46a5 Compare January 27, 2026 15:47
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from e6c2f12 to 1df0a6f Compare January 27, 2026 15:52
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch 2 times, most recently from c740807 to 582c1fe Compare January 27, 2026 16:26
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from fdf51cc to 77b07fe Compare January 27, 2026 16:33
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from 80e0943 to e0b4abd Compare January 27, 2026 16:40
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from 287e69c to 5e4b019 Compare January 27, 2026 17:00
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from 56cd026 to beb29ec Compare January 27, 2026 17:43
@vakrahul vakrahul force-pushed the feat/time-travel-execution branch from ec42839 to 961c1db Compare January 28, 2026 01:25
@vakrahul
Copy link
Contributor Author

hi @bryanadenhq i need help what is the main cause in this i was trying since couple of hours

@vakrahul vakrahul closed this Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(core): Implement "Time-Travel" Execution Engine with State Forking

1 participant