Commit Graph

1497 Commits

Author SHA1 Message Date
freemo 7861991043 docs(mkdocs): update navigation for split specification 2026-04-03 19:49:23 +00:00
freemo d79380074e docs(spec): add specification/cli.md 2026-04-03 19:47:14 +00:00
freemo 75eb1ae3da docs(spec): add specification/core-concepts.md 2026-04-03 19:46:17 +00:00
freemo ec2a7ca63a docs(spec): add specification/architecture.md 2026-04-03 19:40:58 +00:00
freemo 73de1a214a docs(spec): add specification/workflow-examples.md 2026-04-03 19:37:33 +00:00
freemo 5126ab16f6 docs(spec): add specification/configuration.md 2026-04-03 19:35:47 +00:00
freemo 474e161dd0 docs(spec): add specification/tui.md 2026-04-03 19:30:51 +00:00
freemo ac24164f81 docs(spec): add specification/behavior.md 2026-04-03 19:15:18 +00:00
freemo a5d2eed3d9 docs(spec): add specification/glossary.md 2026-04-03 19:10:22 +00:00
freemo 2dc4a9e2e7 docs(spec): create specification/index.md with navigation 2026-04-03 19:04:14 +00:00
freemo 77427bd7d3 chore(agents): add deep session introspection to system watchdog
Enhance the system watchdog with OpenCode Server API session introspection
to read actual supervisor conversations, tool calls, and todo lists.

Upgrade Audit 6 (Zombie Detection) to use message-based analysis instead
of only checking Forgejo activity — reads last 5 messages from each
supervisor session to detect sleep-only patterns, error loops, and
identical repeated tool calls.

Add Audit 11 (Quick Session Spot-Check) running every 5-minute cycle:
scans the 3 most recently active sessions for critical policy violations
including force_merge usage, direct pushes to master, and type:ignore
suppressions in written code.

Add Audit 12 (Deep Session Introspection) running every 30 minutes:
full analysis of all 16 supervisor sessions reading last 10 messages
and todo lists. Detects misbehavior patterns, progress stalls via todo
list analysis, conversation health metrics (error rates, sleep ratios),
context exhaustion signals, and cross-agent conflicts (multiple agents
touching the same PR or issue).

Update action dispatch to handle new finding types: force_merge_detected,
direct_push_to_master, stuck_supervisor, looping_supervisor, high_error_rate,
context_exhaustion, and cross_agent_pr_conflict.
2026-04-03 18:13:19 +00:00
freemo 8c13e63c75 chore(agents): add system watchdog, remove force_merge, fix 9 systemic agent issues
Add ca-system-watchdog (16th supervisor) for continuous system health
monitoring with quality gate auditing, zombie detection, ticket state
reconciliation, and priority enforcement. Add ca-quality-enforcer and
ca-state-reconciler as one-off fix agents dispatched by the watchdog.

Critical fix: remove all force_merge: true usage from ca-pr-self-reviewer
which was bypassing branch protection and allowing PRs to merge with
failing CI. Replace with strict CI-gating merge logic that respects
branch protection rules per CONTRIBUTING.md.

Update product-builder to launch 16 supervisors, strengthen anti-return
language with explicit context hygiene, add tracking ticket lifecycle
management (one open at a time, closed on completion).

Update ca-project-bootstrapper with strict branch protection config
requiring status-check CI context, 2 approvals, and dismiss stale reviews.
Fix label set to match CONTRIBUTING.md exactly.

Update issue-implementor with priority gate enforcing lowest-milestone-first
and critical-bugs-first ordering. Update ca-backlog-groomer with closed
issue state reconciliation, PAT for REST API dependency operations, and
health signaling. Update ca-spec-updater with proactive full-scan mode.

Add health signaling and context self-management to 7 continuous
supervisors to prevent zombie sessions from context exhaustion.

Strengthen state label transitions in ca-pr-self-reviewer, ca-pr-api-creator,
ca-issue-state-updater, and ca-backlog-groomer to ensure closed issues
always have correct terminal state labels.

Add Forgejo PAT and REST API curl templates for dependency link creation
to ca-backlog-groomer and ca-project-owner since the MCP does not support
dependency manipulation.
2026-04-03 14:01:41 -04:00
freemo dd17d0f8e6 docs(tui): add shell safety, permission question widget, and first-run docs
Add reference documentation for three new TUI features:

- docs/reference/tui_shell_safety.md: Full reference for the shell danger
  detection subsystem (DangerousPatternDetector, ShellDangerLevel,
  DangerousPattern, DangerousCommandWarning, DEFAULT_PATTERNS registry).
  Covers all built-in patterns across CRITICAL/HIGH/MEDIUM/LOW levels,
  usage examples, and custom pattern extension.

- docs/reference/tui_permission_question.md: Full reference for the inline
  PermissionQuestionWidget (issue #997). Documents InlinePermissionQuestion,
  PermissionRequestType, PermissionDecision, render_permission_question(),
  PermissionDecisionEvent, and PermissionQuestionWidget with key bindings
  and usage examples.

- docs/reference/tui.md: Extended with First-Run Experience section
  (ActorSelectionOverlay, first_run helpers), Inline Permission Questions
  section, shell danger detection note in Shell Mode, updated module table,
  and links to new reference pages.
2026-04-03 18:01:26 +00:00
freemo 6dfd7e6b35 Merge pull request 'chore(noxfile): extend pre-migrated database template to slow_integration_tests and e2e_tests' (#2399) from chore/ci-execution-time-template-db-all-suites into master 2026-04-03 17:41:44 +00:00
freemo d650df3622 Merge pull request 'docs(timeline): update schedule adherence Day 54 (2026-04-03)' (#2371) from docs/timeline-day54-update-2026-04-03 into master 2026-04-03 17:41:04 +00:00
freemo dd363e2a45 docs(agents): clarify product-builder execution model and prevent implementation confusion
Added critical warning block and step-by-step checklist to product-builder.md
to ensure the agent always follows the correct workflow:

1. Launch 15 supervisors via curl to http://localhost:4096/session/:id/prompt_async
2. Monitor them with bash sleep loop (60 seconds between checks)
3. Re-launch any that exit

Key changes:
- ⚠️ Critical execution model warning at top (what to do / what NOT to do)
- 📊 Execution flow diagram showing all phases
-  Step-by-step Phase C checklist (C.1: Pre-flight, C.2: Launch, C.3: Monitor)
- 🔒 Clearer permission blocks with explicit bans on implementation agents
- 📝 Comments explaining why supervisors use curl not Task tool

This prevents the product-builder from trying to implement issues directly,
which is the supervisors' job. Product-builder is a process supervisor (like
systemd), not a worker.
2026-04-03 13:38:33 -04:00
freemo 33c1e4cd1a test(plan): add TDD issue-capture test for NamespacedName digit-start validation bug
This TDD test captures the buggy behavior where `NamespacedName.validate_namespace()`
and `validate_name()` accept names starting with digits, violating the spec requirement
that namespace and name components must start with a letter (consistent with
`_BARE_NAME_RE` in project.py).

Three failing scenarios demonstrate the bug:
1. parse() accepting namespace starting with digit ("123abc/my-action")
2. constructor accepting name starting with digit (local/"123-action")
3. constructor accepting namespace starting with digit ("999org"/valid-name)

Tagged with @tdd_expected_fail per Bug Fix Workflow.

Implements #2145
Blocks #2147
2026-04-03 13:38:33 -04:00
freemo 1c3f2dfc04 chore(noxfile): extend pre-migrated database template to slow_integration_tests and e2e_tests
Both slow_integration_tests and e2e_tests sessions require a database
(via setup_workspace() in helper scripts) but were not using the
pre-migrated template DB optimization already present in unit_tests,
integration_tests, and coverage_report.

Changes:
- slow_integration_tests: add _create_template_db() call, set
  CLEVERAGENTS_TEMPLATE_DB env var, upgrade from robot to pabot for
  parallel execution, add NO_COLOR/PYTHONPATH/PATH/compileall setup,
  add --include slow / --exclude discovery/code_blocks/wip/E2E/tdd_fixture
  tag filters, and update docstring.
- e2e_tests: add _create_template_db() call and set
  CLEVERAGENTS_TEMPLATE_DB env var. The existing setup_workspace()
  in helper_e2e_common.py already checks this env var and copies the
  template instead of running 25+ Alembic migrations.

No changes to test helper files are required since setup_workspace()
already implements the fast-path copy logic when CLEVERAGENTS_TEMPLATE_DB
is set.

ISSUES CLOSED: #2334
2026-04-03 17:31:35 +00:00
freemo 744abb9d62 docs(timeline): update schedule adherence Day 54 (2026-04-03) 2026-04-03 17:23:55 +00:00
freemo 8866c58bd4 fix(agents): prevent backlog groomer from closing PRs as duplicates of their tracking issues
Agent evolver identified a critical systematic pattern:
- Pattern: The backlog groomer was closing PRs as 'duplicates' of their
  linked tracking issues. A PR containing 'Closes #N' was being treated
  as a duplicate of issue #N, when it is actually the implementation
  delivery vehicle for that issue.
- Evidence: At least 12 PRs were incorrectly closed (#1219, #1236, #1247,
  #1269, #1267, #953, #1198, #1220, #1237, #1238, #1246, #1248) — all
  with the same 'Duplicate Detected' comment pattern from groomer-1.
- Fix: Added explicit instructions to skip PRs during duplicate detection,
  added a guard in the analysis loop pseudocode, and added a rule in the
  Important Rules section.

This change requires human approval before taking effect.

ISSUES CLOSED: #2180
2026-04-03 07:09:23 +00:00
freemo 0d768b78fa Merge pull request 'docs(tui): document PermissionQuestionWidget and add CHANGELOG entry' (#2181) from docs/update-tui-permission-question-widget into master 2026-04-03 06:41:25 +00:00
freemo d66887766f docs(tui): document PermissionQuestionWidget and add CHANGELOG entry
Add PermissionQuestionWidget API documentation to docs/api/tui.md including
method table, key bindings, PermissionDecisionEvent dataclass, and
render_permission_question() helper reference. Add corresponding CHANGELOG
entry under [Unreleased] Added section.

Refs: #997
2026-04-03 06:39:51 +00:00
freemo 0be3f85c56 feat(tui): implement Permission Question Widget
Implement inline permission question widget for quick allow/reject
decisions within the conversation stream with file diff context.

ISSUES CLOSED: #997
2026-04-03 05:56:27 +00:00
eugen.thaci f66fb5a19a docs(spec): align ASCII UI tables in specification and related pages
Align Unicode box-drawing blocks and related tables in specification.md,
ADR-044/045/046, and reference pages for consistent MkDocs rendering.

ISSUES CLOSED: #1171
2026-04-03 04:55:21 +00:00
freemo 2770f6afdd docs: restructure [Unreleased] CHANGELOG and add entries for recent merged PRs
Consolidate duplicate Added/Fixed headings in [Unreleased] section into single canonical sections per Keep a Changelog format. Add new entries for DomainBaseModel (#1941) and TDD bug-capture test (#1094).

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-03 04:16:19 +00:00
freemo bbfa5bef01 Merge pull request 'chore(agents): add open PR awareness to UAT tester duplicate avoidance' (#1446) from improvement/uat-tester-check-open-prs into master 2026-04-03 04:13:10 +00:00
freemo 51fcd13220 Merge pull request 'chore(agents): add pre-PR rebase step to issue worker to prevent stale conflicts' (#1407) from improvement/issue-worker-rebase-before-pr into master 2026-04-03 04:10:46 +00:00
brent.edwards df41f64f21 test: add TDD bug-capture test for #989 — JSON decode crash in persistence
Add a new Behave TDD regression scenario that persists corrupt automation-profile JSON and verifies repository reads do not leak raw JSONDecodeError. The scenario is tagged with @tdd_bug, @tdd_bug_989, and @tdd_expected_fail so it currently inverts the intentional assertion failure and will require tag removal when bug #989 is fixed.\n\nAlso stabilize an unrelated integration fixture in robot/resource_dag.robot by sharing a single SQLAlchemy session in inline scripts; this removes nondeterministic visibility of flushed resource-type rows and keeps required nox integration quality gates deterministic for this branch.\n\nISSUES CLOSED: #1094
2026-04-03 03:58:45 +00:00
freemo f6ba8fee56 chore(agents): add pre-PR rebase step to issue worker
Agent evolver identified a systematic pattern:
- Pattern: PR stale/conflict cascade
- Evidence: 11+ PRs were approved but closed without merge due to
  conflicts. PRs #1248, #1247, #1237, #1236, #1220, #1219, #1238,
  #1246, #1269 were all bulk-closed as stale. Reviewer notes on
  #1248, #1220, #1219, #1252 explicitly mention 'merge blocked by
  conflicts'. With 16 parallel workers, master moves fast and branches
  created minutes earlier are already behind by the time PRs are created.
- Fix: Add a rebase-onto-latest-master step (Phase 3, Step 3.0) in
  ca-issue-worker before committing and creating the PR. This ensures
  the branch is current when the PR is opened, dramatically reducing
  the chance of merge conflicts when the reviewer processes it.

This change requires human approval before taking effect.
2026-04-03 03:57:52 +00:00
freemo 81319b575a Merge pull request 'fix(agents): add two-phase claim protocol to prevent duplicate PR reviews' (#1326) from improvement/pr-reviewer-double-claim-prevention into master 2026-04-03 03:41:30 +00:00
freemo 9c7876a913 chore(agents): add open PR awareness to UAT tester duplicate avoidance
Agent evolver identified a systematic pattern:
- Pattern: UAT tester filing bugs for features already being implemented
- Evidence: 25+ UAT bugs filed for TUI MainScreen features (#1329-#1355)
  that already had open implementation PRs (#1219, #1236, #1237, #1238,
  #1246, #1247, #1248, etc.). The tester reported 'missing sidebar',
  'missing tab bar', 'missing escape navigation' etc. while PRs
  implementing these exact features were open and under review.
- Fix: Add step 4 to duplicate avoidance requiring the tester to check
  for open PRs before filing 'missing feature' bugs.

This change requires human approval before taking effect.
2026-04-03 03:38:48 +00:00
freemo c38be2eed8 fix(ci): address review feedback on nightly-quality workflow
- Add missing 'nox -s format -- --check' step (parity with ci.yml)
- Add NOX_DEFAULT_VENV_BACKEND: uv to global env and each nox step
- Fix quality gates script invocation (was using invalid nox session '3.13')
- Fix report artifact paths to match actual nox session output locations
  (build/coverage.json and build/bandit-report.json instead of build/reports/)
- Add mkdir for build/reports before writing quality-trend.json

ISSUES CLOSED: #1537
2026-04-03 03:37:10 +00:00
freemo 36ac24f2dd chore(ci): refactor nightly-quality workflow to use nox sessions
- Replaced manual uv pip install with nox invocations for all quality checks
- Mapped workflow steps to nox sessions:
  - Lint: ruff format + ruff check → nox -s lint
  - Type checking: pyright → nox -s typecheck
  - Security: bandit + semgrep → nox -s security_scan
  - Dead code: vulture → nox -s dead_code
  - Complexity: radon → nox -s complexity
  - Tests + coverage: behave → nox -s unit_tests + coverage_report
- Removed explicit dependency installation steps (nox handles this)
- Removed RUFF_VERSION env var (nox uses pinned versions from pyproject.toml)
- Workflow now consistent with ci.yml approach

Fixes #1537
2026-04-03 03:37:10 +00:00
freemo 28ddfe3873 Merge pull request 'chore(agents): add finding validation requirements to bug hunter' (#1445)
chore(agents): add finding validation requirements to bug hunter

Adds mandatory finding validation checklist to ca-bug-hunter agent prompt
to reduce false-positive and speculative issue filings.

Reviewed-by: ca-pr-self-reviewer
2026-04-03 03:35:47 +00:00
freemo 977cacc299 Merge pull request 'refactor(domain): extract shared model_config into a base Pydantic model' (#2014) from fix/domain-pydantic-base-model-config into master 2026-04-03 03:29:26 +00:00
freemo 108d87e1bb docs: update CHANGELOG and A2A API docs for recent merged PRs
Add CHANGELOG [Unreleased] entries for 6 recently merged commits:
- feat(tui): shell danger detection patterns (#1003)
- fix(a2a): JSON-RPC 2.0 wire format compliance — BREAKING field rename (#1501)
- fix(cli): disallow mixing legacy and v3 plan workflows (#1577)
- fix(cli): actor add rich output missing panels
- fix(infra): E2E suite centralized database initialization (#1023)
- ci(pipeline): parallelized static analysis jobs

Update docs/api/a2a.md to reflect JSON-RPC 2.0 field name changes:
A2aRequest.operation → method, A2aResponse.data → result, etc.
2026-04-03 02:43:00 +00:00
freemo a538713134 refactor(agents): enforce strict curl-only permissions for all supervisors
BREAKING CHANGE: Supervisors can no longer use Task tool to launch workers

Major refactor of the permission model for product-builder and all 15
continuous supervisors to enforce strict separation: supervisors MUST use
curl/prompt_async via bash to launch workers, and CANNOT use the Task tool.

Key Changes:

1. Product-Builder Permissions (product-builder.md):
   - Removed ALL Task permissions for supervisors (previously had 17)
   - Kept Task permissions ONLY for 7 one-shot agents:
     ca-project-bootstrapper, ca-ref-reader, ca-issue-finder,
     ca-session-persister, ca-product-verifier, ca-milestone-reviewer,
     ca-final-reporter
   - Restricted bash to: echo, curl, sleep, jq only
   - Removed Phase B (Architecture) and Phase C.1 (Planning)
   - Updated to launch 15 supervisors (up from 13)

2. New Continuous Supervisors:
   - ca-architect: Converted from one-shot to continuous supervisor
     Monitors for spec needs, new milestones, ambiguities
   - ca-epic-planner: Converted from one-shot to continuous supervisor
     Monitors for milestones without issues, incomplete epics

3. All 15 Supervisors - Standardized Permissions:
   - Removed ALL Task permissions for launching workers
   - Workers MUST be launched via curl to OpenCode Server prompt_async API
   - Added 'jq *' for JSON parsing (replacing python3)
   - Restricted bash to specific commands only (deny all, allow specific)
   - Git commands restricted to specific operations (clone*, fetch*, etc.)
   - Directory operations (cd, mkdir, rm -rf) only where needed

4. Supervisor-Specific Updates:
   - issue-implementor: Removed ca-issue-worker task permission
   - ca-continuous-pr-reviewer: Added git + directory ops, removed worker tasks
   - ca-uat-tester: Added read-only file/git commands, removed self-dispatch
   - ca-bug-hunter: Restricted git to read-only, removed self-dispatch
   - ca-test-infra-improver: Added read-only commands, removed self-dispatch
   - ca-human-liaison: Removed ca-epic-planner/ca-architect task permissions
   - ca-agent-evolver: Added git + directory operations
   - ca-architecture-guard: Added read-only + git clone operations
   - ca-spec-updater: Added git + directory operations
   - ca-backlog-groomer: Removed ca-epic-planner task permission
   - ca-docs-writer: Added git + directory operations
   - ca-timeline-updater: Added git + directory operations
   - ca-project-owner: Minimal permissions (curl, jq, sleep only)

Impact:
- Proper separation of concerns: supervisors orchestrate, workers execute
- No possibility of supervisors blocking on Task tool calls
- True fire-and-forget worker launching via prompt_async
- Consistent permission model across all 15 supervisors
- Maximum parallelism with proper isolation

Architecture now enforces: Product-builder → 15 supervisors → N workers
All launched via curl/prompt_async, NO Task tool for supervisors.
2026-04-03 02:33:00 +00:00
freemo 859c564f69 Merge pull request 'fix(infra): ensure E2E suite setup initializes database before CLI commands' (#1177) from fix/e2e-auto-init into master 2026-04-03 02:06:59 +00:00
freemo 650b1038b6 refactor(domain): extract shared model_config into a base Pydantic model
Introduce DomainBaseModel in src/cleveragents/domain/models/base.py that
defines the single shared model_config (str_strip_whitespace, validate_assignment,
arbitrary_types_allowed=False, populate_by_name, use_enum_values) previously
duplicated verbatim across five domain model files.

Update 14 classes across five files to inherit from DomainBaseModel instead
of pydantic.BaseModel directly, removing all inline model_config duplication:
- aimodelscredentials/ai_models_credentials.py (ModelProviderOption)
- aimodelserrors/ai_models_errors.py (ModelError, FallbackResult)
- aimodelsproviders/ai_models_providers.py (ModelProviderExtraAuthVars,
  ModelProviderConfigSchema)
- auth/auth.py (AuthHeader, TrialPlansExceededError, TrialMessagesExceededError,
  BillingError, ApiError, ClientAccount, ClientAuth)
- planconfig/plan_config.py (PlanConfig, ConfigSetting)

Pure structural refactor — no behavioral changes. Models with different
configurations (acms, aimodels_custom, etc.) are left untouched.

Add BDD feature (22 scenarios) and Robot integration tests (8 test cases)
verifying inheritance, config correctness, and no-duplication invariants.

ISSUES CLOSED: #1941
2026-04-03 02:01:45 +00:00
brent.edwards 998aaf25f8 fix(infra): ensure E2E suite setup initializes database before CLI commands
Centralize E2E initialization in common suite setup so DB-dependent CLI commands no longer rely on per-suite or per-test init workarounds. This also sanitizes suite-home names to prevent invalid path-derived initialization failures in isolated Robot runs.

ISSUES CLOSED: #1023
2026-04-03 01:43:27 +00:00
freemo 8f24887ecf Merge pull request 'fix(cli): disallow mixing legacy and v3 plan workflows' (#1577) from fix/prevent-legacy-v3-mixing into master 2026-04-03 01:24:06 +00:00
freemo 50a5e9672b feat(tui): implement shell danger detection patterns
Implement dangerous shell pattern detection with configurable pattern registry, danger level classification, and user warning system.

Closes #1003

ISSUES CLOSED: #1003
2026-04-03 01:15:23 +00:00
freemo 70e2ce4386 Merge pull request 'fix(infra): resolve TLS handshake failure on git.dev.cleveragents.com' (#1865) from fix/infra-tls-handshake-failure-git-dev into master 2026-04-03 01:13:31 +00:00
freemo b6ea4cd1e6 Merge pull request 'fix(cli): add missing Type field, Config, Capabilities, and Tools panels to actor add rich output' (#1969) from fix/actor-add-rich-output-missing-panels into master 2026-04-03 01:12:34 +00:00
freemo b7574a4fdd Merge pull request 'fix(a2a): rename A2aRequest/A2aResponse fields to comply with JSON-RPC 2.0 wire format' (#1990) from fix-1501-a2a-jsonrpc-wire-format into master 2026-04-03 01:12:34 +00:00
freemo a126a1c5bb Merge pull request 'fix(tests): resolve flakiness in test_example_flaky_test' (#1810) from fix/test-infra-flaky-test-example into master 2026-04-03 01:09:32 +00:00
freemo 6228129919 Merge pull request 'ci(pipeline): parallelize lint, typecheck, security, and quality jobs' (#1633) from task/ci-parallelize-static-analysis into master 2026-04-03 01:08:43 +00:00
freemo 971d6a154d Merge pull request 'test(actors): fix actor examples missing provider fields and incorrect name' (#1733) from fix-1504-actor-examples-missing-fields into master 2026-04-03 01:08:40 +00:00
freemo a39c718363 Merge pull request 'chore(ci): extract behave-parallel runner script from noxfile.py into scripts/' (#1775) from chore/extract-behave-parallel-script into master 2026-04-03 01:08:39 +00:00
freemo 55b9b3605e fix(deps): upgrade aiohttp to 3.13.4 to remediate CVE-2026-34515 open redirect
Add explicit aiohttp>=3.13.4 dependency constraint to pyproject.toml to remediate CVE-2026-34515, a high-severity open redirect vulnerability. The lockfile already resolves aiohttp to 3.13.5 which satisfies the constraint.

Closes #1544
2026-04-03 01:08:34 +00:00