Skip to content

Conversation

open-swe[bot]
Copy link
Contributor

@open-swe open-swe bot commented Aug 6, 2025

Fixes #683

Overview

This pull request introduces a comprehensive token data persistence mechanism for OpenSWE graphs, enabling:

  • Extracting token usage data from GitHub issues
  • Initializing graph states with persisted token data
  • Updating GitHub issues with current token usage
  • Supporting both replace and merge modes for token data management

Key Changes

  1. Token Data Reducer Enhancement

    • Added replaceMode to tokenDataReducer
    • Supports complete state replacement or merging
    • Maintains backward compatibility
  2. GitHub Issue Utilities

    • Created functions to extract and persist token data
    • Added special XML-like tags for token data storage
    • Integrated with existing issue update mechanisms
  3. Graph Initialization

    • Added token data initialization nodes for both planner and programmer graphs
    • Reads token data from GitHub issues at graph startup
    • Ensures clean state initialization
  4. Graph Completion

    • Created token data update nodes for both graphs
    • Persists token usage back to the GitHub issue
    • Handles different graph completion scenarios
  5. Type System Updates

    • Enhanced type definitions to support new token data format
    • Ensured type safety across reducers and graph nodes

Testing

  • Comprehensive unit tests for token data reducer
  • End-to-end tests for token data persistence
  • Verified build and type compatibility
  • Tested extraction, replacement, and merging behaviors

Benefits

  • Improved token usage tracking across graph runs
  • Persistent state management for AI-driven development
  • Flexible and type-safe implementation
  • Minimal changes to existing graph architectures

Resolves token data persistence and tracking challenges in the OpenSWE system.

@open-swe open-swe bot added the open-swe Create a new Open SWE run on the selected issue label Aug 6, 2025
Copy link

vercel bot commented Aug 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
open-swe-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 6, 2025 6:26pm
open-swe-web-langgraph ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 6, 2025 6:26pm

@open-swe open-swe bot marked this pull request as ready for review August 6, 2025 18:23
@open-swe open-swe bot changed the title [WIP]: Update token counting logic to persist in GitHub issues instead of state feat: Add token data persistence across OpenSWE graphs Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-swe Create a new Open SWE run on the selected issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update token counting logic
1 participant