Skip to content

feat: enhance optimize-sorting T2 researcher and archive prompts with stage timing - #1433

Closed
colehurwitz wants to merge 1 commit into
mainfrom
factory/run-dec02581
Closed

colehurwitz wants to merge 1 commit into
mainfrom
factory/run-dec02581

Conversation

@colehurwitz

Copy link
Copy Markdown
Collaborator

Changes

  • T2 Researcher Prompt (_RESEARCHER_T2_PROMPT): Updated to instruct the researcher to read .stage_timing from baseline.json as ground-truth measured times and rank stages by measured time (highest first), replacing the old "estimate from code" approach. Output schema changed from estimated_pct to baseline_mean/baseline_std/pct_of_total.

  • Archive Prompt (_archive_prompt(), all 3 tiers): Added stage_timing_deltas computation that iterates over the union of baseline and result stage names:

    • Stages in both → normal delta (baseline_mean - result_time)
    • Stages only in result → marked "new"
    • Stages only in baseline → marked "removed"
    • Added stage_timing_deltas to JSONL field list
    • Added per-stage timing table to PR comment for keep verdicts
  • Tests: Added 10 new test methods to TestPromptContent validating both changes

Graph topology unchanged

  • 31 nodes, 39 edges, 2 reloop edges — verified programmatically
  • All existing structural tests pass (98/98 non-registration tests)
  • 3 registration tests expected to fail (workflow not yet registered in definitions.py)

… stage timing

- Replace _RESEARCHER_T2_PROMPT: instruct researcher to read .stage_timing
  from baseline.json as ground-truth measured times, rank stages by measured
  time (highest first), and output baseline_mean/baseline_std/pct_of_total
  schema instead of estimated_pct

- Replace _archive_prompt(): add stage_timing_deltas computation using union
  of baseline and result stage names — stages in both get normal delta,
  new stages marked 'new', removed stages marked 'removed'. Add
  stage_timing_deltas to JSONL field list. Add per-stage timing table to
  PR comment for keep verdicts.

- Add 10 new test methods to TestPromptContent validating both changes

Graph topology unchanged: 31 nodes, 39 edges, 2 reloop edges.
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Sentrux Quality Report

Absolute

Scanning ....
[scan] git ls-files: 629 total, 615 kept, 14 dropped (ext:14, meta:0, big:0)
[build_project_map] 615 files, 109 unique dirs, 101 cache misses, 5.0ms
[resolve] 1165 resolved, 1572 unresolved (of 2737 total specs)
[resolve_imports] project_map 5.1ms, suffix_idx 1.0ms, suffix_resolve 14.0ms, total 20.2ms
[build_graphs] 615 files | maps 1.9ms, imports 20.3ms, calls+inherit 4.5ms, total 26.7ms | 1164 import, 8401 call, 1 inherit edges
sentrux check — 3 rules checked

Quality: 4450

✗ [Error] max_cc: 6 function(s) exceed max cyclomatic complexity of 30
    factory/cli/_ceo_helpers.py:_validate_ceo_flags (cc=43)
    factory/cli/_ceo_helpers.py:_execute_ceo (cc=43)
    examples/chess_evolve.py:main (cc=33)
    factory/cli/_task_builder.py:_build_ceo_task (cc=32)
    factory/cli/run.py:cmd_run (cc=32)
    factory/outer_loop/mutations.py:validate_and_repair (cc=31)

✗ 1 violation(s) found

Diff (vs base branch)

Scanning ....
[scan] git ls-files: 629 total, 615 kept, 14 dropped (ext:14, meta:0, big:0)
[build_project_map] 615 files, 109 unique dirs, 101 cache misses, 5.1ms
[resolve] 1165 resolved, 1572 unresolved (of 2737 total specs)
[resolve_imports] project_map 5.2ms, suffix_idx 1.0ms, suffix_resolve 14.1ms, total 20.3ms
[build_graphs] 615 files | maps 1.9ms, imports 20.5ms, calls+inherit 5.8ms, total 28.1ms | 1164 import, 8401 call, 1 inherit edges
sentrux gate — structural regression check

Quality:      4447 -> 4450
Coupling:     0.80 → 0.80
Cycles:       4 → 4
God files:    3 → 3

Distance from Main Sequence: 0.35

✓ No degradation detected

@colehurwitz

Copy link
Copy Markdown
Collaborator Author

Superseded by unified PR — see #1443

@colehurwitz colehurwitz closed this Sep 2, 2026
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