Skip to content

refactor ai and sync engine - #123

Merged
pramodnarayana merged 5 commits into
developmentfrom
refactor/arch-engine-domains
Apr 9, 2026
Merged

pramodnarayana merged 5 commits into
developmentfrom
refactor/arch-engine-domains

Conversation

@pramodnarayana

@pramodnarayana pramodnarayana commented Apr 9, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Refactor

    • Platform reorganized: piece registry and metadata moved into a dedicated package and AI orchestration split into a separate engine module.
  • Chores

    • Added workspace dependencies for the new AI engine and piece-registry packages.
  • Documentation

    • Updated infrastructure package path references.
  • Note

    • Metadata-related API endpoints for describing objects/fields/related/config were removed.

@coderabbitai

coderabbitai Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: fd95bb7b-9068-4a95-9e48-1ad208ccc138

📥 Commits

Reviewing files that changed from the base of the PR and between af22132 and 6506631.

📒 Files selected for processing (3)
  • apps/api/src/modules/stitches/stitches.module.ts
  • engine/ai/core/src/services/orchestrator.service.spec.ts
  • engine/ai/core/src/services/orchestrator.service.ts

📝 Walkthrough

Walkthrough

Extracted piece registry and metadata into a new package (@nexiom/piece-registry), introduced an AI engine package (@nexiom/ai-engine), repointed many API/worker imports to these packages, removed the API-local metadata controller/module/tests, adjusted TypeScript/workspace paths, and renamed the infra package.

Changes

Cohort / File(s) Summary
Workspace Manifests & Workspace
apps/api/package.json, apps/worker/package.json, engine/ai/core/package.json, packages/pieces/registry/package.json, pnpm-workspace.yaml
Added workspace dependencies (@nexiom/ai-engine, @nexiom/piece-registry), new package manifests for AI and piece-registry, and updated workspace globs.
Piece Registry Package
packages/pieces/registry/src/index.ts, packages/pieces/registry/src/metadata/*, packages/pieces/registry/tsconfig.json, packages/pieces/registry/package.json
New package providing PiecesModule, PieceRegistryService, loader and metadata discovery/module; consolidated root exports and TS config added.
AI Engine Package
engine/ai/core/src/ai-engine.module.ts, engine/ai/core/src/index.ts, engine/ai/core/src/services/orchestrator.service.ts, engine/ai/core/tsconfig.json, engine/ai/core/vitest.config.ts, engine/ai/core/package.json
Added AiEngineModule, OrchestratorService, refined Zod input schemas and tool execution shapes, re-exported AI package entrypoints, and added build/test configs.
API & Worker Module Imports
apps/api/src/app/app.module.ts, apps/api/src/modules/.../*, apps/worker/src/app.module.ts, apps/worker/src/modules/pipeline/*
Repointed imports: PiecesModule, PieceRegistryService, and MetadataModule to @nexiom/piece-registry; AiModule now imports AiEngineModule and consumes OrchestratorService from @nexiom/ai-engine.
Metadata Removal in API
apps/api/src/modules/metadata/metadata.controller.ts, apps/api/src/modules/metadata/metadata.module.ts, apps/api/src/modules/metadata/metadata.controller.spec.ts
Removed the API-local MetadataController, its module, and associated unit tests; metadata responsibilities moved into the piece-registry package.
Updated Tests & Specs
multiple *.spec.ts under apps/api, apps/worker, engine/ai/core/src/services/*, packages/pieces/registry/.../*.spec.ts
Adjusted test imports/provider tokens to reference @nexiom/piece-registry or new local package paths; test logic largely unchanged.
Engine Exports & TS Configs
engine/sync/platform/core/src/index.ts, various tsconfig.json files, packages/credentials/tsconfig.json, packages/infra/package.json
Removed some re-exports from platform core index, updated extends/reference paths in tsconfigs, and renamed package scope @nexiom/infra-adapters → @nexiom/infra.
Documentation
docs/architecture/*
Updated docs to reference packages/infra/ path instead of packages/infra-adapters/ and adjusted snippets.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant API as API App
participant Ai as AiEngine (OrchestratorService)
participant Registry as PieceRegistry
participant Pieces as PiecesModule
API->>Ai: forward chat/request
Ai->>Registry: resolve piece & metadata
Registry-->>Ai: piece/metadata
Ai->>Pieces: execute action/run
Pieces-->>Ai: execution result
Ai-->>API: return response

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 I hopped through code and nudged each little thread,
Placed pieces, metadata, and AI in tidy beds.
New packages nested in the monorepo burrow,
Imports aligned, controllers trimmed—soft paths to follow.
Carrot crumbs of tests remain; the rabbit gives a cheer! 🍃✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'refactor ai and sync engine' is vague and overly broad, describing only general domain areas without capturing the primary architectural change of splitting shared engine components into dedicated packages (@nexiom/ai-engine and @nexiom/piece-registry). Consider a more specific title that highlights the main refactoring goal, such as 'Extract piece registry and AI engine into dedicated packages' or 'Reorganize engine architecture with separate piece-registry and ai-engine modules'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/arch-engine-domains

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/architecture/master/tasks.md (1)

35-44: ⚠️ Potential issue | 🟡 Minor

Document still has stale package name references elsewhere.

Good update at Line 35 and Line 44, but this file still lists infra-adapters later (Line 790), which conflicts with the new packages/infra naming. Please align that stale reference in the same doc.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/architecture/master/tasks.md` around lines 35 - 44, The document
contains stale package name references: replace any occurrences of the old
"infra-adapters" name with the new "packages/infra" naming to keep the doc
consistent (search for "infra-adapters" around the later sections, e.g., where
adapters/files are listed) and update related mentions such as folder listings
and package names in the section that currently references "infra-adapters" so
they match the entries like `packages/infra/src/encryption/**`,
`packages/infra/src/index.ts`, and `packages/infra/package.json`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/api/src/modules/stitches/stitches.module.ts`:
- Around line 6-12: Combine the two separate imports from the same package into
a single import statement: replace the individual imports of PiecesModule and
MetadataModule from "@nexiom/piece-registry" with one consolidated import that
includes both symbols (PiecesModule, MetadataModule); ensure other imports
(ConnectionsModule, StitchesController, StitchesAdminController,
FieldMappingsController, StitchesService) remain unchanged and that any module
references in the file still match the consolidated names.

In `@docs/architecture/master/implementation-plan.md`:
- Line 738: Update the architecture doc entry for packages/infra to remove or
clarify the "SQS client factory" responsibility: edit the table row listing
`packages/infra` so it only mentions `LocalCryptoAdapter` and `AwsKmsAdapter`
(or add a parenthetical note that SQS client creation lives in
`packages/queue`), ensuring the phrase "SQS client factory" is deleted or
replaced to reflect that queue responsibilities are owned by `packages/queue`;
verify references to `LocalCryptoAdapter` and `AwsKmsAdapter` remain unchanged.

In `@docs/architecture/sync_strategy/sync_strategy.md`:
- Line 441: The doc has inconsistent package naming: the Platform row uses
`packages/infra` while the directory layout still lists
`packages/infra-adapters`; pick one canonical package name (prefer the new
`packages/infra`) and update all occurrences to match. Edit the table row that
currently shows `engine/platform/core/ + packages/infra + packages/cache` and
the directory layout entry that references `packages/infra-adapters/` so both
use the same package identifier (`packages/infra`), and ensure any descriptive
text mentioning infra adapters is adjusted to the chosen name (search for
`packages/infra-adapters` and `packages/infra` and normalize).

In `@engine/ai/core/package.json`:
- Around line 28-31: Update the zod dependency in package.json: replace the
current "zod": "^3.24.1" entry with a supported version (e.g., "zod": "^3.25.76"
or bump to "^4.1.8") so it satisfies the peer range expected by the ai package;
run your lockfile update (npm/yarn/pnpm) afterwards to ensure the new version is
installed and type checks pick up the stricter Zod typings.

In `@engine/ai/core/src/services/orchestrator.service.ts`:
- Around line 204-206: The tool definitions currently use unsafe `as any` casts
for inputSchema and handler args; extract each tool's z.object(...) schema into
a named constant (e.g., hydratorInputSchema, actionExecutorInputSchema), set the
tool's inputSchema to that constant (no cast), and change the handler signature
to use z.infer<typeof thatSchema> for args (for example: execute: async (args:
z.infer<typeof hydratorInputSchema>) => { ... }) so the handler has a statically
typed contract; update both occurrences referenced (the hydrator tool and the
action executor tool) and remove the `as any` casts on inputSchema and args.

---

Outside diff comments:
In `@docs/architecture/master/tasks.md`:
- Around line 35-44: The document contains stale package name references:
replace any occurrences of the old "infra-adapters" name with the new
"packages/infra" naming to keep the doc consistent (search for "infra-adapters"
around the later sections, e.g., where adapters/files are listed) and update
related mentions such as folder listings and package names in the section that
currently references "infra-adapters" so they match the entries like
`packages/infra/src/encryption/**`, `packages/infra/src/index.ts`, and
`packages/infra/package.json`.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 739690a0-6c74-4ff9-a365-f4e0daa54cd1

📥 Commits

Reviewing files that changed from the base of the PR and between 7c8ed6e and c50a0a9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (110)
  • apps/api/package.json
  • apps/api/src/app/app.module.ts
  • apps/api/src/modules/ai/ai.module.ts
  • apps/api/src/modules/ai/controllers/ai.controller.spec.ts
  • apps/api/src/modules/ai/controllers/ai.controller.ts
  • apps/api/src/modules/ai/interceptors/ai-ratelimit.guard.ts
  • apps/api/src/modules/ai/interceptors/ai-telemetry.interceptor.ts
  • apps/api/src/modules/connections/connections.module.ts
  • apps/api/src/modules/connections/connections/callback.controller.spec.ts
  • apps/api/src/modules/connections/connections/callback.controller.ts
  • apps/api/src/modules/connections/connections/connectors.controller.spec.ts
  • apps/api/src/modules/connections/connections/connectors.controller.ts
  • apps/api/src/modules/connections/connections/token-refresh.service.spec.ts
  • apps/api/src/modules/connections/connections/token-refresh.service.ts
  • apps/api/src/modules/connections/connectors.service.spec.ts
  • apps/api/src/modules/connections/connectors.service.ts
  • apps/api/src/modules/metadata/metadata.controller.spec.ts
  • apps/api/src/modules/metadata/metadata.controller.ts
  • apps/api/src/modules/metadata/metadata.module.ts
  • apps/api/src/modules/scheduler/poll-sync-runner.spec.ts
  • apps/api/src/modules/scheduler/poll-sync-runner.ts
  • apps/api/src/modules/scheduler/scheduler.module.ts
  • apps/api/src/modules/stitches/stitches.module.ts
  • apps/api/src/modules/trigger/dlq-processor.service.spec.ts
  • apps/api/src/modules/trigger/dlq-processor.service.ts
  • apps/api/src/modules/trigger/poller.service.spec.ts
  • apps/api/src/modules/trigger/poller.service.ts
  • apps/api/src/modules/trigger/trigger.module.ts
  • apps/api/src/modules/trigger/webhooks.controller.spec.ts
  • apps/api/src/modules/trigger/webhooks.controller.ts
  • apps/api/src/modules/webhooks/webhook-signature.guard.spec.ts
  • apps/api/src/modules/webhooks/webhook-signature.guard.ts
  • apps/api/src/modules/webhooks/webhooks.module.ts
  • apps/worker/package.json
  • apps/worker/src/app.module.ts
  • apps/worker/src/modules/pipeline/delivery.service.spec.ts
  • apps/worker/src/modules/pipeline/delivery.service.ts
  • apps/worker/src/modules/pipeline/normalization.service.spec.ts
  • apps/worker/src/modules/pipeline/normalization.service.ts
  • apps/worker/src/modules/pipeline/pipeline.module.ts
  • docs/architecture/master/implementation-plan.md
  • docs/architecture/master/tasks.md
  • docs/architecture/sync_strategy/sync_strategy.md
  • engine/ai/core/package.json
  • engine/ai/core/src/ai-engine.module.ts
  • engine/ai/core/src/constants/prompts.ts
  • engine/ai/core/src/index.ts
  • engine/ai/core/src/services/orchestrator.service.spec.ts
  • engine/ai/core/src/services/orchestrator.service.ts
  • engine/ai/core/src/types/chat-request.types.ts
  • engine/ai/core/tsconfig.json
  • engine/ai/core/vitest.config.ts
  • engine/sync/application/README.md
  • engine/sync/application/mapping/package.json
  • engine/sync/application/mapping/src/config-applicator.ts
  • engine/sync/application/mapping/src/index.ts
  • engine/sync/application/mapping/src/jsonata-extensions.ts
  • engine/sync/application/mapping/src/mapping-engine.spec.ts
  • engine/sync/application/mapping/src/mapping-engine.ts
  • engine/sync/application/mapping/src/mapping.types.ts
  • engine/sync/application/mapping/tsconfig.json
  • engine/sync/application/mapping/vitest.config.ts
  • engine/sync/platform/README.md
  • engine/sync/platform/core/package.json
  • engine/sync/platform/core/src/evaluator.ts
  • engine/sync/platform/core/src/hydrator.ts
  • engine/sync/platform/core/src/index.ts
  • engine/sync/platform/core/src/state/cursor-manager.service.spec.ts
  • engine/sync/platform/core/src/state/cursor-manager.service.ts
  • engine/sync/platform/core/src/state/cursor-manager.types.ts
  • engine/sync/platform/core/src/storage-resolver/storage-resolver.module.ts
  • engine/sync/platform/core/src/storage-resolver/storage-resolver.service.spec.ts
  • engine/sync/platform/core/src/storage-resolver/storage-resolver.service.ts
  • engine/sync/platform/core/tsconfig.json
  • engine/sync/platform/core/vitest.config.ts
  • packages/credentials/package.json
  • packages/credentials/src/crypto/encryption.interface.ts
  • packages/credentials/src/crypto/encryption.service.spec.ts
  • packages/credentials/src/crypto/encryption.service.ts
  • packages/credentials/src/http-client/host-http-client.spec.ts
  • packages/credentials/src/http-client/host-http-client.ts
  • packages/credentials/src/index.ts
  • packages/credentials/src/oauth/token-manager.service.ts
  • packages/credentials/tsconfig.json
  • packages/credentials/tsconfig.spec.json
  • packages/credentials/vitest.config.ts
  • packages/infra/eslint.config.mjs
  • packages/infra/package.json
  • packages/infra/src/adapters/aws-kms.adapter.ts
  • packages/infra/src/adapters/local-crypto.adapter.ts
  • packages/infra/src/aws-kms.adapter.spec.ts
  • packages/infra/src/constants.ts
  • packages/infra/src/encryption.module.spec.ts
  • packages/infra/src/encryption.module.ts
  • packages/infra/src/index.ts
  • packages/infra/src/interfaces/encryption-service.interface.ts
  • packages/infra/src/local-crypto.adapter.spec.ts
  • packages/infra/tsconfig.json
  • packages/infra/vitest.config.ts
  • packages/pieces/registry/package.json
  • packages/pieces/registry/src/index.ts
  • packages/pieces/registry/src/metadata/metadata-discovery.service.spec.ts
  • packages/pieces/registry/src/metadata/metadata-discovery.service.ts
  • packages/pieces/registry/src/metadata/metadata.module.ts
  • packages/pieces/registry/src/pieces/piece-loader.service.ts
  • packages/pieces/registry/src/pieces/piece-registry.service.spec.ts
  • packages/pieces/registry/src/pieces/piece-registry.service.ts
  • packages/pieces/registry/src/pieces/pieces.module.ts
  • packages/pieces/registry/tsconfig.json
  • pnpm-workspace.yaml
💤 Files with no reviewable changes (3)
  • apps/api/src/modules/metadata/metadata.module.ts
  • apps/api/src/modules/metadata/metadata.controller.spec.ts
  • apps/api/src/modules/metadata/metadata.controller.ts

Comment thread apps/api/src/modules/stitches/stitches.module.ts Outdated
Comment thread docs/architecture/master/implementation-plan.md Outdated
| Concern | Code | Responsibility |
| :--- | :--- | :--- |
| **Platform** | `engine/platform/core/` + `packages/infra-adapters` + `packages/cache` | Manages AWS KMS decryption of tenant credentials, acquires the Redis Distributed Refresh Lock, hosts the Activepieces runtime environment that runs piece actions |
| **Platform** | `engine/platform/core/` + `packages/infra` + `packages/cache` | Manages AWS KMS decryption of tenant credentials, acquires the Redis Distributed Refresh Lock, hosts the Activepieces runtime environment that runs piece actions |

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.

⚠️ Potential issue | 🟡 Minor

This rename is correct, but the same file still has an old path reference.

Line 441 now uses packages/infra, but the directory layout section still lists packages/infra-adapters/ (Line 66). Please normalize both sections to one package name.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/architecture/sync_strategy/sync_strategy.md` at line 441, The doc has
inconsistent package naming: the Platform row uses `packages/infra` while the
directory layout still lists `packages/infra-adapters`; pick one canonical
package name (prefer the new `packages/infra`) and update all occurrences to
match. Edit the table row that currently shows `engine/platform/core/ +
packages/infra + packages/cache` and the directory layout entry that references
`packages/infra-adapters/` so both use the same package identifier
(`packages/infra`), and ensure any descriptive text mentioning infra adapters is
adjusted to the chosen name (search for `packages/infra-adapters` and
`packages/infra` and normalize).

Comment thread engine/ai/core/package.json
Comment thread engine/ai/core/src/services/orchestrator.service.ts Outdated
@coderabbitai

coderabbitai Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 6 file(s) based on 5 unresolved review comments.

Files modified:

  • apps/api/src/modules/stitches/stitches.module.ts
  • docs/architecture/master/implementation-plan.md
  • docs/architecture/sync_strategy/sync_strategy.md
  • engine/ai/core/package.json
  • engine/ai/core/src/services/orchestrator.service.ts
  • pnpm-lock.yaml

Commit: b1b67189e275c240a99318344b192a21142dd413

The changes have been pushed to the refactor/arch-engine-domains branch.

Time taken: 7m 17s

Fixed 6 file(s) based on 5 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/api/src/modules/stitches/stitches.module.ts (1)

14-21: 🧹 Nitpick | 🔵 Trivial

Optional: Consider removing redundant PiecesModule import.

Since PiecesModule is registered as global in the app module (via PiecesModule.forRoot({ anchorUrl: import.meta.url })), explicitly importing it here on line 18 is redundant. Global modules in NestJS are automatically available to all modules without explicit imports.

However, this redundancy pre-existed the refactor and maintaining it doesn't cause any functional issues. Consider removing it in a future cleanup PR to simplify the module dependencies.

♻️ Optional refactor to remove redundant import
 `@Module`({
   imports: [
     DbModule,
     AuthModule,
     CacheModule,
-    PiecesModule,
     ConnectionsModule,
     MetadataModule,
   ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/api/src/modules/stitches/stitches.module.ts` around lines 14 - 21, The
PiecesModule import is redundant because it's registered global; remove its
explicit reference from the imports array in the StitchesModule (delete the
PiecesModule entry from the imports: [...] list) and also remove any
corresponding unused top-level import statement for PiecesModule to keep the
file clean (look for the PiecesModule identifier in this module file and remove
both the array entry and the import declaration).
engine/ai/core/src/services/orchestrator.service.ts (1)

482-498: ⚠️ Potential issue | 🟠 Major

Do not forward confirmed into connector action props.

At Line 497, propsValue receives the full args, which includes orchestration-only confirmed. That can break strict action prop validation or create unintended behavior downstream.

♻️ Proposed fix
-          const argsWithConfirm = args as Record<string, unknown> & {
+          const argsWithConfirm = args as Record<string, unknown> & {
             confirmed?: boolean;
           };
           if (argsWithConfirm.confirmed !== true) {
             return {
               success: false,
               error:
                 'Action requires explicit user confirmation. Please set confirmed=true to proceed.',
               connectionName: `connection-${conn.id}`,
             };
           }

           try {
+            const { confirmed: _confirmed, ...propsValue } = argsWithConfirm;
             const result = (await action.run({
               auth: creds,
-              propsValue: args as Record<string, unknown>,
+              propsValue,
             })) as unknown;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@engine/ai/core/src/services/orchestrator.service.ts` around lines 482 - 498,
The call to action.run forwards orchestration-only flag confirmed inside
propsValue (args), which can break action prop validation; in the orchestrator
where argsWithConfirm is defined, strip out confirmed before calling action.run
(e.g., extract confirmed via const { confirmed, ...props } = argsWithConfirm)
and pass props (not the original args) as propsValue to action.run; update any
typing to keep propsValue as Record<string, unknown> so the action receives only
its intended properties.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/architecture/master/implementation-plan.md`:
- Line 811: The file currently ends immediately after the line "Then open
`http://localhost:3000` → Route Intelligence → see the L1→L6 green trace."
without a trailing newline; add a single newline character at the end of the
file (after the closing backticks) so the document ends with one trailing
newline to satisfy MD047 and standard POSIX/markdown newline expectations.

In `@docs/architecture/sync_strategy/sync_strategy.md`:
- Line 466: The file ends without a trailing newline causing MD047; add a single
newline character at EOF so the last table row ("L6 | Destination Gateway |
`outbound_gateway` log, GEM update | — (standardised) |") is followed by one
newline (i.e., ensure the file ends with "\n") to satisfy markdown compliance.

In `@engine/ai/core/src/services/orchestrator.service.ts`:
- Around line 199-207: The execute handler created in dynamicTool currently
forwards the entire args (z.infer<typeof hydratorInputSchema>) including the
orchestration-only confirmed field to action.run; remove confirmed before
calling action.run by destructuring or copying args and deleting or omitting the
confirmed property, then call action.run({ propsValue: sanitizedArgs }) so
confirmed never reaches the action layer (update the execute implementation
around the dynamicTool -> execute -> action.run call).

---

Outside diff comments:
In `@apps/api/src/modules/stitches/stitches.module.ts`:
- Around line 14-21: The PiecesModule import is redundant because it's
registered global; remove its explicit reference from the imports array in the
StitchesModule (delete the PiecesModule entry from the imports: [...] list) and
also remove any corresponding unused top-level import statement for PiecesModule
to keep the file clean (look for the PiecesModule identifier in this module file
and remove both the array entry and the import declaration).

In `@engine/ai/core/src/services/orchestrator.service.ts`:
- Around line 482-498: The call to action.run forwards orchestration-only flag
confirmed inside propsValue (args), which can break action prop validation; in
the orchestrator where argsWithConfirm is defined, strip out confirmed before
calling action.run (e.g., extract confirmed via const { confirmed, ...props } =
argsWithConfirm) and pass props (not the original args) as propsValue to
action.run; update any typing to keep propsValue as Record<string, unknown> so
the action receives only its intended properties.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0421e143-a6fa-4d53-ae7f-9d710fe07adb

📥 Commits

Reviewing files that changed from the base of the PR and between c50a0a9 and b1b6718.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • apps/api/src/modules/stitches/stitches.module.ts
  • docs/architecture/master/implementation-plan.md
  • docs/architecture/sync_strategy/sync_strategy.md
  • engine/ai/core/package.json
  • engine/ai/core/src/services/orchestrator.service.ts

```

Then open `http://localhost:3000` → Route Intelligence → see the L1→L6 green trace.
Then open `http://localhost:3000` → Route Intelligence → see the L1→L6 green trace. No newline at end of file

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.

⚠️ Potential issue | 🟡 Minor

Add trailing newline for markdown compliance.

The file should end with a single newline character to comply with markdown formatting standards (MD047).

📝 Proposed fix

Add a newline after the closing backticks on line 811:

 Then open `http://localhost:3000` → Route Intelligence → see the L1→L6 green trace.
+
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 811-811: Files should end with a single newline character

(MD047, single-trailing-newline)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/architecture/master/implementation-plan.md` at line 811, The file
currently ends immediately after the line "Then open `http://localhost:3000` →
Route Intelligence → see the L1→L6 green trace." without a trailing newline; add
a single newline character at the end of the file (after the closing backticks)
so the document ends with one trailing newline to satisfy MD047 and standard
POSIX/markdown newline expectations.

| L4 | Outbound Prep | Fat JSON assembly, Sync Condition evaluation | MappingEngine (80%) + Git Shard VM (20%) |
| L5 | Delivery Engine | KMS decrypt, Redis lock, Activepieces runtime | `run()` → HTTP request to destination API |
| L6 | Destination Gateway | `outbound_gateway` log, GEM update | — (standardised) |
| L6 | Destination Gateway | `outbound_gateway` log, GEM update | — (standardised) | No newline at end of file

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.

⚠️ Potential issue | 🟡 Minor

Add trailing newline for markdown compliance.

The file should end with a single newline character to comply with markdown formatting standards (MD047).

📝 Proposed fix

Add a newline after the last row of the table on line 466:

 | L6 | Destination Gateway | `outbound_gateway` log, GEM update | — (standardised) |
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| L6 | Destination Gateway | `outbound_gateway` log, GEM update | — (standardised) |
| L6 | Destination Gateway | `outbound_gateway` log, GEM update | — (standardised) |
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 466-466: Files should end with a single newline character

(MD047, single-trailing-newline)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/architecture/sync_strategy/sync_strategy.md` at line 466, The file ends
without a trailing newline causing MD047; add a single newline character at EOF
so the last table row ("L6 | Destination Gateway | `outbound_gateway` log, GEM
update | — (standardised) |") is followed by one newline (i.e., ensure the file
ends with "\n") to satisfy markdown compliance.

Comment thread engine/ai/core/src/services/orchestrator.service.ts Outdated
@coderabbitai

coderabbitai Bot commented Apr 9, 2026 •

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 3 file(s) based on 3 unresolved review comments.

Files modified:

  • docs/architecture/master/implementation-plan.md
  • docs/architecture/sync_strategy/sync_strategy.md
  • engine/ai/core/src/services/orchestrator.service.ts

Commit: af2213200d374faae11724eb5465c7af4b5adf7c

The changes have been pushed to the refactor/arch-engine-domains branch.

Time taken: 4m 16s

Fixed 3 file(s) based on 3 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@engine/ai/core/src/services/orchestrator.service.ts`:
- Around line 495-497: The destructuring that strips the orchestration-only
confirmed field should mark the discarded variable as intentionally unused to
satisfy linters: change the destructuring in orchestrator.service.ts from const
{ confirmed, ...sanitizedArgs } = argsWithConfirm; to use a prefixed discard
like const { confirmed: _confirmed, ...sanitizedArgs } = argsWithConfirm; so the
confirmed value is removed but ESLint no-unused-vars is avoided while keeping
sanitizedArgs for action.run().
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 998da0d2-abe8-419a-9d68-58267d126eac

📥 Commits

Reviewing files that changed from the base of the PR and between b1b6718 and af22132.

📒 Files selected for processing (1)
  • engine/ai/core/src/services/orchestrator.service.ts

Comment thread engine/ai/core/src/services/orchestrator.service.ts
@pramodnarayana
pramodnarayana merged commit 2026329 into development Apr 9, 2026
2 checks passed
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