feat(aggregation): Implement tier-level aggregation strategy tied to Personas

This commit is contained in:
2026-05-04 05:10:59 -04:00
parent a895b822d8
commit 36645f7f3e
5 changed files with 99 additions and 15 deletions
+14 -6
View File
@@ -28,6 +28,7 @@ See Also:
- src/models.py for Ticket, Track, WorkerContext
"""
from src import ai_client
from src import summarize
import json
import threading
import time
@@ -401,6 +402,7 @@ def run_worker_lifecycle(ticket: Ticket, context: WorkerContext, context_files:
# Apply Persona if specified
preferred_models = []
persona_tool_preset = None
persona = None
if context.persona_id:
from src.personas import PersonaManager
from src import paths
@@ -443,6 +445,7 @@ def run_worker_lifecycle(ticket: Ticket, context: WorkerContext, context_files:
if context_files:
parser = ASTParser(language="python")
strategy = getattr(persona, "aggregation_strategy", "auto") if persona else "auto"
for i, file_path in enumerate(context_files):
try:
Path(file_path)
@@ -452,12 +455,17 @@ def run_worker_lifecycle(ticket: Ticket, context: WorkerContext, context_files:
tokens_before += _count_tokens(content)
if i == 0:
view = parser.get_curated_view(content, path=file_path)
elif ticket.target_file and Path(file_path).resolve() == Path(ticket.target_file).resolve() and ticket.target_symbols:
view = parser.get_targeted_view(content, ticket.target_symbols, path=file_path)
else:
view = parser.get_skeleton(content, path=file_path)
if strategy == "summarize":
view = summarize.summarise_file(Path(file_path), content)
elif strategy == "full":
view = content
else: # auto or skeleton
if i == 0:
view = parser.get_curated_view(content, path=file_path)
elif ticket.target_file and Path(file_path).resolve() == Path(ticket.target_file).resolve() and ticket.target_symbols:
view = parser.get_targeted_view(content, ticket.target_symbols, path=file_path)
else:
view = parser.get_skeleton(content, path=file_path)
tokens_after += _count_tokens(view)
context_injection += f"\nFile: {file_path}\n{view}\n"