Skip to content

fix(core): harden core super update governance and lifecycle - #802

Merged
Pedrovaleriolopez merged 66 commits into
mainfrom
feat/core-super-update-epic
Jul 10, 2026
Merged

fix(core): harden core super update governance and lifecycle#802
Pedrovaleriolopez merged 66 commits into
mainfrom
feat/core-super-update-epic

Conversation

@oalanicolas

@oalanicolas oalanicolas commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Resumo

  • Endurece auto-dispatch com budget explícito, story binding e varredura de intent/context antes do modelo.
  • Remove avaliação de entrada controlada pelo usuário nos caminhos shell visual e headless.
  • Corrige lifecycle QA/PO, loop FAIL → fixes → re-review, provenance revision-bound e autoridade de checkpoints.
  • Completa o harness Wave 0, port denylist, CI/pre-push e contratos públicos.
  • Elimina open handles e estabiliza a suíte SYNAPSE/integral.

Story

Evidências de qualidade

  • CodeRabbit pós-fix: 0 CRITICAL, 0 major; único minor documental corrigido.
  • Jest integral: 376 suites e 8.957 testes aprovados.
  • npm run lint: PASS, sem erros.
  • npm run typecheck: PASS.
  • npm run build: PASS, publish safety gate com 2.140 arquivos.
  • Port denylist: PASS, 1.262 arquivos e 0 hits.
  • Manifest e registry determinístico: PASS, 844 entidades.
  • git diff --check: PASS.

Escopo excluído

Os artefatos preexistentes abaixo foram preservados fora do stage/commit/PR:

  • tests/integration/wizard-debug.temp.test.js
  • tests/unit/squad/temp-sqs10-resolve-1783638410431/

Summary by CodeRabbit

  • New Features
    • Added aiox sdc preflight (PASS/JSON evidence); governance rejections exit with code 5.
    • Enhanced aiox sdc mark for review with --outcome, enforcing valid outcomes and persisting them.
  • Bug Fixes
    • Improved timeout cleanup in executors/monitoring and safer atomic SDC progress writes.
    • Added deterministic timing hooks for Synapse test runs.
  • Security
    • Introduced dispatch governance (budget + intent threat scanning + story binding) and enforced it in guarded execution.
    • Strengthened credential/secret detection and expanded port denylist enforcement (CI + blocking pre-push).
  • Documentation
    • Updated QA/lifecycle and skill protocols to follow verdict-driven transitions and administrative-only closure.

Introduce .grok/ integration with token-efficient agent profiles,
slash skills, roles, personas, and compact rules. Add regenerable
sync script (npm run sync:skills:grok) so Grok stays aligned with
.source agents under .aiox-core/development/agents/.
Clarify the generator module purpose so entity-registry extraction no
longer picks an unrelated CodeRabbit comment string.
Make Claude subagent governance validate the core aiox-* set instead of
exact directory equality, and guard dev-context-loader cacheHits when
status/shape is incomplete.
CI Install Manifest Validation failed because data/entity-registry.yaml
hash no longer matched install-manifest.yaml after IDS updates.
Escape YAML/TOML scalars, constrain generated write paths under .grok/,
block git push for squad-creator, label markdown fences, and keep the
cacheHits > 0 assertion in dev-context-loader.
Keep install-manifest hash aligned with entity-registry so CI
Install Manifest Validation stays green.
Branch off PR #800 (Grok). Captures P0–P2 waves for SDC skills, runtime
hygiene, orchestration merge, IDE parity, and selective constitution
updates without importing Sinkra product or enterprise IP.

Note: docs/stories is gitignored; force-add for this framework epic only.
MVP cut (A+B), hard A3 merge gates, B0 lean spike, denylist CI story,
deferred D5/E4/F3, semver ship train, tightened A1 ACs. Full finding
resolution table embedded in epic (100% resolved).
…first)

Address architect-first findings: public versionable path (no force-add
gitignored docs/stories), drop stale stories index, ARCH-A slice, A2 as
#797 residual investigation (unref already present), permissions metric
clarified (extend not replace), Wave B–E blocked until per-wave ARCH,
hard ban on workspace/ in OSS, hub XI/XII numbering locked for constitution.
…s/docs

Engine already resolves AIOX_SYNAPSE_PIPELINE_TIMEOUT_MS > core-config
synapse.pipelineTimeoutMs > 100ms default with clamp and timeout warn.
Add unit coverage for precedence/invalid values/soft-fail path and
document knobs in config-override-guide. Closes #798 when merged.
…config

Export resolvePipelineTimeoutMs (env > config > 100ms default, clamp
1-30000), soft-fail remaining layers with console.warn. Config key
synapse.pipelineTimeoutMs. Completes CORE-SU.A1 implementation.
unref() alone still allows post-teardown callbacks. Skip setInterval when
JEST_WORKER_ID is set; keep production timer + unref; gate logs on AIOX_DEBUG;
export disposeConfigCacheTimers. Applies to core and infrastructure copies.
CORE-SU.A2 YOLO.
Extend core/permissions without replacing PermissionMode/OperationGuard.
OSS path deny list excludes product workspace/ trees. Unit tests for
traversal, injection patterns, private/metadata SSRF. Wave A P0.
Add scan for hub/enterprise leakage (workspace product paths, sinkra_*,
mux-adapter, coolify, machine paths). npm run validate:port-denylist;
doctor check port-denylist. Completes Wave A.
Ship OSS lean SDC skill wrappers (validate → develop → review →
apply-qa-fixes → close + full-sdc orchestrator) with tasks as SOT.
Wire grok-skills-sync to copy development/skills → .grok/skills/aiox-*.
Sequence Lock: only close-story sets Done. No product harvest trees.
Add lean SDC/wave engines under .aiox-core/core/sdc with aiox sdc and
aiox wave CLI for plan/next/verify/progress. Upgrade full-sdc skill to
EXECUTE loop; add wave-execute that dispatches full-sdc children via
DAG + file-ownership batches. Grok skills synced; unit tests included.
Close CORE-SU.A1 with hook-runtime synapse config wiring and QA PASS.
Add ARCH-C and wave-run advance/mark/cascade/report CLI. Normalize A2–A4
to Done; package scripts sdc/wave; unit tests for wave-run.
Scan .claude surfaces; fail closed on unreadable paths; doctor wraps
scan errors. Apply lint formatting to sdc/wave-run modules.
Execute CORE-SU-C wave: dispatch-adapter (parallel/sequential pool),
epic-glue + aiox wave from-epic, tests (23). Stories C2–C4 Done;
wave report completed. Skills updated for from-epic flow.
Add install-time hint, doctor windows-npx-install check (17 total),
and docs for cold-cache lock timeout. ARCH-D/E drafts unlock stretch
planning. Wave CORE-SU-F completed via full-sdc.
Remove pm.sh echo-stub: invoke CLAUDE_CMD/claude or fail closed.
Port OSS-safe Articles XI (Squad-First) and XII (Model Governance).
Add ide-sync-contract (D1) and closeout stories for wave-execute.
Official policy: docs/framework/epics/ for versioned framework OSS work;
docs/stories/ remains project L4 (gitignored template). Align AGENTS.md,
CLAUDE.md, story-lifecycle paths, and Grok sync prompts. Gitignore .codex/
until absolute paths / force-push wording are hardened for OSS.
Add npm run diff:framework-3way (peer discovery via env/flags), doctor
advisory framework-3way-diff (18 checks), and ANALYSIS-3WAY-CORRECTIONS
from verified OSS×hub×enterprise facts. Prefer enterprise lean full-sdc
as skill enrichment base; never blind-merge OSS-wins modules.
Cold/warm timeouts, processSessionDigest + debounced reinforce worker,
OSS global-heuristic-hints.yaml, and heuristics unit tests. Does not
replace hook-runtime wholesale. Graceful when MIS absent.
@oalanicolas

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/full-sdc/SKILL.md:
- Around line 98-100: Make the remediation failure path in the
apply-qa-fixes/review loop explicit: if apply_qa_fixes --mark fails, halt and
escalate without returning to review or incrementing qgIterations; only perform
those steps after verification succeeds.

In
`@docs/framework/epics/core-super-update/STORY-CORE-SU.R1-REVIEW-REMEDIATION.md`:
- Line 798: Revise the Performance statement in
STORY-CORE-SU.R1-REVIEW-REMEDIATION.md to qualify the claim: acknowledge the
orchestration process and I/O overhead introduced by the mandatory preflight
before each phase, and state that no significant product-runtime regression was
observed instead of claiming zero runtime cost.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0e5472e2-ec6f-4db8-8c8a-db770f2fc339

📥 Commits

Reviewing files that changed from the base of the PR and between 64fd268 and f769519.

📒 Files selected for processing (8)
  • .aiox-core/data/entity-registry.yaml
  • .aiox-core/development/skills/full-sdc/SKILL.md
  • .aiox-core/install-manifest.yaml
  • .claude/skills/full-sdc/SKILL.md
  • .grok/skills/aiox-full-sdc/SKILL.md
  • docs/framework/epics/core-super-update/LIFECYCLE-AUDIT.md
  • docs/framework/epics/core-super-update/STORY-CORE-SU.R1-REVIEW-REMEDIATION.md
  • tests/unit/lifecycle-close-contract.test.js
✅ Files skipped from review due to trivial changes (2)
  • docs/framework/epics/core-super-update/LIFECYCLE-AUDIT.md
  • .aiox-core/install-manifest.yaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • .aiox-core/data/entity-registry.yaml
  • tests/unit/lifecycle-close-contract.test.js

Comment thread .claude/skills/full-sdc/SKILL.md Outdated
Comment thread docs/framework/epics/core-super-update/STORY-CORE-SU.R1-REVIEW-REMEDIATION.md Outdated
@oalanicolas

Copy link
Copy Markdown
Collaborator Author

CI failure on run 29107314252 was traced to one stale prose-coupled assertion, not Node 24 behavior. Fixed in d2f7c650: the lifecycle audit contract now asserts the stable test-count evidence (8,957, 8,960, 9,010) without requiring the previous English sentence. Local focused test: 21/21 PASS. Full suite: 376 suites / 9,010 tests PASS. QA provenance is bound to deterministic snapshot 920ca1f8; final docs are in cb9881ef. The cancelled Node jobs were fail-fast fallout from the single Node 24 assertion failure.

@oalanicolas

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@oalanicolas

Copy link
Copy Markdown
Collaborator Author

Correções do review incremental publicadas.

  • f683d13: falha de verificação da remediação agora encerra e escala antes de re-review/qgIterations; afirmação de desempenho qualificada.
  • 49e28cd: registry e manifesto regenerados e validados.
  • a68bd88: QA PASS vinculado ao snapshot.

Gates locais: 376 suites / 9.013 testes, build, lint (0 erros), typecheck, denylist, sync IDE 109/109, paridade, manifesto e registry determinístico. Threads tratadas e resolvidas.

@oalanicolas

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resume

@oalanicolas

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

@Pedrovaleriolopez Pedrovaleriolopez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — terminal-spawner hardening + dispatch governance

Reviewed with focus on the orchestration/spawner surface (this PR supersedes #803, which independently fixed the same terminal-window bug — closed in favor of this one).

Strengths ✅

  • Root-cause fix for the Terminal.app window storm: detectEnvironment() now short-circuits on explicit inline (AIOX_INLINE_MODE/AIOX_NO_VISUAL_TERMINAL) and detects test runners (NODE_ENV=test/JEST_WORKER_ID) before granting a visual terminal. Confirmed this matches the field failure (external installs on macOS bursting dozens of Terminal windows on every npm test).
  • The offending test is now hermetic: should accept valid agent ID formats calls the newly-exported validateArgs() directly instead of real spawnAgent() — better than stubbing.
  • Shell safety is real: execFileSync('bash', [scriptPath, ...args]) kills the interpolated-execSync injection path; printf -v quoted '%q' on every value composing full_cmd; osascript now receives the command via argv (on run argv) instead of string interpolation — AppleScript injection closed. The sentinel test (terminal-spawner-shell-safety.test.js) locks these in.
  • Dispatch governance (Constitution XII): mandatory positive AIOX_MODEL_BUDGET_CEILING_USD, story binding with status validation for implementation tasks, intent scanning, dedicated exit code 5. This is what protected the affected machines from token burn while the window bug was live.
  • Nice catch on the _executeWithTimeout timer leak (clearTimeout in finally).

Suggestion (non-blocking) ⚠️

pm.sh spawn_terminal() still only checks INLINE_MODE at the shell level. Anyone invoking bash pm.sh dev test DIRECTLY (not via the Node spawner) from a native macOS shell — a script, a doc example, a future test — still opens a real Terminal window. The JS guard covers all Node callers, but defense in depth at the shell layer is one line:

if [[ "$INLINE_MODE" == "true" || -n "${JEST_WORKER_ID:-}" || "${AIOX_NO_VISUAL_TERMINAL:-false}" == "true" ]]; then

(and mention AIOX_NO_VISUAL_TERMINAL in the pm.sh --help env-vars section). Fine as a follow-up.

Observations (informational)

  • The spawnInline() tests still execute the real pm.sh — now safely blocked by the dispatch guard (exit 5, no model call), but each test spawns bash+node and implicitly depends on the guard existing. Stubbing CLAUDE_CMD or mocking child_process would make them hermetic. Cosmetic.
  • scanAutomatedIntent INT-003 (rm -rf, child_process, eval() may false-positive on legitimate story/context content that describes shell commands. Worth watching in practice since it hard-blocks dispatch.

Verdict: APPROVE. CI is green across all platforms; the fix resolves the reported field issue at the root.

🤖 Generated with Claude Code

@Pedrovaleriolopez
Pedrovaleriolopez merged commit 0ad5a9f into main Jul 10, 2026
47 checks passed
@Pedrovaleriolopez
Pedrovaleriolopez deleted the feat/core-super-update-epic branch July 10, 2026 19:44
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Pedrovaleriolopez

Copy link
Copy Markdown
Contributor

@oalanicolas heads-up — follow-through do merge:

O fix está no main (squash 0ad5a9f3). No seu clone: git checkout main && git pull (a branch deste PR foi deletada). Até o pull, a mitigação segue sendo CI=true npm test.

📦 v5.3.0 publicada hoje com este fix: @aiox-squads/core@5.3.0 e o wrapper legacy aiox-core@5.3.0 (npm latest). O release estava travado num version-lockstep do publish gate — destravado no #804 (sync automático de .aiox-core/package.json + compat/aiox-core/package.json no prepare do semantic-release + encadeamento explícito do npm-publish.yml).

O follow-up do review (guard shell-level no pm.sh spawn_terminal()) continua aberto.

Pedrovaleriolopez added a commit that referenced this pull request Jul 11, 2026
…802 follow-up) (#805)

The #802 review approved with one non-blocking follow-up: spawn_terminal()
only checked INLINE_MODE at the shell level, so a DIRECT `bash pm.sh dev
test` invocation (script, doc example, future test) on native macOS still
opened a real Terminal.app window — the Node spawner's detectEnvironment()
guard only covers Node callers.

- pm.sh spawn_terminal(): guard now mirrors detectEnvironment() — forces
  the inline path when JEST_WORKER_ID is set, NODE_ENV=test, CI=true, or
  AIOX_NO_VISUAL_TERMINAL=true (in addition to AIOX_INLINE_MODE).
- pm.sh --help: documents AIOX_NO_VISUAL_TERMINAL and the implied signals.
- terminal-spawner-shell-safety.test.js: sentinel locks the guard in
  (same source-assertion pattern as the existing shell-safety sentinels).

Verified behaviorally on native macOS: each of the four signals routes a
direct `bash pm.sh dev <task>` into inline mode (dispatch-governance
exit 5, no model call) with zero Terminal windows opened.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: agents Agent system related area: core Core framework (.aios-core/core/) area: devops CI/CD, GitHub Actions (.github/) area: docs Documentation (docs/) released type: test Test coverage and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants