Nx 22 generators inject AI agent tooling into the repo via marked sections and side files. Rather than re-deleting them after every generator run, track the workspace-level ones and document why. - CLAUDE.md gains a 'General Guidelines for working with Nx' section between Nx-managed markers; future Nx versions will update this section automatically without touching our project rules above. Pre-existing prettier-formatted blank lines added before code blocks are kept. - .claude/settings.json (228 bytes) enables the nx-claude-plugins marketplace from nrwl/nx-ai-agents-config; tracked for contributor consistency. The personal .claude/settings.local.json stays gitignored. - .github/ is the Nx AI skills/prompts/agents catalog. Kept despite being GitHub-named; it does not conflict with our Gitea workflows which will live under .gitea/workflows/ (per ADR-0015). - .gitignore picks up Nx-managed transient dirs (.nx/polygraph, .claude/worktrees) and a trailing newline fix. AGENTS.md is removed: it duplicated only the Nx auto-injected guidance that CLAUDE.md already carries (CLAUDE.md is the strictly broader file - project rules + Nx section). One source of truth for AI-agent guidance.
4.8 KiB
Detailed Status Handling & Fix Flows
Status Handling by Code
fix_auto_apply_skipped
The script returns autoApplySkipReason in its output.
- Report the skip reason to the user (e.g., "Auto-apply was skipped because the previous CI pipeline execution was triggered by Nx Cloud")
- Offer to apply the fix manually — spawn UPDATE_FIX subagent with
APPLYif user agrees - Record
last_cipe_url, enter wait mode
fix_apply_ready
- Spawn UPDATE_FIX subagent with
APPLY - Record
last_cipe_url, enter wait mode
fix_needs_local_verify
The script returns verifiableTaskIds in its output.
- Detect package manager:
pnpm-lock.yaml→pnpm nx,yarn.lock→yarn nx, otherwisenpx nx - Run verifiable tasks in parallel — spawn
generalsubagents for each task - If all pass → spawn UPDATE_FIX subagent with
APPLY, enter wait mode - If any fail → Apply Locally + Enhance Flow (see below)
fix_needs_review
Spawn FETCH_HEAVY subagent, then analyze fix content (suggestedFixDescription, suggestedFixSummary, taskFailureSummaries):
- If fix looks correct → apply via MCP
- If fix needs enhancement → Apply Locally + Enhance Flow
- If fix is wrong → run
ci-state-update.mjs gate --gate-type local-fix. If not allowed, print message and exit. Otherwise → Reject + Fix From Scratch Flow
fix_failed / no_fix
Spawn FETCH_HEAVY subagent for taskFailureSummaries. Run ci-state-update.mjs gate --gate-type local-fix — if not allowed, print message and exit. Otherwise attempt local fix (counter already incremented by gate). If successful → commit, push, enter wait mode. If not → exit with failure.
environment_issue
- Run
ci-state-update.mjs gate --gate-type env-rerun. If not allowed, print message and exit. - Spawn UPDATE_FIX subagent with
RERUN_ENVIRONMENT_STATE - Enter wait mode with
last_cipe_urlset
self_healing_throttled
Spawn FETCH_HEAVY subagent for selfHealingSkipMessage.
- Parse throttle message for CI Attempt URLs (regex:
/cipes/{id}) - Reject previous fixes — for each URL: spawn FETCH_THROTTLE_INFO to get
shortLink, then UPDATE_FIX withREJECT - Attempt local fix: Run
ci-state-update.mjs gate --gate-type local-fix. If not allowed → skip to step 4. Otherwise usefailedTaskIdsandtaskFailureSummariesfor context. - Fallback if local fix not possible or budget exhausted: push empty commit (
git commit --allow-empty -m "ci: rerun after rejecting throttled fixes"), enter wait mode
no_new_cipe
- Report to user: no CI attempt found, suggest checking CI provider
- If
--auto-fix-workflow: detect package manager, run install, commit lockfile if changed, enter wait mode - Otherwise: exit with guidance
cipe_no_tasks
- Report to user: CI failed with no tasks recorded
- Retry:
git commit --allow-empty -m "chore: retry ci [monitor-ci]"+ push, enter wait mode - If retry also returns
cipe_no_tasks: exit with failure
Fix Action Flows
Apply via MCP
Spawn UPDATE_FIX subagent with APPLY. New CI Attempt spawns automatically. No local git ops.
Apply Locally + Enhance Flow
nx-cloud apply-locally <shortLink>(sets state toAPPLIED_LOCALLY)- Enhance code to fix failing tasks
- Run failing tasks to verify
- If still failing → run
ci-state-update.mjs gate --gate-type local-fix. If not allowed, commit current state and push (let CI be final judge). Otherwise loop back to enhance. - If passing → commit and push, enter wait mode
Reject + Fix From Scratch Flow
- Run
ci-state-update.mjs gate --gate-type local-fix. If not allowed, print message and exit. - Spawn UPDATE_FIX subagent with
REJECT - Fix from scratch locally
- Commit and push, enter wait mode
Environment vs Code Failure Recognition
When any local fix path runs a task and it fails, assess whether the failure is a code issue or an environment/tooling issue before running the gate script.
Indicators of environment/tooling failures (non-exhaustive): command not found / binary missing, OOM / heap allocation failures, permission denied, network timeouts / DNS failures, missing system libraries, Docker/container issues, disk space exhaustion.
When detected → bail immediately without running gate (no budget consumed). Report that the failure is an environment/tooling issue, not a code bug.
Code failures (compilation errors, test assertion failures, lint violations, type errors) are genuine candidates for local fix attempts and proceed normally through the gate.
Git Safety
- Stage specific files by name —
git add -Aorgit add .risks committing the user's unrelated work-in-progress or secrets
Commit Message Format
git commit -m "fix(<projects>): <brief description>
Failed tasks: <taskId1>, <taskId2>
Local verification: passed|enhanced|failed-pushing-to-ci"