Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions orchestrator/decision_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ def queue_decision(
with self._lock:
pipeline = self._load_pipeline()

# Auto-infer phase from pipeline state when not explicitly provided
if phase is None and pipeline.current_phase is not None:
phase = pipeline.current_phase

# Create decision using pipeline method
decision = pipeline.add_decision(
question=question,
Expand Down
7 changes: 7 additions & 0 deletions sandbox/egg_lib/contract_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,12 @@ def cmd_add_decision(args: argparse.Namespace) -> int:
next_id = len(decisions) + 1

# Build the new decision
decision_phase = args.phase or contract.get("current_phase")
new_decision = {
"id": f"decision-{next_id}",
"question": args.question,
"type": "hitl",
"phase": decision_phase,
"options": [],
"resolved": False,
"resolution": None,
Expand Down Expand Up @@ -1113,6 +1115,11 @@ def create_parser() -> argparse.ArgumentParser:
nargs="*",
help="Optional: decision options",
)
decision_parser.add_argument(
"--phase",
choices=["refine", "plan", "implement", "pr"],
help="Pipeline phase (defaults to contract's current_phase)",
)
decision_parser.add_argument(
"--format",
choices=["json", "markdown"],
Expand Down
16 changes: 16 additions & 0 deletions sandbox/egg_lib/orch_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,10 @@ def cmd_decision_create(args: argparse.Namespace) -> int:
data["context"] = args.context
if args.options:
data["options"] = args.options
if args.phase:
data["phase"] = args.phase
if args.decision_type:
data["decision_type"] = args.decision_type

result = orch_request(f"/api/v1/pipelines/{pid}/decisions", method="POST", data=data)

Expand Down Expand Up @@ -1140,6 +1144,18 @@ def add_signal_args(p: argparse.ArgumentParser) -> None:
dec_create.add_argument("--question", required=True, help="Decision question")
dec_create.add_argument("--context", help="Additional context")
dec_create.add_argument("--options", nargs="*", help="Decision options")
dec_create.add_argument(
"--phase",
choices=["refine", "plan", "implement", "pr"],
help="Pipeline phase (auto-inferred from pipeline state if omitted)",
)
dec_create.add_argument(
"--decision-type",
dest="decision_type",
choices=["choice", "feedback"],
default=None,
help="Decision type (default: choice)",
)
_add_json_flag(dec_create)
dec_create.set_defaults(func=cmd_decision_create)

Expand Down
10 changes: 10 additions & 0 deletions sandbox/egg_lib/sdlc_hitl.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,16 @@ def handle_hitl_checkpoint(
raw_phase = decision.get("phase")
phase = raw_phase if raw_phase is not None else _detect_phase(question, context)

# If phase is still unknown, try fetching from the pipeline's current state
if phase == "unknown":
try:
pipeline_info = client.get_pipeline(pipeline_id)
pipeline_phase = pipeline_info.get("pipeline", pipeline_info).get("current_phase")
if pipeline_phase:
phase = pipeline_phase
except Exception:
pass

# Find and read the draft
repo_path = _find_repo_path()
draft_rel = _get_draft_path(phase, pipeline_mode, issue_number, pipeline_id)
Expand Down
Loading