Skip to content

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

Closed
eshulman2 wants to merge 8 commits into
mainfrom
feature/forge-artifacts
Closed

feat: persist .forge/ artifacts in workflow state for cross-worker continuity#44
eshulman2 wants to merge 8 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

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. The WorkspaceManager.destroy_workspace fix previously included here (podman unshare rm -rf for root-owned cleanup) was dropped — an equivalent fix already landed on main via fix: remove workspaces containing root-owned container files #141, and main's version is a superset (adds OSError fallback handling).
  • _recreate_workspace_from_fork on main restructured workspace recreation into an atomic build-beside-then-swap; restore_forge_artifacts is now wired in after the swap completes, alongside write_workspace_identity.
  • All 1978 unit tests pass after rebase.

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)

🤖 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
@eshulman2

Copy link
Copy Markdown
Collaborator Author

Closing in favor of #260. The replacement keeps cross-worker continuity narrowly scoped to a typed, per-repository handoff record and avoids using workflow state as a generic .forge artifact store.

@eshulman2 eshulman2 closed this Aug 6, 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