Skip to content

fix: SyntaxError in init_user_intent FnNode python3 -c one-liner - #1396

Draft
akashgit wants to merge 9 commits into
mainfrom
fix/init-user-intent-syntax-error
Draft

fix: SyntaxError in init_user_intent FnNode python3 -c one-liner#1396
akashgit wants to merge 9 commits into
mainfrom
fix/init-user-intent-syntax-error

Conversation

@akashgit

Copy link
Copy Markdown
Owner

Changes

  • Rewrote the init_user_intent FnNode command in factory/workflow/contributed/design_v2/workflow.py to eliminate compound if/else blocks that cause SyntaxError when used after semicolons in a python3 -c one-liner
  • Early exit now uses ternary expression: (sys.exit(0) if condition else None)
  • Idea fallback now uses or-chain: env_var or backlog_line or default
  • All 63 design-v2 workflow tests pass, lint clean

akashgit and others added 7 commits August 29, 2026 14:51
Adds the design-v2 workflow as a contributed workflow with dynamic
research/strategy/QA directors that scale agent count at inference time
based on project complexity, replacing the static fork/join patterns.

- Research Director: decides N research directions dynamically (3-7)
- Strategy Director: spawns M strategy perspectives (2-5)
- QA Director: creates K tailored adversarial test approaches (2-5)
- User Intent Ledger: tracks idea + feedback throughout the session
- Design Doc: rewrites strategy into human-readable design document
- Synthesize QA: merges adversarial reports with confidence scoring

29 nodes, 32 edges. 63 tests covering graph structure, node properties,
edge wiring, post checks, and removed-node assertions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…port

- Extract all 7 prompt template constants from workflow.py into prompts.py
- Remove unused `glob` import from synthesize_qa inline Python (Path.glob used instead)
- Add comment on ADVERSARIAL_PROMPT noting it's used by QA Director when spawning testers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CLI mode validation only checked CEO_MODES and project-local
workflows, ignoring builtin registry entries like design-v2. Two fixes:

1. Add "design-v2" to CEO_MODES in _helpers.py
2. Change fallback validation from project-only to all workflow registry
   entries, so any registered workflow (builtin, contributed, project)
   is automatically valid
3. Add "design-v2" alongside "design" in all mode routing checks so it
   supports --focus, --auto-approve, --from-plan, --just-plan

Closes #1392

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
design-v2 is a builtin workflow discovered by WorkflowRegistry.discover()
and passes the fallback check in _ceo_helpers.py without needing an
explicit CEO_MODES entry. The hardcoded entry was redundant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…2 modes

When --auto-approve is passed, the CEO now receives instructions to act
as the user at approval gates — reviewing plans against user-intent.md
and making PROCEED/feedback decisions instead of waiting for human input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add design-v2 to mode checks in run.py (auto_approve, focus, skip_improve)
- Fix init_user_intent FOCUS env var: read from FACTORY_IDEA env, backlog.md
  fallback, skip if user-intent.md already exists
- Fix single-quote injection in init_user_intent and synthesize_qa by passing
  project_path via sys.argv instead of string interpolation
- Update error messages in _ceo_helpers.py to mention design-v2
- Remove dead ADVERSARIAL_PROMPT constant, fold output format into QA_DIRECTOR_PROMPT

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The command used compound if/else blocks after semicolons in a python3 -c
one-liner, which Python does not allow. Rewritten using ternary expressions
and or-chains: early exit via (sys.exit(0) if cond else None), idea fallback
via env or backlog or default.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown

Sentrux Quality Report

Absolute

Scanning ....
[scan] git ls-files: 616 total, 602 kept, 14 dropped (ext:14, meta:0, big:0)
[build_project_map] 602 files, 107 unique dirs, 99 cache misses, 5.3ms
[resolve] 1141 resolved, 1561 unresolved (of 2702 total specs)
[resolve_imports] project_map 5.4ms, suffix_idx 1.4ms, suffix_resolve 18.5ms, total 25.4ms
[build_graphs] 602 files | maps 2.3ms, imports 25.6ms, calls+inherit 6.1ms, total 34.1ms | 1140 import, 8303 call, 1 inherit edges
sentrux check — 3 rules checked

Quality: 4445

✗ [Error] max_cc: 5 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/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: 616 total, 602 kept, 14 dropped (ext:14, meta:0, big:0)
[build_project_map] 602 files, 107 unique dirs, 99 cache misses, 5.4ms
[resolve] 1141 resolved, 1561 unresolved (of 2702 total specs)
[resolve_imports] project_map 5.5ms, suffix_idx 1.0ms, suffix_resolve 19.7ms, total 26.2ms
[build_graphs] 602 files | maps 2.2ms, imports 26.4ms, calls+inherit 5.8ms, total 34.3ms | 1140 import, 8303 call, 1 inherit edges
sentrux gate — structural regression check

Quality:      4444 -> 4445
Coupling:     0.80 → 0.80
Cycles:       4 → 4
God files:    3 → 3

Distance from Main Sequence: 0.35

✓ No degradation detected

akashgit and others added 2 commits August 29, 2026 17:09
Add PHASE 3 (CODE REVIEW) to QA_DIRECTOR_PROMPT in design_v2. The code
review runs after all adversarial testers complete and is mandatory
regardless of K or adversarial results. Critical/high-severity findings
are flagged as blocking in the QA summary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…tially

The QA Director's Phase 2 now spawns K adversarial testers + 1 code
reviewer all in parallel (backgrounded with &, then wait). Previously
the code review was a separate Phase 3 that ran after testers completed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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