Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds ChangesZalo ClawBot channel integration
Sequence Diagram(s)sequenceDiagram
participant User
participant QrLoginHook as createZaloClawbotQrLoginHook
participant LoginOrch as runZaloClawbotHostQrLogin
participant QrClient as qr.ts
participant ZaloAPI as bot.zaloplatforms.com
User->>QrLoginHook: enroll in interactive mode
QrLoginHook->>LoginOrch: runLogin()
LoginOrch->>QrClient: requestZaloClawbotLogin()
QrClient->>ZaloAPI: GET /agent/request-login
ZaloAPI-->>QrClient: loginUrl, zbsk
QrClient-->>LoginOrch: session
LoginOrch-->>User: render QR code
loop poll until completion
LoginOrch->>QrClient: pollZaloClawbotLoginStatus(zbsk)
QrClient->>ZaloAPI: GET /agent/get-login-status
ZaloAPI-->>QrClient: pending / expired / connected
QrClient-->>LoginOrch: status
end
LoginOrch-->>QrLoginHook: ok credentials
QrLoginHook->>QrLoginHook: saveCredential(botToken)
QrLoginHook->>QrLoginHook: set env vars
QrLoginHook-->>User: hook outputs
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
PR Review Advisor — BlockedMerge posture: Do not merge until addressed Action checklist
Findings index
🚨 Required before mergeAddress these before merging unless a maintainer explicitly overrides the advisor with rationale.
|
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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 `@nemoclaw-blueprint/policies/presets/zalo-clawbot.yaml`:
- Around line 21-31: Remove the unnecessary bot.zaloplatforms.com allowlist
entry from the sandbox preset unless there is a confirmed seeded-runtime
dependency. Update the zalo-clawbot preset so it only permits the hosts actually
required by in-sandbox execution, and keep the login/provisioning flow host-side
as described in src/lib/messaging/channels/zalo-clawbot/manifest.ts. Verify the
remaining egress rules still cover any needed runtime calls without expanding
sandbox SSRF surface.
In `@src/lib/messaging/channels/manifests.test.ts`:
- Around line 243-246: The forbidden-import scan in the manifest test is missing
the new production file host-qr-login-runtime.ts, so it won’t be checked for
banned imports. Update the phase-1 import guard in manifests.test.ts to include
the new Zalo hook file alongside the existing zalo-clawbot manifest and hook
entries, using the same pattern as the other listed paths. This ensures the scan
covers the new runtime path in the same test coverage as qr-login.ts and
seed-openclaw-account.ts.
In `@src/lib/messaging/channels/zalo-clawbot/hooks/qr-login.ts`:
- Around line 75-76: The QR login hook is leaving stale account metadata in the
mutable env object because `ownerId` and `oaId` are only assigned when truthy
and never removed when omitted. Update the `qr-login` flow that mutates
`options.env ?? process.env` so that `ZALOCLAWBOT_OWNER_ID` and
`ZALOCLAWBOT_OA_ID` are explicitly cleared/deleted whenever `ownerId` or `oaId`
are absent, ensuring reused processes don’t retain values from a previous
enrollment.
In `@src/lib/messaging/channels/zalo-clawbot/hooks/seed-openclaw-account.ts`:
- Around line 45-47: The seed-openclaw-account hook is silently falling back to
ZALOCLAWBOT_TOKEN_PLACEHOLDER when credential.zaloClawbotBotToken.placeholder is
missing, which hides broken wiring. In seed-openclaw-account.ts, update the
botToken assignment to require the placeholder input from
optionalInputString(inputs, "credential.zaloClawbotBotToken.placeholder") and
fail fast if it is absent, instead of synthesizing a default fallback. Keep the
change localized to the botToken initialization so the hook’s declared input
contract is enforced.
In `@src/lib/messaging/channels/zalo-clawbot/qr.ts`:
- Around line 171-186: The polling result handling in qr.ts is treating all
non-498 4xx responses as pending, which hides permanent
session-service/auth/config failures. Update the response parsing in the QR poll
flow so that only network errors and 5xx remain retryable, while unexpected 4xx
responses from the same status/body checks fail fast by surfacing an error or
terminal failure instead of returning { connected: false, expired: false }. Use
the existing poll result logic around the 498/status/body.code/body.error_code
checks and the login success branch to distinguish retryable from non-retryable
outcomes.
- Around line 123-135: Propagate the caller cancellation through
requestZaloClawbotLogin so the initial session request and QR refreshes can stop
immediately when onboarding is aborted. Add an AbortSignal parameter to
requestZaloClawbotLogin and thread it into the getJson call, then update the
login flow call sites in login.ts to pass opts.signal alongside fetch and
sessionServiceUrl. Ensure the existing ZaloClawbot QR request path continues to
use the same timeout behavior when no signal is provided.
🪄 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: Enterprise
Run ID: 3e8ca2e9-6e93-405c-ae9a-b3eb2ba2d498
📒 Files selected for processing (24)
agents/openclaw/manifest.yamlci/test-file-size-budget.jsonnemoclaw-blueprint/policies/presets/zalo-clawbot.yamlsrc/lib/agent/defs.test.tssrc/lib/messaging-channel-config.test.tssrc/lib/messaging/channels/built-ins.tssrc/lib/messaging/channels/manifests.test.tssrc/lib/messaging/channels/metadata.test.tssrc/lib/messaging/channels/metadata.tssrc/lib/messaging/channels/zalo-clawbot/hooks/host-qr-login-runtime.tssrc/lib/messaging/channels/zalo-clawbot/hooks/implementations.test.tssrc/lib/messaging/channels/zalo-clawbot/hooks/index.tssrc/lib/messaging/channels/zalo-clawbot/hooks/qr-login.tssrc/lib/messaging/channels/zalo-clawbot/hooks/seed-openclaw-account.tssrc/lib/messaging/channels/zalo-clawbot/login.test.tssrc/lib/messaging/channels/zalo-clawbot/login.tssrc/lib/messaging/channels/zalo-clawbot/manifest.tssrc/lib/messaging/channels/zalo-clawbot/qr.tssrc/lib/messaging/diagnostics.test.tssrc/lib/messaging/hooks/builtins.tssrc/lib/onboard/messaging-prep.test.tssrc/lib/sandbox/channels.test.tstest/channels-add-preset.test.tstest/policies.test.ts
|
✨ |
Summary
Adds Zalo ClawBot as a built-in OpenClaw messaging channel — an owner-bound personal Zalo bot paired via QR. NemoClaw renders the QR and captures the bot token host-side during onboarding (the WeChat
host-qrmodel), then seeds it into the plugin's account store so the sandboxed agent starts already logged in. OpenClaw's in-sandboxchannels loginis WhatsApp-only and cannot drive this channel, so host-qr capture-and-seed is required.Related Issue
Parts of #5492
Token Onboarding Guide
NemoClaw E2E Onboarding with Messaging Channels
Result
Changes
zalo-clawbotchannel manifest:auth.mode: host-qr, owner-bound (no allowlist/dmPolicy), plugin@zalo-platforms/[email protected](pinned).qr.tsrequest-login + status poll,login.tsorchestration) capturing the bot token, plus thezalo-clawbot.qrLoginenroll hook andzalo-clawbot.seedOpenClawAccountbuild hook. The token is seeded as anopenshell:resolve:env:placeholder (resolved by the OpenShell proxy at request time) and never lands raw in the image.zalo-clawbotegress preset:bot-api.zaloplatforms.com(runtime long-poll + send) andbot.zaloplatforms.com(QR login/provisioning).built-ins.ts, the messaging hook registry, and the OpenClaw agent'smessaging_platforms.loginand enroll/seed hook unit tests.policies.test.tssize budget by 1 line for the new preset's required entry in the canonical preset-name allowlist.Type of Change
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Signed-off-by: Hung Le [email protected]
Summary by CodeRabbit