Skip to content

Commit a6648b3

Browse files
committed
Bare metal evals fixes
1 parent 6c2aa63 commit a6648b3

File tree

6 files changed

+26
-13
lines changed

6 files changed

+26
-13
lines changed

apps/web-evals/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"lint": "next lint --max-warnings 0",
77
"check-types": "tsc -b",
8-
"dev": "scripts/check-services.sh && next dev",
8+
"dev": "scripts/check-services.sh && next dev -p 3446",
99
"format": "prettier --write src",
1010
"build": "next build",
1111
"start": "next start",

packages/evals/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ By default, the evals system uses the following ports:
9595

9696
- **PostgreSQL**: 5433 (external) → 5432 (internal)
9797
- **Redis**: 6380 (external) → 6379 (internal)
98-
- **Web Service**: 3446 (external) → 3000 (internal)
98+
- **Web Service**: 3446 (external) → 3446 (internal)
9999

100100
These ports are configured to avoid conflicts with other services that might be running on the standard PostgreSQL (5432) and Redis (6379) ports.
101101

packages/evals/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ services:
5252
context: ../../
5353
dockerfile: packages/evals/Dockerfile.web
5454
ports:
55-
- "${EVALS_WEB_PORT:-3446}:3000"
55+
- "${EVALS_WEB_PORT:-3446}:3446"
5656
environment:
5757
- HOST_EXECUTION_METHOD=docker
5858
volumes:

packages/evals/scripts/setup.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ build_extension() {
1212
echo "🔨 Building the Roo Code extension..."
1313
pnpm -w vsix -- --out ../bin/roo-code-$(git rev-parse --short HEAD).vsix || exit 1
1414
code --install-extension ../../bin/roo-code-$(git rev-parse --short HEAD).vsix || exit 1
15-
cd evals
1615
}
1716

1817
check_docker_services() {
@@ -377,7 +376,7 @@ fi
377376

378377
echo -e "\n🚀 You're ready to rock and roll! \n"
379378

380-
if ! nc -z localhost 3000; then
379+
if ! nc -z localhost 3446; then
381380
read -p "🌐 Would you like to start the evals web app? (Y/n): " start_evals
382381

383382
if [[ "$start_evals" =~ ^[Yy]|^$ ]]; then
@@ -386,5 +385,5 @@ if ! nc -z localhost 3000; then
386385
echo "💡 You can start it anytime with 'pnpm --filter @roo-code/web-evals dev'."
387386
fi
388387
else
389-
echo "👟 The evals web app is running at http://localhost:3000 (or http://localhost:3446 if using Docker)"
388+
echo "👟 The evals web app is running at http://localhost:3446"
390389
fi

src/api/providers/roo.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import { Anthropic } from "@anthropic-ai/sdk"
2+
import OpenAI from "openai"
23

3-
import { rooDefaultModelId, rooModels, type RooModelId } from "@roo-code/types"
4+
import { AuthState, rooDefaultModelId, rooModels, type RooModelId } from "@roo-code/types"
45
import { CloudService } from "@roo-code/cloud"
56

67
import type { ApiHandlerOptions } from "../../shared/api"
78
import { ApiStream } from "../transform/stream"
89

910
import type { ApiHandlerCreateMessageMetadata } from "../index"
11+
import { DEFAULT_HEADERS } from "./constants"
1012
import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider"
1113

1214
export class RooHandler extends BaseOpenAiCompatibleProvider<RooModelId> {
1315
constructor(options: ApiHandlerOptions) {
14-
// Get the session token if available, but don't throw if not.
15-
// The server will handle authentication errors and return appropriate status codes.
16-
let sessionToken = ""
16+
let sessionToken: string | undefined = undefined
1717

1818
if (CloudService.hasInstance()) {
19-
sessionToken = CloudService.instance.authService?.getSessionToken() || ""
19+
sessionToken = CloudService.instance.authService?.getSessionToken()
2020
}
2121

2222
// Always construct the handler, even without a valid token.
@@ -25,11 +25,25 @@ export class RooHandler extends BaseOpenAiCompatibleProvider<RooModelId> {
2525
...options,
2626
providerName: "Roo Code Cloud",
2727
baseURL: process.env.ROO_CODE_PROVIDER_URL ?? "https://api.roocode.com/proxy/v1",
28-
apiKey: sessionToken || "unauthenticated", // Use a placeholder if no token
28+
apiKey: sessionToken || "unauthenticated", // Use a placeholder if no token.
2929
defaultProviderModelId: rooDefaultModelId,
3030
providerModels: rooModels,
3131
defaultTemperature: 0.7,
3232
})
33+
34+
if (CloudService.hasInstance()) {
35+
const cloudService = CloudService.instance
36+
37+
cloudService.on("auth-state-changed", (state: { state: AuthState }) => {
38+
if (state.state === "active-session") {
39+
this.client = new OpenAI({
40+
baseURL: this.baseURL,
41+
apiKey: this.options.apiKey,
42+
defaultHeaders: DEFAULT_HEADERS,
43+
})
44+
}
45+
})
46+
}
3347
}
3448

3549
override async *createMessage(

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export async function activate(context: vscode.ExtensionContext) {
194194
// Add to subscriptions for proper cleanup on deactivate.
195195
context.subscriptions.push(cloudService)
196196

197-
// Trigger initial cloud profile sync now that CloudService is ready
197+
// Trigger initial cloud profile sync now that CloudService is ready.
198198
try {
199199
await provider.initializeCloudProfileSyncWhenReady()
200200
} catch (error) {

0 commit comments

Comments
 (0)