Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): Grok agent processes receive the thread's environment #34032

Closedjuliusmarmingewants to merge 3 commits intomain fromrefs/pull/34032/headopened View on GitHub

Showing 2 changed files with 49 additions and 2 deletions.

x
0 of 2 viewed, 2 left
47 additions and 0 deletionsapps/server/src/orchestration-v2/Adapters/GrokAdapterV2.test.tsModified
View file
@@ -1,6 +1,7 @@
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
import * as NodeServices from "@effect/platform-node/NodeServices";
import {
+ EnvironmentId,
ProjectId,
MessageId,
NodeId,
@@ -290,6 +291,52 @@
...override,
});
​
+ it.effect("launches the agent with the env that names the thread it serves", () =>
+ Effect.gen(function* () {
+ const instanceId = ProviderInstanceId.make("grok-launch-test");
+ const threadId = ThreadId.make("grok-launch-thread-env");
+ const endpoint = "http://127.0.0.1:43123/mcp";
+ yield* (yield* McpProviderSessions.McpProviderSessions).set({
+ environmentId: EnvironmentId.make("environment-grok-launch-thread-env"),
+ threadId,
+ providerSessionId: "mcp-session-grok-launch-thread-env",
+ providerInstanceId: instanceId,
+ endpoint,
+ authorizationHeader: "Bearer grok-thread-env-token",
+ browserToolsAvailable: false,
+ });
+ const environments: Array<Record<string, unknown> | undefined> = [];
+ const childProcessSpawner = ChildProcessSpawner.make((command) => {
+ if (command._tag === "StandardCommand") environments.push(command.options.env);
+ return Effect.fail(