Skip to content

feat: add progress bar to experiments#730

Open
colodenn wants to merge 3 commits intolangfuse:mainfrom
colodenn:corny/progressbar
Open

feat: add progress bar to experiments#730
colodenn wants to merge 3 commits intolangfuse:mainfrom
colodenn:corny/progressbar

Conversation

@colodenn
Copy link

@colodenn colodenn commented Feb 12, 2026

Problem

When running experiments with many items, developers have no feedback on progress or estimated time. A progress bar has been requested in langfuse/langfuse#11718 so we can see:

  • how many items have been processed
  • percentage complete
  • estimated time remaining

Changes

  • Progress bar: TTY-style progress bar for experiment runs in Node.js when stderr is a TTY (e.g. Experiment [:bar] :current/:total :percent :eta)
  • progress option: new experiment.run({ progress?: boolean }) to control behavior
  • Optional dependency: progress is in optionalDependencies so it doesn’t block browser or edge usage. If the import fails, the experiment runs without the bar.
  • Tests: E2E tests for progress: true and progress: false in tests/e2e/experiments.e2e.test.ts
CleanShot 2026-02-12 at 20 08 22@2x

Release info Sub-libraries affected

Bump level

  • Major
  • Minor
  • Patch

Libraries affected

  • All of them
  • langfuse
  • langfuse-node

Changelog notes

  • experiment: Added optional progress bar for experiment runs in Node.js with a TTY. Use progress: true to show it even when not a TTY, or progress: false to disable it.

Important

Adds optional TTY-style progress bar for experiment runs in Node.js with a progress option in ExperimentParams and tests for its functionality.

  • Behavior:
    • Adds a TTY-style progress bar for experiment runs in Node.js when stderr is a TTY, using progress package.
    • Introduces progress option in ExperimentParams to control progress bar visibility.
    • Progress bar updates after each item completes in ExperimentManager.run().
  • Dependencies:
    • Adds progress as an optionalDependency in package.json.
    • Adds @types/progress as a devDependency.
  • Error Handling:
    • Implements try-catch for dynamic import of progress in ExperimentManager.ts.
  • Tests:
    • Adds E2E tests for progress bar enabled/disabled states in experiments.e2e.test.ts.

This description was created by Ellipsis for 96c98f3. You can customize this summary. It will automatically update as commits are pushed.


Disclaimer: Experimental PR review

Greptile Overview

Greptile Summary

This PR adds an optional TTY-style progress bar for experiment runs in Node.js. The implementation uses the progress package as an optional dependency to avoid blocking browser or edge environments. The progress bar displays current/total items, percentage, and ETA during experiment execution.

Critical Issues:

  • Duplicate if (canShowBar) statement on lines 213-214 creates a syntax error
  • Extra closing brace on line 231 due to the duplicate if statement
  • Dynamic import of progress module violates the project's style guideline requiring imports at module top

Approach:

  • Progress bar defaults to showing when stderr is a TTY, can be controlled via progress option
  • Optional dependency pattern ensures graceful degradation when module is unavailable
  • Tests added for both enabled and disabled states

Confidence Score: 2/5

  • This PR has critical syntax errors that will prevent it from compiling or running correctly
  • The duplicate if statement and extra closing brace create syntax errors that must be fixed before merging. Additionally, the dynamic import pattern violates the project's style guidelines.
  • Pay close attention to packages/client/src/experiment/ExperimentManager.ts - contains duplicate conditional and extra brace causing syntax errors

Important Files Changed

Filename Overview
packages/client/src/experiment/ExperimentManager.ts Added progress bar with duplicate if statement and extra closing brace causing syntax errors; dynamic import violates style guide
packages/client/src/experiment/types.ts Added progress parameter with clear documentation
packages/client/package.json Added progress as optional dependency and @types/progress as dev dependency

Sequence Diagram

sequenceDiagram
    participant User
    participant ExperimentManager
    participant ProgressBar
    participant Task

    User->>ExperimentManager: run(config with progress option)
    ExperimentManager->>ExperimentManager: Check progressOption & TTY
    alt canShowBar is true
        ExperimentManager->>ProgressBar: import("progress")
        ProgressBar-->>ExperimentManager: Progress constructor
        ExperimentManager->>ProgressBar: new Progress(format, options)
    end
    
    loop For each batch
        loop For each item in batch
            ExperimentManager->>Task: runItem(item)
            Task-->>ExperimentManager: result
            ExperimentManager->>ProgressBar: tick(1)
        end
    end
    
    ExperimentManager-->>User: ExperimentResult
Loading

Context used:

  • Rule from dashboard - Move imports to the top of the module instead of placing them within functions or methods. (source)

@vercel
Copy link

vercel bot commented Feb 12, 2026

@colodenn is attempting to deploy a commit to the langfuse Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@colodenn colodenn marked this pull request as draft February 12, 2026 18:58
@colodenn colodenn changed the title Corny/progressbar feat: add progress bar to experiments Feb 12, 2026
@colodenn colodenn marked this pull request as ready for review February 12, 2026 19:19
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@hassiebp hassiebp self-requested a review February 16, 2026 08:59
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.

1 participant