Skip to content

feat: persist .forge/ artifacts in workflow state for cross-worker continuity#44

Open
eshulman2 wants to merge 10 commits into
mainfrom
feature/forge-artifacts
Open

feat: persist .forge/ artifacts in workflow state for cross-worker continuity#44
eshulman2 wants to merge 10 commits into
mainfrom
feature/forge-artifacts

Conversation

@eshulman2

@eshulman2 eshulman2 commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds forge_artifacts: dict[str, dict[str, str]] to PRIntegrationState (shared by both FeatureState and BugState) to persist container-written .forge/ files across workspace recreations, keyed by repo name for multi-repo feature support
  • Adds harvest_forge_artifacts / restore_forge_artifacts utilities in src/forge/workspace/artifacts.py — each calling node declares which files it harvests, making the mechanism explicit and portable to future workflows
  • Wires harvest into implement_task (handoff.md), attempt_ci_fix (handoff.md + fix-plan.md), and implement_review (review-plan.md, review-objections.md, handoff.md)
  • Wires restore into setup_workspace and prepare_workspace (recreation path only) so containers always start with prior artifacts on disk
  • Fixes WorkspaceManager.destroy_workspace to use podman unshare rm -rf with shutil.rmtree fallback, resolving cleanup failures for root-owned files written by containers

Bug Workflow Coverage

The bug workflow's RCA and planning stages (analyze_bug, reflect_rca, plan_bug_fix) use ephemeral temp directories and parse outputs inline into state — no .forge/ artifacts need to persist across those runs. The implementation stage reuses the shared nodes (setup_workspace, implement_task, implement_review, attempt_ci_fix) that already have harvest/restore wired in. BugState inherits forge_artifacts from PRIntegrationState and initializes it to {}. No additional changes needed.

Updated

  • Rebased onto main (merged main into branch) to pick up the bug workflow redesign, concurrent queue consumer, and other recent changes
  • All 947 unit tests pass after merge

Test plan

  • Run a feature workflow end-to-end — verify handoff.md is harvested after implement_task and restored on workspace recreation
  • Trigger a CI fix cycle — verify fix-plan.md + handoff.md are harvested and available on retry
  • Trigger an implement_review cycle — verify review-plan.md, review-objections.md, handoff.md are persisted
  • Run a bug workflow end-to-end — verify implementation stage works with artifact persistence (shared nodes)
  • Verify workspace cleanup works for root-owned container files (podman unshare rm -rf path)

🤖 Generated with Claude Code

@eshulman2 eshulman2 added enhancement New feature or request area:workflow Workflow graphs, orchestration, state, routing, and gates area:execution Agent execution, containers, sandboxes, and runtime drivers tech-debt Internal maintainability or architectural debt ready-for-review labels Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:execution Agent execution, containers, sandboxes, and runtime drivers area:workflow Workflow graphs, orchestration, state, routing, and gates enhancement New feature or request ready-for-review tech-debt Internal maintainability or architectural debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant