test: recover orchestration coverage from PR 426 - #789
Conversation
|
@bendogabriel is attempting to deploy a commit to the SINKRA - AIOX Team on Vercel. A member of the Team first needs to authorize it. |
|
Welcome to aiox-core! Thanks for your first pull request. What happens next?
PR Checklist:
Thanks for contributing! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughAdds 15 new Jest test suites (~6,187 lines) covering orchestration, execution, validation, recovery, dashboard/CLI, prompt building, surface checking, and circuit breaker behavior; tests only, no production API changes. ChangesComprehensive Jest Test Suites for Orchestration & ID Management
Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
🧹 Nitpick comments (2)
tests/core/ids/circuit-breaker.test.js (1)
89-89: ⚡ Quick winReplace hardcoded
61000withDEFAULT_RESET_TIMEOUT_MS + delta.These timeout checks are currently tied to a magic number, which makes tests brittle if the default timeout constant changes. Since
DEFAULT_RESET_TIMEOUT_MSis already imported, compute from it directly.Proposed diff
- breaker._lastFailureTime = Date.now() - 61000; + breaker._lastFailureTime = Date.now() - (DEFAULT_RESET_TIMEOUT_MS + 1000); ... - breaker._lastFailureTime = Date.now() - 61000; + breaker._lastFailureTime = Date.now() - (DEFAULT_RESET_TIMEOUT_MS + 1000);Also applies to: 229-229
🤖 Prompt for 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. In `@tests/core/ids/circuit-breaker.test.js` at line 89, Replace the magic number 61000 used to set breaker._lastFailureTime with a value computed from DEFAULT_RESET_TIMEOUT_MS plus a small delta (e.g., DEFAULT_RESET_TIMEOUT_MS + 1000) so the test remains stable if the default changes; update both occurrences that set breaker._lastFailureTime (line using breaker._lastFailureTime = Date.now() - 61000 and the second occurrence around line 229) to compute Date.now() - (DEFAULT_RESET_TIMEOUT_MS + delta) instead, ensuring DEFAULT_RESET_TIMEOUT_MS is used directly and the delta is declared clearly in the test.tests/core/orchestration/agent-invoker.test.js (1)
18-18: ⚡ Quick winConsolidated root cause: import-style policy drift across recovered test suites.
All three files use relative requires for core orchestration modules, conflicting with the repository’s absolute-import rule. Applying the project alias/path convention consistently here will keep lint/style contracts aligned and prevent future churn.
🤖 Prompt for 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. In `@tests/core/orchestration/agent-invoker.test.js` at line 18, The test currently imports the orchestration module using a relative require (require('../../../.aiox-core/core/orchestration/agent-invoker')), which violates the project's absolute-import/alias convention; update the import to use the repository's absolute alias for the agent-invoker module (e.g. require('`@aiox-core/core/orchestration/agent-invoker`') or the configured alias used elsewhere) so the destructured symbols from agent-invoker are loaded via the canonical path and align with the repo import policy.Source: Coding guidelines
🤖 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 `@tests/core/ids/circuit-breaker.test.js`:
- Line 16: Replace the relative
require('../../../.aiox-core/core/ids/circuit-breaker') in the test with the
project's absolute import form used elsewhere (i.e., swap the require call that
references '../../../.aiox-core/core/ids/circuit-breaker' for the repo's
absolute module path for the same module); update the require/import in
tests/core/ids/circuit-breaker.test.js so it uses the canonical absolute module
identifier for the circuit-breaker module.
In `@tests/core/orchestration/agent-invoker.test.js`:
- Around line 128-135: The test 'returns failure when task not found' currently
allows multiple failure reasons; change the mocks to simulate a successful agent
load but with the task missing: set fs.pathExists.mockResolvedValue(true) (so
the agent file is considered present), mock whatever module-loading used by
invoker.invokeAgent (e.g., the dynamic require/loader or invoker._loadAgent /
invoker.loadAgent stub) to return an agent object that does not contain
'nonexistent-task', then call invoker.invokeAgent('dev','nonexistent-task') and
assert that result.success is false and that result.error or result.message
specifically indicates "task not found" (or the exact missing-task error string
returned by invokeAgent) to ensure you exercise the missing-task branch.
In `@tests/core/orchestration/cli-commands.test.js`:
- Around line 11-20: Replace the relative require imports with absolute module
imports: change the require of
'../../../.aiox-core/core/orchestration/master-orchestrator' to the project's
absolute package/module path that exports MasterOrchestrator, and change the
destructured require for orchestrate, orchestrateStatus, orchestrateStop,
orchestrateResume, and commands from
'../../../.aiox-core/core/orchestration/cli-commands' to its absolute import
path; ensure the imported symbols (MasterOrchestrator, orchestrate,
orchestrateStatus, orchestrateStop, orchestrateResume, commands) remain
unchanged so existing tests reference the same identifiers.
In `@tests/core/orchestration/condition-evaluator.test.js`:
- Line 8: Replace the relative require for the ConditionEvaluator module with
the repository's absolute module alias; find the line importing
ConditionEvaluator in the test and change the path to the absolute package
import (e.g., the '`@aiox-core/core/orchestration/condition-evaluator`' style
alias used by the project), making sure it matches the configured module
resolution/aliases used in the codebase and test runtime so the test imports
resolve without relative traversal.
In `@tests/core/orchestration/dashboard-integration.test.js`:
- Line 21: The test imports DashboardIntegration and NotificationType using a
relative path; update the require to use the project's absolute module
path/alias instead (so the module import for DashboardIntegration and
NotificationType comes from the absolute package name or configured alias for
.aiox-core, e.g. replace the
'../../../.aiox-core/core/orchestration/dashboard-integration' require with the
project's absolute import like
'aiox-core/core/orchestration/dashboard-integration' or the configured alias
'`@aiox-core/core/orchestration/dashboard-integration`') to comply with the
absolute-import guideline.
In `@tests/core/orchestration/execution-profile-resolver.test.js`:
- Around line 8-15: The test file imports execution-profile-resolver with a
relative path; replace that require with an absolute module import of the
package that exports VALID_PROFILES, VALID_CONTEXTS, PROFILE_POLICIES,
normalizeProfile, normalizeContext, and resolveExecutionProfile (keep the same
symbols) so the line requiring
'../../../.aiox-core/core/orchestration/execution-profile-resolver' becomes an
absolute require/import of the package's module name (preserving the exact
exported identifiers) and run the tests to verify resolution.
In `@tests/core/orchestration/executor-assignment.test.js`:
- Around line 8-18: The require call using a relative path for the module that
exports detectStoryType, assignExecutor, assignExecutorFromContent,
validateExecutorAssignment, getStoryTypes, getStoryTypeConfig,
getExecutorWorkTypes, EXECUTOR_ASSIGNMENT_TABLE, and DEFAULT_ASSIGNMENT should
be replaced with an absolute import; update the require(...) to use the absolute
package/module path that exposes the same exports (e.g., the project-level
module name or alias that maps to
.aiox-core/core/orchestration/executor-assignment) so tests import those symbols
via an absolute path instead of '../../../.aiox-core/...'.
In `@tests/core/orchestration/parallel-executor.test.js`:
- Line 14: The test uses a relative require for ParallelExecutor; replace the
relative path
require('../../../.aiox-core/core/orchestration/parallel-executor') with an
absolute import per project guidelines (e.g.,
require('aiox-core/core/orchestration/parallel-executor') or the project's
configured package alias) so the test imports the ParallelExecutor module via
its absolute module name; update the require in
tests/core/orchestration/parallel-executor.test.js where ParallelExecutor is
referenced.
In `@tests/core/orchestration/recovery-handler.test.js`:
- Around line 12-16: Replace the relative require of the recovery-handler module
with an absolute import as per guidelines: update the require that currently
pulls '../../../.aiox-core/core/orchestration/recovery-handler' so the test
imports RecoveryHandler, RecoveryStrategy, and RecoveryResult via the project’s
absolute module path instead of a relative path; locate the line importing these
symbols in tests/core/orchestration/recovery-handler.test.js and change it to
use the repository’s configured absolute import root (keeping the same exported
symbols RecoveryHandler, RecoveryStrategy, RecoveryResult).
In `@tests/core/orchestration/skill-dispatcher.test.js`:
- Line 365: Replace the incorrect "AIOS" prefix in the test fixtures' skill
string literals with "AIOX": find the occurrences of the skill property value
"AIOS:agents:architect" (and the other three similar "AIOS:..." entries) in
tests/core/orchestration/skill-dispatcher.test.js and update them to
"AIOX:agents:architect" so the assertions use the correct AIOX prefix.
---
Nitpick comments:
In `@tests/core/ids/circuit-breaker.test.js`:
- Line 89: Replace the magic number 61000 used to set breaker._lastFailureTime
with a value computed from DEFAULT_RESET_TIMEOUT_MS plus a small delta (e.g.,
DEFAULT_RESET_TIMEOUT_MS + 1000) so the test remains stable if the default
changes; update both occurrences that set breaker._lastFailureTime (line using
breaker._lastFailureTime = Date.now() - 61000 and the second occurrence around
line 229) to compute Date.now() - (DEFAULT_RESET_TIMEOUT_MS + delta) instead,
ensuring DEFAULT_RESET_TIMEOUT_MS is used directly and the delta is declared
clearly in the test.
In `@tests/core/orchestration/agent-invoker.test.js`:
- Line 18: The test currently imports the orchestration module using a relative
require (require('../../../.aiox-core/core/orchestration/agent-invoker')), which
violates the project's absolute-import/alias convention; update the import to
use the repository's absolute alias for the agent-invoker module (e.g.
require('`@aiox-core/core/orchestration/agent-invoker`') or the configured alias
used elsewhere) so the destructured symbols from agent-invoker are loaded via
the canonical path and align with the repo import policy.
🪄 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: e022fa30-f8ee-443a-9b08-8c880dca2c7a
📒 Files selected for processing (14)
tests/core/ids/circuit-breaker.test.jstests/core/orchestration/agent-invoker.test.jstests/core/orchestration/checklist-runner.test.jstests/core/orchestration/cli-commands.test.jstests/core/orchestration/condition-evaluator.test.jstests/core/orchestration/dashboard-integration.test.jstests/core/orchestration/execution-profile-resolver.test.jstests/core/orchestration/executor-assignment.test.jstests/core/orchestration/gate-evaluator.test.jstests/core/orchestration/parallel-executor.test.jstests/core/orchestration/recovery-handler.test.jstests/core/orchestration/skill-dispatcher.test.jstests/core/orchestration/subagent-prompt-builder.test.jstests/core/orchestration/surface-checker.test.js
| DEFAULT_FAILURE_THRESHOLD, | ||
| DEFAULT_SUCCESS_THRESHOLD, | ||
| DEFAULT_RESET_TIMEOUT_MS, | ||
| } = require('../../../.aiox-core/core/ids/circuit-breaker'); |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Use an absolute import path instead of a relative traversal.
Line 16 uses a relative import (../../../...), which violates the repo rule requiring absolute imports for JS/TS-family files. Please switch this to the project’s absolute import form used in this codebase.
As per coding guidelines, "**/*.{js,jsx,ts,tsx}: Use absolute imports instead of relative imports in all code".
🤖 Prompt for 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.
In `@tests/core/ids/circuit-breaker.test.js` at line 16, Replace the relative
require('../../../.aiox-core/core/ids/circuit-breaker') in the test with the
project's absolute import form used elsewhere (i.e., swap the require call that
references '../../../.aiox-core/core/ids/circuit-breaker' for the repo's
absolute module path for the same module); update the require/import in
tests/core/ids/circuit-breaker.test.js so it uses the canonical absolute module
identifier for the circuit-breaker module.
Source: Coding guidelines
| const fs = require('fs-extra'); | ||
| const MasterOrchestrator = require('../../../.aiox-core/core/orchestration/master-orchestrator'); | ||
|
|
||
| const { | ||
| orchestrate, | ||
| orchestrateStatus, | ||
| orchestrateStop, | ||
| orchestrateResume, | ||
| commands, | ||
| } = require('../../../.aiox-core/core/orchestration/cli-commands'); |
There was a problem hiding this comment.
Use absolute imports instead of relative paths.
Both require statements use relative paths ('fs-extra' is fine, but '../../../.aiox-core/...' should be absolute). According to the coding guidelines, all JavaScript files must use absolute imports rather than relative paths.
As per coding guidelines: "Use absolute imports instead of relative imports in all code" for **/*.{js,jsx,ts,tsx}.
🤖 Prompt for 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.
In `@tests/core/orchestration/cli-commands.test.js` around lines 11 - 20, Replace
the relative require imports with absolute module imports: change the require of
'../../../.aiox-core/core/orchestration/master-orchestrator' to the project's
absolute package/module path that exports MasterOrchestrator, and change the
destructured require for orchestrate, orchestrateStatus, orchestrateStop,
orchestrateResume, and commands from
'../../../.aiox-core/core/orchestration/cli-commands' to its absolute import
path; ensure the imported symbols (MasterOrchestrator, orchestrate,
orchestrateStatus, orchestrateStop, orchestrateResume, commands) remain
unchanged so existing tests reference the same identifiers.
Source: Coding guidelines
| * based on detected tech stack profile. | ||
| */ | ||
|
|
||
| const ConditionEvaluator = require('../../../.aiox-core/core/orchestration/condition-evaluator'); |
There was a problem hiding this comment.
Use absolute imports instead of relative paths.
The require statement uses a relative path '../../../.aiox-core/...'. According to the coding guidelines, all JavaScript files should use absolute imports.
As per coding guidelines: "Use absolute imports instead of relative imports in all code" for **/*.{js,jsx,ts,tsx}.
🤖 Prompt for 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.
In `@tests/core/orchestration/condition-evaluator.test.js` at line 8, Replace the
relative require for the ConditionEvaluator module with the repository's
absolute module alias; find the line importing ConditionEvaluator in the test
and change the path to the absolute package import (e.g., the
'`@aiox-core/core/orchestration/condition-evaluator`' style alias used by the
project), making sure it matches the configured module resolution/aliases used
in the codebase and test runtime so the test imports resolve without relative
traversal.
Source: Coding guidelines
| })); | ||
|
|
||
| const fs = require('fs-extra'); | ||
| const { DashboardIntegration, NotificationType } = require('../../../.aiox-core/core/orchestration/dashboard-integration'); |
There was a problem hiding this comment.
Use absolute imports instead of relative paths.
The require statement uses a relative path '../../../.aiox-core/...'. The coding guidelines require absolute imports for all JavaScript files.
As per coding guidelines: "Use absolute imports instead of relative imports in all code" for **/*.{js,jsx,ts,tsx}.
🤖 Prompt for 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.
In `@tests/core/orchestration/dashboard-integration.test.js` at line 21, The test
imports DashboardIntegration and NotificationType using a relative path; update
the require to use the project's absolute module path/alias instead (so the
module import for DashboardIntegration and NotificationType comes from the
absolute package name or configured alias for .aiox-core, e.g. replace the
'../../../.aiox-core/core/orchestration/dashboard-integration' require with the
project's absolute import like
'aiox-core/core/orchestration/dashboard-integration' or the configured alias
'`@aiox-core/core/orchestration/dashboard-integration`') to comply with the
absolute-import guideline.
Source: Coding guidelines
| const { | ||
| VALID_PROFILES, | ||
| VALID_CONTEXTS, | ||
| PROFILE_POLICIES, | ||
| normalizeProfile, | ||
| normalizeContext, | ||
| resolveExecutionProfile, | ||
| } = require('../../../.aiox-core/core/orchestration/execution-profile-resolver'); |
There was a problem hiding this comment.
Use absolute imports instead of relative paths.
The coding guidelines require absolute imports for all JavaScript files. Replace the relative path '../../../.aiox-core/...' with an absolute import.
As per coding guidelines: "Use absolute imports instead of relative imports in all code" for **/*.{js,jsx,ts,tsx}.
🤖 Prompt for 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.
In `@tests/core/orchestration/execution-profile-resolver.test.js` around lines 8 -
15, The test file imports execution-profile-resolver with a relative path;
replace that require with an absolute module import of the package that exports
VALID_PROFILES, VALID_CONTEXTS, PROFILE_POLICIES, normalizeProfile,
normalizeContext, and resolveExecutionProfile (keep the same symbols) so the
line requiring
'../../../.aiox-core/core/orchestration/execution-profile-resolver' becomes an
absolute require/import of the package's module name (preserving the exact
exported identifiers) and run the tests to verify resolution.
Source: Coding guidelines
| const { | ||
| detectStoryType, | ||
| assignExecutor, | ||
| assignExecutorFromContent, | ||
| validateExecutorAssignment, | ||
| getStoryTypes, | ||
| getStoryTypeConfig, | ||
| getExecutorWorkTypes, | ||
| EXECUTOR_ASSIGNMENT_TABLE, | ||
| DEFAULT_ASSIGNMENT, | ||
| } = require('../../../.aiox-core/core/orchestration/executor-assignment'); |
There was a problem hiding this comment.
Use absolute imports instead of relative paths.
The coding guidelines mandate that all JavaScript files use absolute imports rather than relative imports. This require statement uses a relative path '../../../.aiox-core/...' which should be replaced with an absolute import path.
As per coding guidelines: "Use absolute imports instead of relative imports in all code" for **/*.{js,jsx,ts,tsx}.
🤖 Prompt for 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.
In `@tests/core/orchestration/executor-assignment.test.js` around lines 8 - 18,
The require call using a relative path for the module that exports
detectStoryType, assignExecutor, assignExecutorFromContent,
validateExecutorAssignment, getStoryTypes, getStoryTypeConfig,
getExecutorWorkTypes, EXECUTOR_ASSIGNMENT_TABLE, and DEFAULT_ASSIGNMENT should
be replaced with an absolute import; update the require(...) to use the absolute
package/module path that exposes the same exports (e.g., the project-level
module name or alias that maps to
.aiox-core/core/orchestration/executor-assignment) so tests import those symbols
via an absolute path instead of '../../../.aiox-core/...'.
Source: Coding guidelines
| gray: (s) => s, | ||
| })); | ||
|
|
||
| const ParallelExecutor = require('../../../.aiox-core/core/orchestration/parallel-executor'); |
There was a problem hiding this comment.
Use absolute imports instead of relative paths.
The require statement on line 14 uses a relative path. The coding guidelines mandate absolute imports for all JavaScript files.
As per coding guidelines: "Use absolute imports instead of relative imports in all code" for **/*.{js,jsx,ts,tsx}.
🤖 Prompt for 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.
In `@tests/core/orchestration/parallel-executor.test.js` at line 14, The test uses
a relative require for ParallelExecutor; replace the relative path
require('../../../.aiox-core/core/orchestration/parallel-executor') with an
absolute import per project guidelines (e.g.,
require('aiox-core/core/orchestration/parallel-executor') or the project's
configured package alias) so the test imports the ParallelExecutor module via
its absolute module name; update the require in
tests/core/orchestration/parallel-executor.test.js where ParallelExecutor is
referenced.
Source: Coding guidelines
| const { | ||
| RecoveryHandler, | ||
| RecoveryStrategy, | ||
| RecoveryResult, | ||
| } = require('../../../.aiox-core/core/orchestration/recovery-handler'); |
There was a problem hiding this comment.
Use absolute imports instead of relative paths.
The require statement uses a relative path '../../../.aiox-core/...'. Replace with an absolute import as required by the coding guidelines.
As per coding guidelines: "Use absolute imports instead of relative imports in all code" for **/*.{js,jsx,ts,tsx}.
🤖 Prompt for 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.
In `@tests/core/orchestration/recovery-handler.test.js` around lines 12 - 16,
Replace the relative require of the recovery-handler module with an absolute
import as per guidelines: update the require that currently pulls
'../../../.aiox-core/core/orchestration/recovery-handler' so the test imports
RecoveryHandler, RecoveryStrategy, and RecoveryResult via the project’s absolute
module path instead of a relative path; locate the line importing these symbols
in tests/core/orchestration/recovery-handler.test.js and change it to use the
repository’s configured absolute import root (keeping the same exported symbols
RecoveryHandler, RecoveryStrategy, RecoveryResult).
Source: Coding guidelines
|
Addressed the valid CodeRabbit findings in commit
Validation rerun locally:
I intentionally did not convert the relative |
|
Closing: this recovery PR was opened against the upstream org repo by mistake. We are focusing on the personal repository instead. |
Summary
context-manager.test.jsandtech-stack-detector.test.jsversions already present onmaininstead of overwriting them.Validation
npm run lintpassednpm run typecheckpassedorigin/mainFull test note
npm testwas also run, but existing environment-dependent tests failed outside this change:tests/core/terminal-spawner.test.js: missing.aiox-core/scripts/pm.shunder Bash pathtests/packages/aiox-install/integration.test.js: uses|| true, which fails under Windowscmdpackages/installer/tests/unit/pro-setup-machine-id.test.js: Windows MachineGuid lookup failed in this environmentSummary by CodeRabbit