Skip to content

feat(env): support auto-dumping conversation via FORGE_AUTO_DUMP env var#2441

Merged
tusharmath merged 4 commits intomainfrom
auto-dump-env
Feb 22, 2026
Merged

feat(env): support auto-dumping conversation via FORGE_AUTO_DUMP env var#2441
tusharmath merged 4 commits intomainfrom
auto-dump-env

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

@tusharmath tusharmath commented Feb 20, 2026

Summary

Add auto-dump support that automatically exports conversation history to JSON or HTML when a task completes, controlled via the FORGE_AUTO_DUMP environment variable.

Context

Previously, users had to manually trigger conversation dumps after each session. This made it cumbersome to consistently capture outputs for logging, auditing, or post-processing. With auto-dump, the export happens automatically at task completion without any extra steps.

Changes

  • Added AutoDumpFormat enum (Json, Html) to the domain layer with FromStr parsing
  • Added auto_dump: Option<AutoDumpFormat> field to the Environment struct
  • Wired FORGE_AUTO_DUMP env var parsing in the infrastructure layer via the existing parse_env mechanism
  • Triggered the dump automatically in the UI task-completion handler when auto_dump is set

Key Implementation Details

AutoDumpFormat uses a lenient FromStr implementation — "json", "true", "1", and "yes" all map to JSON format, while "html" maps to HTML. Any unrecognised value is treated as disabled (None). The dump reuses the existing on_dump method, so no new dump logic was needed.

Use Cases

  • CI/CD pipelines: Set FORGE_AUTO_DUMP=json to automatically capture structured conversation output after every run
  • Audit trails: Set FORGE_AUTO_DUMP=html to generate human-readable HTML reports of completed sessions
  • Quick enable: Set FORGE_AUTO_DUMP=true or FORGE_AUTO_DUMP=1 as a boolean-style toggle for JSON output

Testing

# JSON dump on task completion
FORGE_AUTO_DUMP=json forge run "your task"

# HTML dump on task completion
FORGE_AUTO_DUMP=html forge run "your task"

# Boolean-style enable (produces JSON)
FORGE_AUTO_DUMP=true forge run "your task"

# Run unit tests
cargo insta test --accept -p forge_domain -p forge_infra

@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Feb 20, 2026
@tusharmath tusharmath changed the title feat(env): add FORGE_AUTO_DUMP env var to trigger dump on task completion feat(env): support auto-dumping conversation via FORGE_AUTO_DUMP env var Feb 21, 2026
@tusharmath tusharmath merged commit 62e1120 into main Feb 22, 2026
11 checks passed
@tusharmath tusharmath deleted the auto-dump-env branch February 22, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant