Skip to content

[Refactor] Modular pipeline architecture - #31

Open
TecJesh wants to merge 3 commits into
main-fix-ir-patch-genfrom
main-fix-ir-patch-gen-refactor
Open

[Refactor] Modular pipeline architecture#31
TecJesh wants to merge 3 commits into
main-fix-ir-patch-genfrom
main-fix-ir-patch-gen-refactor

Conversation

@TecJesh

@TecJesh TecJesh commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Refactor the monolithic flow.py (4446 lines) into a modular pipeline architecture.

Architecture Changes

Before

  • Single flow.py containing all logic (4446 lines)
  • TA_Main2MainState Pydantic model with mutable state
  • CrewAI Flow framework (@start, @router, @listen decorators)
  • Multiple execution modes (TA_MODE: full, merge, fix)
  • Print-based logging (print_info, print_error, etc.)

After

  • utils/ package: TAConfig, WorkflowContext, TALogger, run_git, timed()
  • pipeline/ package: 13 focused modules, each with (ctx, config) -> ctx signature
  • flow.py: 143-line orchestrator with simple while loop
  • Single-step mode only (the determined workflow direction)
  • All env vars centralized in TAConfig.from_env()
  • Immutable WorkflowContext.copy_with() pattern
  • TALogger with structured formatting (header, section, status, table)

Preserved Features

All existing functionality is preserved across the new modules:

Feature Module
IR patch generation + LLVM rebuild + retry pipeline/ir_patch.py
Build fix loop + validation + NPU-IR detection pipeline/build.py + fix.py
Test fix loop + OOM auto-rerun pipeline/test.py + fix.py
Fix rejection with git revert + AI feedback pipeline/fix.py
AI conflict resolution pipeline/resolve.py
Progressive step planning by line budget pipeline/plan.py
LLVM hash change detection with per-step IR patch pipeline/ir_patch.py

TecJesh added 3 commits July 27, 2026 08:19
…detect

Remove _fix_origin() that forced origin to point to triton-lang/triton-ascend,
breaking private fork workflows. Restore the pre-refactor behavior where:

- origin is left as-is (user may point it to their private fork)
- ascend_head is resolved from origin/{TA_BASE_BRANCH} with graceful fallback
- detect.py fetches from origin and re-resolves ascend_head (matching old
  detect_commits.py which called it 'private fork')
- TA_BASE_BRANCH defaults to 'main' (matching old utils.py), not 'upstream_sync'

This ensures that when GITHUB_REPO points to a private fork with previously
merged commits, the merge-base calculation reflects actual progress instead
of always starting from the upstream origin.
@TecJesh
TecJesh force-pushed the main-fix-ir-patch-gen branch from 9876e51 to b653dc5 Compare July 27, 2026 12:54
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