Skip to content

feat(exec): export xAI executor#10

Open
awsl233777 wants to merge 2 commits into
mainfrom
feat/export-xai-executor
Open

feat(exec): export xAI executor#10
awsl233777 wants to merge 2 commits into
mainfrom
feat/export-xai-executor

Conversation

@awsl233777

@awsl233777 awsl233777 commented Jul 15, 2026

Copy link
Copy Markdown

Summary

  • expose the internal xAI/Grok executor through sdk/exec
  • keep token refresh and request execution in the existing internal executor

Validation

  • go test ./sdk/exec ./sdk/cliproxy/auth ./sdk/cliproxy/executor

Summary by CodeRabbit

  • 新功能
    • 新增 xAI/Grok 执行器,可通过公开接口创建和使用。
    • 执行器支持基于鉴权信息自动管理访问令牌刷新。

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77eec624-7c8d-4c53-bf1a-8b1929b23878

📥 Commits

Reviewing files that changed from the base of the PR and between ca6f1ac and 27dae34.

📒 Files selected for processing (1)
  • sdk/exec/xai.go
📜 Recent review details
⚠️ CI failures not shown inline (2)

GitHub Actions: auto-retarget-main-pr-to-dev / 0_retarget.txt: feat(exec): export xAI executor

Conclusion: failure

View job details

##[group]Run actions/github-script@v7
 with:
   script: const pr = context.payload.pull_request;
const prNumber = pr.number;
const { owner, repo } = context.repo;
const baseRef = pr.base?.ref;
const headRef = pr.head?.ref;
const desiredBase = "dev";
if (baseRef !== "main") {
  core.info(`PR #${prNumber} base is ${baseRef}; nothing to do.`);
  return;
}
if (headRef === desiredBase) {
  core.info(`PR #${prNumber} is ${desiredBase} -> main; skipping retarget.`);
  return;
}
core.info(`Retargeting PR #${prNumber} base from ${baseRef} to ${desiredBase}.`);
try {
  await github.rest.pulls.update({
    owner,
    repo,
    pull_number: prNumber,
    base: desiredBase,
  });
} catch (error) {
  core.setFailed(`Failed to retarget PR #${prNumber} to ${desiredBase}: ${error.message}`);
  return;
}
const body = [
  `This pull request targeted \`${baseRef}\`.`,
  "",
  `The base branch has been automatically changed to \`${desiredBase}\`.`,
].join("\n");
try {
  await github.rest.issues.createComment({
    owner,
    repo,
    issue_number: prNumber,
    body,
  });
} catch (error) {
  core.warning(`Failed to comment on PR #${prNumber}: ${error.message}`);
}
   github-***REDACTED***
   debug: false
   user-agent: actions/github-script
   result-encoding: json
   retries: 0
   retry-exempt-status-codes: 400,401,403,404,422
 ##[endgroup]
 Retargeting PR `#10` base from main to dev.
 ##[error]Failed to retarget PR `#10` to dev: Validation Failed: {"message":"Proposed base branch 'dev' was not found","resource":"PullRequest","field":"base","code":"invalid"}

GitHub Actions: auto-retarget-main-pr-to-dev / retarget: feat(exec): export xAI executor

Conclusion: failure

View job details

##[group]Run actions/github-script@v7
 with:
   script: const pr = context.payload.pull_request;
const prNumber = pr.number;
const { owner, repo } = context.repo;
const baseRef = pr.base?.ref;
const headRef = pr.head?.ref;
const desiredBase = "dev";
if (baseRef !== "main") {
  core.info(`PR #${prNumber} base is ${baseRef}; nothing to do.`);
  return;
}
if (headRef === desiredBase) {
  core.info(`PR #${prNumber} is ${desiredBase} -> main; skipping retarget.`);
  return;
}
core.info(`Retargeting PR #${prNumber} base from ${baseRef} to ${desiredBase}.`);
try {
  await github.rest.pulls.update({
    owner,
    repo,
    pull_number: prNumber,
    base: desiredBase,
  });
} catch (error) {
  core.setFailed(`Failed to retarget PR #${prNumber} to ${desiredBase}: ${error.message}`);
  return;
}
const body = [
  `This pull request targeted \`${baseRef}\`.`,
  "",
  `The base branch has been automatically changed to \`${desiredBase}\`.`,
].join("\n");
try {
  await github.rest.issues.createComment({
    owner,
    repo,
    issue_number: prNumber,
    body,
  });
} catch (error) {
  core.warning(`Failed to comment on PR #${prNumber}: ${error.message}`);
}
   github-***REDACTED***
   debug: false
   user-agent: actions/github-script
   result-encoding: json
   retries: 0
   retry-exempt-status-codes: 400,401,403,404,422
 ##[endgroup]
 Retargeting PR `#10` base from main to dev.
 ##[error]Failed to retarget PR `#10` to dev: Validation Failed: {"message":"Proposed base branch 'dev' was not found","resource":"PullRequest","field":"base","code":"invalid"}
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*.go: Format code with gofmt after Go changes
Run compile verification with go build -o test-output ./cmd/server && rm test-output after changes (REQUIRED)
Use English only for code comments
If editing code with non-English comments, translate them to English (do not add new non-English comments)
Follow gofmt formatting and use goimports-style imports
Wrap errors with context where helpful
Do not use log.Fatal or log.Fatalf (terminates the process); prefer returning errors and logging via logrus
Use method suffix for shadowed variables (e.g., errStart := server.Start())
Wrap defer errors with proper error handling: defer func() { if err := f.Close(); err != nil { log.Errorf(...) } }()
Use logrus structured logging; avoid leaking secrets/tokens in logs

Files:

  • sdk/exec/xai.go
🔇 Additional comments (3)
sdk/exec/xai.go (3)

1-10: LGTM!


16-17: 📐 Maintainability & Code Quality

无需补充编译检查


12-17: 🎯 Functional Correctness

这条不成立: ExecuteStreamCountTokens 的参数/返回值都使用 sdk/cliproxy/authsdk/cliproxy/executor 里的公开类型,外部 SDK 调用方可以直接使用 sdk/exec.NewXAIExecutor()

			> Likely an incorrect or invalid review comment.

📝 Walkthrough

Walkthrough

新增 sdk/exec/xai.go,将内部 xAI/Grok 执行器导出为 SDK 类型,并提供使用空配置初始化实例的构造函数。

Changes

xAI 执行器导出

Layer / File(s) Summary
执行器封装与构造函数
sdk/exec/xai.go
新增 XAIExecutor 类型别名和 NewXAIExecutor() 构造函数,用于创建内部 xAI/Grok 执行器。

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

我是小兔,蹦过代码田,
xAI 执行器亮相 API 边。
别名轻轻搭桥梁,
构造函数捧来新实例,
耳朵一竖,发布完成!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题简洁明确,准确概括了本次新增并导出 xAI 执行器的主要变更。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 feat/export-xai-executor
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/export-xai-executor

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.

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