I need to understand how the triage runner validates action steps and why it allows "shell steps" (steps with title + effort + issue_refs but no "detail" payload with file-by-file instructions).
Key areas to investigate:
_stage_validation.py - especially around line 249 where a step is considered "not shallow" if it has issue_refs even with no detail
The triage runner code in desloppify/app/commands/plan/triage/runner/ - how it populates steps
stage_prompts.py - what the prompts actually ask for in terms of step detail
Any step schema/type definitions that define what a proper action step looks like
Search in desloppify/app/commands/plan/triage/ and desloppify/engine/_plan/
For each file, read the relevant sections. I want to understand:
What does the validation check for steps?
What does "detail" mean in a step?
How could the validation be tightened to reject shell steps?
What does the prompt ask the LLM to produce for steps?
Be very thorough - read full files where needed.
Assistant
I'll help you understand the triage runner's validation of action steps and the "shell steps" issue. Let me start by exploring the relevant files.
Assistant
Now let me read the key validation files:
Assistant
Now let me read the runner validation code and understand how steps are populated:
Assistant
Now let me look at the orchestrator and understand how steps are processed in the enrich stage:
Assistant
Let me continue reading the orchestrator and also check the stage helpers to see how steps are parsed:
Assistant
Now let me look at tests to see actual examples of shell steps and understand the issue better:
Assistant
Let me check what the test file has for enrich validation examples:
Assistant
Perfect! Now let me search for more context on the "shell steps" issue by looking at the git history:
Assistant
Let me look more closely at the validation code to trace the exact logic:
Assistant
Now let me read the _steps_missing_issue_refs function and look at the enrich validation logic in the runner:
Assistant
User
I need to understand the full triage runner flow to identify all places where a subagent can cut corners. The key issues are:
Shell steps pass validation (detail missing but issue_refs present)
No enforcement of cluster priority/queue ordering
No enforcement that reflect skip decisions get applied
Attestations are auto-generated and pass validation trivially
No pilot execution check
Please read these files thoroughly:
desloppify/app/commands/plan/triage/runner/codex_runner.py - the main runner orchestration
desloppify/app/commands/plan/triage/runner/stage_prompts.py - what prompts ask for
In _stage_validation.py line 249, the check reads:
python
if isinstance(s, dict) and not s.get("detail") and not s.get("issue_refs")
This means: count as "bare/shallow" ONLY if BOTH conditions are true:
No detail AND
No issue_refs
So a step that has issue_refs but missing detail is not counted as shallow, even though it's completely unexecutable.
5. The Enrich Validation Chain (runner/stage_validation.py lines 101-129)
The enrich stage runs these checks sequentially:
Check
Line
What it does
Problem
_shallow_steps()
104-107
Blocks if step has NO detail AND NO issue_refs
Allows steps with issue_refs but no detail
_steps_without_effort()
113-116
Blocks if step has no effort tag
✓ Catches missing effort
_steps_missing_issue_refs()
118-121
Blocks if step has no issue_refs
✓ Catches missing refs, but not vacuous ones
_steps_with_vague_detail()
123-128
Only checks if detail exists (line 408: if not detail: continue)
Doesn't flag steps with NO detail
6. Data Model Definition (schema.py, lines 42-46)
The ActionStep TypedDict defines:
python
class ActionStep(TypedDict, total=False):
title: Required[str] # Short summary, 1 line
detail: str # Long description, paragraphs OK
issue_refs: list[str] # Issue ID suffixes this step addresses
done: bool # Completion tracking (default False)
detail is NOT Required — only title is. This is by design (presumably for optional use), but the validation doesn't enforce it during enrich.
1. Every step MUST have `--detail` with 80+ chars INCLUDING at least one file path
2. Every step MUST have `--issue-refs` linking it to specific review issue(s)
3. Every step MUST have `--effort` tag
But the validation doesn't enforce requirement #1. It only checks that --detail exists IF it's provided.
8. How to Tighten Validation
To reject shell steps, change line 249 in _stage_validation.py from:
python
# Current: allows steps with issue_refs but no detail
if isinstance(s, dict) and not s.get("detail") and not s.get("issue_refs")
To:
python
# New: requires BOTH detail and issue_refs
if isinstance(s, dict) and (not s.get("detail") or not s.get("issue_refs"))
Or more explicitly, add a dedicated check that catches steps with issue_refs but empty/missing detail:
python
def _steps_with_issue_refs_but_no_detail(plan: dict) -> list[tuple[str, int, int]]:
"""Return steps with issue_refs but missing/empty detail (shell steps)."""
results: list[tuple[str, int, int]] = []
for name, cluster in plan.get("clusters", {}).items():
if cluster.get("auto") or not cluster.get("issue_ids"):
continue
steps = cluster.get("action_steps") or []
if not steps:
continue
shell_steps = sum(
1 for s in steps
if isinstance(s, dict) and s.get("issue_refs") and not s.get("detail")
)
if shell_steps > 0:
results.append((name, shell_steps, len(steps)))
return results
Then call it in validate_stage() enrich block (after line 104) to block on shell steps.
Schema definition (lines 42-46: ActionStep TypedDict, detail is optional)
10. Why This Matters
The orchestrator's validation (runner/stage_validation.py line 104) calls _shallow_steps() and assumes it catches all inadequate steps. But shell steps (with issue_refs but no detail) slip through because:
_shallow_steps() uses OR logic: flags as bare only if BOTH detail and issue_refs are missing
The stage prompt instructions use AND logic: requires BOTH detail and issue_refs to be present
These two logics are incompatible — the validation is weaker than the prompt requirement
This allows subagents to submit steps with just metadata (issue citations) but zero actionable instructions, defeating the purpose of the enrich stage.
Based on my thorough review of the code, here's a complete inventory of all validation gaps and corner-cutting opportunities in the triage runner:
GAP 1: Shell Steps with Vague Detail (Primary Issue)
Location:_stage_validation.py lines 393-413, enforced in confirmations.py lines 521-529
What the prompt asks for:
Lines 248-249 in stage_prompts.py: "Every step MUST have --detail with 80+ chars INCLUDING at least one file path"
Lines 268-280: Detail should include "file path, the specific location (line range or function name), and the exact change to make"
What validation actually enforces:
python
def _steps_with_vague_detail(plan: dict, repo_root: Path):
# Detail is vague if < 80 chars AND no file path
if len(detail) < 80 and not has_path:
return vague_step
The gap: A step can pass validation with detail like:
"Update shell script to handle errors properly" (89 chars, no file path mention but just long enough)
The check is len(detail) < 80 and not has_path — so if either condition is false, it passes
A 79-char detail with a single file path mention passes validation
A 100-char detail with zero file paths but scattered text passes validation
Corner-cutting opportunity: Subagent can write detail that technically passes the regex check for file paths (mentions src/ once) but provides zero actionable guidance.
GAP 2: Missing Issue References (Critical Traceability)
Location:_stage_validation.py lines 375-390, enforced in confirmations.py lines 510-519
What the prompt asks for:
Lines 250-251 in stage_prompts.py: "Every step MUST have --issue-refs linking it to specific review issue hash(es)"
What validation actually enforces:
python
def _steps_missing_issue_refs(plan: dict):
missing = sum(
1 for s in steps
if isinstance(s, dict) and not s.get("issue_refs")
)
The gap:
Validation only checks presence, not correctness
A step can reference ANY issue_refs value — even issue IDs that don't exist
No verification that referenced issues are actually open (could reference resolved/skipped issues)
Lines 416-440 in _stage_validation.py try to check this (_steps_referencing_skipped_issues) but this is only a WARNING, not a BLOCK
Corner-cutting opportunity: Subagent can:
Reference a stale issue ID not in the current open set
Reference a resolved issue to make a step appear "done"
Use fake issue hashes that don't correspond to any real finding
GAP 3: No Validation that Detail Actually Exists (Shallow Steps)
Location:_stage_validation.py lines 238-253, enforced in confirmations.py lines 473-485
What the prompt asks for:
Lines 249, 268: Step detail must be specific and actionable
What validation actually enforces:
python
def _shallow_steps(plan: dict):
bare = sum(
1 for s in steps
if isinstance(s, dict) and not s.get("detail") and not s.get("issue_refs")
)
The gap:
A step passes if it has EITHER detail OR issue_refs
A step with a single-character detail string and no issue_refs fails
A step with issue_refs but completely empty detail still passes
No validation of detail quality — just presence
Corner-cutting opportunity: Subagent can:
Provide issue_refs with completely blank detail field
Mark all steps with "To be determined" or "TBD" as the detail
Punt on detail entirely and rely on issue_refs existing
GAP 4: No Effort Tag Validation for Correctness
Location:_stage_validation.py lines 282-297, enforced in confirmations.py lines 499-508
What the prompt asks for:
Lines 282-283 in stage_prompts.py: "Set effort based on the ACTUAL complexity you see in the code, not a guess"
Lines 281-282: Different tags for different actual scopes (trivial, small, medium, large)
What validation actually enforces:
python
def _steps_without_effort(plan: dict):
missing = sum(
1 for s in steps
if isinstance(s, dict) and s.get("effort") not in _VALID_EFFORTS
)
The gap:
Validation only checks if the tag is one of: {trivial, small, medium, large}
No verification of tag correctness vs actual work scope
A rename-one-variable step can be marked "large"; a decompose-400-line-hook can be marked "trivial"
No scoring rubric applied
Corner-cutting opportunity: Subagent can:
Mark all steps as "trivial" (saves time, makes plan look simple)
Mark all steps as "large" (inflates importance)
No correlation between effort tag and detail content
GAP 5: File Path Validation is Lenient
Location:_stage_validation.py lines 256-279, enforced in confirmations.py lines 487-497
What the prompt asks for:
Lines 249, 306-311 in stage_prompts.py: "Only reference files that exist RIGHT NOW"
Lines 251-252: "File paths in detail MUST exist on disk"
What validation actually enforces:
python
def _steps_with_bad_paths(plan: dict, repo_root: Path):
for path_str in _PATH_RE.findall(detail): # regex: src|supabase/...
p = repo_root / path_str
if p.exists():
continue
alt_ext = _EXT_SWAPS.get(p.suffix)
if alt_ext and p.with_suffix(alt_ext).exists():
continue
bad.append(path_str)
The gap:
Only validates paths that match the regex src/ or supabase/
If detail mentions a file path that doesn't match this regex, it's silently ignored
A step referencing lib/foo.ts (no src/ prefix) won't be caught
The regex path check is very forgiving (allows both .ts and .tsx, etc.)
No validation that the file path is actually relevant to the detail's claimed action
Corner-cutting opportunity: Subagent can:
Write detail mentioning nonexistent files using paths outside src/supabase
Reference correct filenames but in the wrong directory
List files that exist but are completely unrelated to the step
GAP 6: Cluster Priority/Queue Ordering Not Enforced
Location: No validation function exists
What the prompt asks for:
Lines 164-165 in stage_prompts.py (organize): "Explicit priority ordering: which cluster 1st, 2nd, 3rd and why?"
Lines 153 (sense-check): "Build a file-touch graph and check... [dependencies]"
What validation actually enforces:
Nothing. There's no validation of queue_order or priority fields
Clusters can be in any order or have conflicting priorities
Corner-cutting opportunity: Subagent can:
Create clusters without any explicit ordering
Add --depends-on relationships that create cycles (not detected until runtime)
Leave priority field unset
No analysis of whether dependencies make sense
GAP 7: Skip/Reflect Decisions Not Enforced
Location:stage_prompts.py lines 151-165 (organize stage), no post-validation
What the prompt asks for:
Lines 204-210 in stage_prompts.py (organize): "Skip false positives and over-engineering identified in observe/reflect. Every skip needs a per-issue justification"
Line 164 (reflect): "Skip: which issues should be skipped? (with per-issue justification)"
What validation actually enforces:
Skip entries are validated in schema.py to have kind + note/reason fields
BUT: No validation that skips actually correspond to reflect/observe verdicts
No check that a "false positive" skip has actual evidence in the reflect/observe reports
No validation that skip reasons match the pattern from the prior stages
Corner-cutting opportunity: Subagent can:
Skip an issue with reason "not a priority" even though observe said it was "genuine"
Create skip entries that don't reference any actual issue ID
Skip without any justification (kind='temporary' has no required reason field)
GAP 8: Auto-Attestation Passes Trivially
Location:stage_validation.py lines 213-266 (the build_auto_attestation function)
What happens:
python
def build_auto_attestation(stage: str, plan: dict, triage_input):
if stage == "observe":
_by_dim, dim_names = observe_dimension_breakdown(triage_input)
return (f"I have thoroughly analysed {len(triage_input.open_issues)} issues "
f"across dimensions including {dims_str}, ...")
The validation gap:
Auto-attestation is generated programmatically based on available data
It always passes the attestation validation check (lines 24-75 in confirmations.py)
The check is: "does attestation mention at least one dimension name?"
The auto-generated text always includes dimension names
There's zero actual attestation content — it's boilerplate
Where this gets used (orchestrator.py lines 449-460):
Minimum citations = min(5, issue_count // 10) or 1
For 40 issues: min = 4
For 60 issues: min = 5
For 100 issues: min = 5
Subagent can cite just 5 out of 100 issues (5% coverage) and pass
No validation that cited IDs actually appear in the report or are mentioned meaningfully
The cited_ids list is computed automatically from the report text — subagent has no way to game it directly, but the threshold is low
Corner-cutting opportunity: Subagent can:
Analyze issues superficially, cite only the easiest/most obvious 5 out of 100
Cite issue IDs without any actual analysis (just dump the hashes)
The validation will pass regardless of analysis depth
GAP 12: Recurring Dimension Mention is Text-Match Based
Location:_stage_validation.py lines 61-89
What the prompt asks for:
Lines 155-156 in stage_prompts.py (reflect): "Check recurring patterns... If the same dimension keeps producing issues, that's a root cause"
What validation actually enforces:
python
def _validate_recurring_dimension_mentions(report, recurring_dims, recurring):
report_lower = report.lower()
mentioned = [dim for dim in recurring_dims if dim.lower() in report_lower]
if mentioned:
return True
The gap:
Check is purely substring-based: dim.lower() in report_lower
Lines 218-227 in stage_prompts.py (organize quality gates): All items are marked as blocking checkpoints
What validation actually enforces in confirmations.py:
python
scattered = _clusters_with_directory_scatter(plan)
if scattered:
print(colorize(f" Warning: {len(scattered)} cluster(s) span many directories", "yellow"))
# CONTINUES — does NOT block confirmation
The gap:
File overlap warnings are non-blocking (lines 360-377)
Directory scatter warnings are non-blocking (lines 342-349)
High step-to-issue ratio warnings are non-blocking (lines 351-357)
These are printed as "Note:" and "Warning:" but confirmation proceeds
Corner-cutting opportunity: Subagent can:
Create a cluster mixing 10 unrelated directories
Create two clusters with overlapping files and no --depends-on relationship
Have 20 steps for 5 issues (4:1 ratio) with each step marked trivial
All will pass confirmation
GAP 14: No Validation that Issue_Refs Match Cluster Issues
Location: No validation function exists
What the prompt asks for:
The natural expectation: A step's issue_refs should be a subset of the cluster's issue_ids
What validation actually enforces:
Nothing
Corner-cutting opportunity: Subagent can:
Create a step in "cluster-A" with issue_refs pointing to issues in "cluster-B"
Cross-contaminate cluster responsibilities
No traceability
GAP 15: Effort Tags Not Validated Against Detail Length
Location: No correlation check exists
What the prompt asks for:
Lines 281-282 in stage_prompts.py: "Set effort based on the ACTUAL complexity... A file rename with 2 imports is 'trivial'"
What validation actually enforces:
Effort tag is valid (trivial/small/medium/large)
Detail exists (if not, issue_refs must)
No correlation between detail length/scope and effort tag
Corner-cutting opportunity: Subagent can:
Mark a 500-char detailed step "trivial"
Mark a single-sentence step "large"
No semantic validation of the relationship
Summary Table: Validation Gap Severity
Gap
Severity
Blocking?
Exploitable By Subagent
1. Shell steps vague detail
Critical
Blocks enrich
Can write 79-char vague text with minimal file path
2. Missing issue refs (unchecked)
High
Blocks enrich
Can reference non-existent or wrong issues
3. Shallow steps gate is OR not AND
Medium
Blocks enrich
Can skip detail if issue_refs present
4. Effort tags not validated
Medium
Advisory
Can mismatch effort to actual scope
5. File path validation lenient
Medium
Blocks enrich
Can mention wrong files or out-of-scope paths
6. Priority/ordering not checked
High
No gate
Can create unordered/cyclic clusters
7. Skip decisions not validated
High
No gate
Can skip without justification
8. Auto-attestation is fake
Critical
Auto-confirms
Orchestrator bypasses all validation
9. No pilot execution check
High
No gate
No validation code is executable
10. Vagueness uses AND logic
Low
Blocks enrich
Counterintuitive but mostly works
11. Citation ratio too low
Medium
Blocks confirm
Only 5% of issues cited in 100-issue observe
12. Dimension mentions text-match
Medium
Blocks reflect
Substring collisions possible
13. Cluster warnings non-blocking
Medium
Advisory
Bad clustering passes silently
14. Issue_refs not tied to cluster
Medium
No gate
Cross-cluster contamination possible
15. Effort mismatch not checked
Low
Advisory
Effort tag correlation not validated
Most Impactful Corner-Cutting Paths
Path A: Skip Core Work (via Gap 8 + 2)
Subagent produces minimal clusters with vague steps
Steps reference fake or resolved issue IDs (Gap 2)
Orchestrator auto-confirms with fake attestation (Gap 8)
No human review ever happens
Plan quality is garbage but confirms successfully
Path B: Hide Bad Organization (via Gap 6 + 13)
Create many overlapping clusters (Gap 13 - advisory only)
No dependency ordering (Gap 6 - no validation)
Steps in wrong order, would fail at runtime (Gap 9)
Organize stage confirms because all the blocking gates are about data presence, not quality
Path C: Defer Hard Work (via Gap 7 + 11)
Observe stage cites only 5% of issues, superficially (Gap 11)
Reflect stage skips 80% of issues with minimal justification (Gap 7)
Remaining issues organized but not thoroughly analyzed
All gates pass because justification validation is weak
Critical Recommendations
The most critical gap is Gap 8: Auto-Attestation. This completely bypasses the human confirmation loop for automated runs. The orchestrator (lines 449-460 of orchestrator.py) generates a fake attestation and calls _cmd_confirm_stage which always succeeds because the text is fabricated to match the validation regex.
The second-most critical is Gap 2 & 7: Issue reference and skip decision validation are purely structural, with no semantic validation.
The third is Gap 6: No enforcement of cluster priority or execution order, which means a plan can be valid but unexecutable.