Repository navigation
refactor(runtime): source the VFS transport from @relayfile/adapter-core - #179
Conversation
Completes moving integration handling out of workforce. The VFS draft-write
transport (writeJsonFile/readJsonFile/draftFile/resolveMountRoot/…) now lives in
@relayfile/adapter-core/vfs-client (the generic Relayfile write protocol, not
anything workforce-specific). runtime/clients re-exports it so the single
source of truth is the relayfile layer and there's no duplicated transport.
- Deleted packages/runtime/src/clients/request.ts (the local copy).
- clients/index.ts re-exports the transport + RelayfileWritebackError from
@relayfile/adapter-core/vfs-client.
- errors.ts keeps `WorkforceIntegrationError` as an ALIAS of the relocated
`RelayfileWritebackError` (same class, not a subclass) so handlers that
`catch (e) { e instanceof WorkforceIntegrationError }` still match what the
transport throws. Verified: alias identity holds + instanceof works.
- Added @relayfile/adapter-core@^0.3.29 as a direct runtime dep (it has the
/vfs-client subpath; persona-kit only used /triggers + /scope-keys).
Existing agents importing @agentworkforce/runtime/clients are unchanged. The
ergonomic per-provider clients live in @relayfile/relay-helpers. runtime 57/57;
deploy/mcp-workforce/cli typecheck clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
CodeAnt AI is reviewing your PR. |
|
Warning Review limit reached
More reviews will be available in 42 minutes and 35 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
✨ 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.
Code Review
This pull request refactors the runtime by offloading the VFS-backed transport layer and its associated error classes to the external @relayfile/adapter-core package, while maintaining backward compatibility through re-exports and class aliasing. The review feedback suggests declaring @relayfile/sdk as a peer dependency to avoid installation warnings, and recommends exporting the error option types (RelayfileWritebackErrorOptions and WorkforceIntegrationErrorOptions) across the public API entry points to ensure completeness.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| "@agent-assistant/proactive": "^0.4.32", | ||
| "@agentworkforce/persona-kit": "workspace:*" | ||
| "@agentworkforce/persona-kit": "workspace:*", | ||
| "@relayfile/adapter-core": "^0.3.29" |
There was a problem hiding this comment.
Since @relayfile/adapter-core has a peer dependency on @relayfile/sdk (>=0.6.0 <1), consumers of @agentworkforce/runtime may encounter peer dependency resolution warnings during installation if @relayfile/sdk is not explicitly declared.
Consider adding @relayfile/sdk to the peerDependencies of @agentworkforce/runtime to ensure clean installations:
"peerDependencies": {
"@relayfile/sdk": ">=0.6.0 <1"
}There was a problem hiding this comment.
Declining this one: @relayfile/adapter-core/vfs-client (the only subpath the runtime imports) doesn't import @relayfile/sdk at all, @relayfile/sdk isn't resolvable in the workforce tree, and the sibling consumer @agentworkforce/persona-kit (which also depends on adapter-core) doesn't declare it either — yet everything builds and tests green. Adding it as a peer would impose an unused, uninstalled dependency on every runtime consumer and diverge from the repo's existing convention. The unmet peer is adapter-core's to resolve (ideally peerDependenciesMeta.optional there) rather than something each consumer re-declares.
| readTextFile, | ||
| resolveMountRoot, | ||
| writeJsonFile, | ||
| RelayfileWritebackError, |
There was a problem hiding this comment.
To ensure the public API is complete and fully backward-compatible, consider exporting RelayfileWritebackErrorOptions from @relayfile/adapter-core/vfs-client as well. This allows consumers to properly type-annotate error options when working with RelayfileWritebackError.
| RelayfileWritebackError, | |
| RelayfileWritebackError, | |
| type RelayfileWritebackErrorOptions, |
| } from '@relayfile/adapter-core/vfs-client'; | ||
|
|
||
| export { WorkforceIntegrationError, SandboxNotAvailableError } from '../errors.js'; No newline at end of file | ||
| export { WorkforceIntegrationError, SandboxNotAvailableError } from '../errors.js'; |
There was a problem hiding this comment.
Consider exporting WorkforceIntegrationErrorOptions from ../errors.js to maintain completeness of the public API for consumers who need to type-annotate or handle error options.
| export { WorkforceIntegrationError, SandboxNotAvailableError } from '../errors.js'; | |
| export { | |
| WorkforceIntegrationError, | |
| type WorkforceIntegrationErrorOptions, | |
| SandboxNotAvailableError | |
| } from '../errors.js'; |
| type IntegrationClientOptions, | ||
| type WritebackReceipt, | ||
| type WritebackResult, | ||
| RelayfileWritebackError, |
There was a problem hiding this comment.
To expose the error option types in the main entry point of the package, consider re-exporting RelayfileWritebackErrorOptions and WorkforceIntegrationErrorOptions here as well.
| RelayfileWritebackError, | |
| RelayfileWritebackError, | |
| type RelayfileWritebackErrorOptions, | |
| type WorkforceIntegrationErrorOptions, |
|
CodeAnt AI finished reviewing your PR. |
gemini review: export RelayfileWritebackErrorOptions + WorkforceIntegrationErrorOptions from /clients and the main entry so consumers can type-annotate error options. (Declined the suggested @relayfile/sdk peer dep — vfs-client doesn't import sdk, persona-kit doesn't declare it, and it isn't in the tree; adding it would impose an unused dep.) runtime 57/57, typecheck clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
2 issues found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/runtime/src/errors.ts">
<violation number="1" location="packages/runtime/src/errors.ts:12">
P2: Aliasing `WorkforceIntegrationError` to `RelayfileWritebackError` changes the emitted error `name`, which can break existing `err.name`-based handlers.</violation>
</file>
<file name="packages/runtime/package.json">
<violation number="1" location="packages/runtime/package.json:54">
P2: Adding `@relayfile/adapter-core` introduces a transitive peer requirement on `@relayfile/sdk`; declare that peer at this package boundary so consumers get an explicit install contract and avoid unmet-peer warnings.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| } | ||
| export { | ||
| RelayfileWritebackError, | ||
| RelayfileWritebackError as WorkforceIntegrationError, |
There was a problem hiding this comment.
P2: Aliasing WorkforceIntegrationError to RelayfileWritebackError changes the emitted error name, which can break existing err.name-based handlers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/runtime/src/errors.ts, line 12:
<comment>Aliasing `WorkforceIntegrationError` to `RelayfileWritebackError` changes the emitted error `name`, which can break existing `err.name`-based handlers.</comment>
<file context>
@@ -1,44 +1,18 @@
-}
+export {
+ RelayfileWritebackError,
+ RelayfileWritebackError as WorkforceIntegrationError,
+ type RelayfileWritebackErrorOptions,
+ type RelayfileWritebackErrorOptions as WorkforceIntegrationErrorOptions
</file context>
There was a problem hiding this comment.
Intentional, declining. The alias keeps WorkforceIntegrationError as the same class as RelayfileWritebackError, which is what preserves the critical back-compat: a transport error stays instanceof WorkforceIntegrationError (a subclass would break that, since the relocated transport throws the base). The trade-off is err.name now reads RelayfileWritebackError — which is accurate, and nothing in workforce or the agents keys on that string (grepped; all use instanceof). The provider/operation/retryable/message fields are unchanged.
There was a problem hiding this comment.
Thanks for the feedback! I've saved this as a new learning to improve future reviews.
| "@relayfile/adapter-core": "^0.3.29" | ||
| } | ||
| } |
There was a problem hiding this comment.
P2: Adding @relayfile/adapter-core introduces a transitive peer requirement on @relayfile/sdk; declare that peer at this package boundary so consumers get an explicit install contract and avoid unmet-peer warnings.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/runtime/package.json, line 54:
<comment>Adding `@relayfile/adapter-core` introduces a transitive peer requirement on `@relayfile/sdk`; declare that peer at this package boundary so consumers get an explicit install contract and avoid unmet-peer warnings.</comment>
<file context>
@@ -50,6 +50,7 @@
"@agent-assistant/proactive": "^0.4.32",
- "@agentworkforce/persona-kit": "workspace:*"
+ "@agentworkforce/persona-kit": "workspace:*",
+ "@relayfile/adapter-core": "^0.3.29"
}
}
</file context>
| "@relayfile/adapter-core": "^0.3.29" | |
| } | |
| } | |
| "@relayfile/adapter-core": "^0.3.29" | |
| }, | |
| "peerDependencies": { | |
| "@relayfile/sdk": ">=0.6.0 <1" | |
| } | |
| } |
There was a problem hiding this comment.
Same as the gemini thread above — declining. @relayfile/adapter-core/vfs-client (the only subpath the runtime imports) does not import @relayfile/sdk, the sibling consumer @agentworkforce/persona-kit (which also deps adapter-core) doesn't declare it, and @relayfile/sdk isn't even resolvable in the tree — yet build/tests are green. Declaring it here imposes an unused, uninstalled dependency on every runtime consumer. The unmet peer is adapter-core's to fix (ideally peerDependenciesMeta.optional).
There was a problem hiding this comment.
Thanks for the feedback! I've saved this as a new learning to improve future reviews.
User description
Completes the move of integration handling out of workforce (started in relayfile-adapters#141, now published as
@relayfile/adapter-core@0.3.29+@relayfile/relay-helpers@0.3.29).What
The VFS draft-write transport (
writeJsonFile/readJsonFile/listJsonFiles/draftFile/resolveMountRoot/…) is the generic Relayfile write protocol — not workforce-specific. It now lives in@relayfile/adapter-core/vfs-client, and@agentworkforce/runtime/clientsre-exports it, so there's a single source of truth and no duplicated transport.packages/runtime/src/clients/request.ts(the local copy).clients/index.tsre-exports the transport +RelayfileWritebackErrorfrom@relayfile/adapter-core/vfs-client.errors.tskeepsWorkforceIntegrationErroras an alias of the relocatedRelayfileWritebackError(same class, not a subclass) so existing handlers thatcatch (e) { if (e instanceof WorkforceIntegrationError) … }still match what the transport throws.@relayfile/adapter-core@^0.3.29as a direct runtime dep (it carries/vfs-client; persona-kit only pulled/triggers+/scope-keys).Back-compat
The public surface of
@agentworkforce/runtimeand/clientsis unchanged (same exports, plus the newRelayfileWritebackErrorname). Verified at runtime:RelayfileWritebackError === WorkforceIntegrationError(same class)instanceof WorkforceIntegrationErrorwith the{ provider, operation, retryable }shape intactThe merged agents that import
@agentworkforce/runtime/clientsneed no changes. Plus the transport picks up the two review fixes made during relocation (draft-vs-receipt comparison,..-prefix path check).Test
runtime57/57, typecheck clean.deploy/mcp-workforce/clitypecheck clean.Result
Workforce now owns zero integration-specific logic: the path catalog, the write transport, and the ergonomic per-provider clients all live in the relayfile layer. Follow-up (separate): migrate the agents to
@relayfile/relay-helpers.🤖 Generated with Claude Code
CodeAnt-AI Description
Move runtime client transport to the shared Relayfile package without changing handler usage
What Changed
@agentworkforce/runtimeand@agentworkforce/runtime/clientsstill work, with the newRelayfileWritebackErrorname also availableWorkforceIntegrationErrorremains the same error shape and still matches transport failures in existing error handlingImpact
✅ Same client behavior for existing handlers✅ Clearer integration writeback errors✅ Fewer transport mismatches between runtime and Relayfile💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.