Skip to content
4 changes: 4 additions & 0 deletions cloud-agent-next/src/session-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
OPENCODE_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
KILO_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
},
Expand Down Expand Up @@ -307,6 +308,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
OPENCODE_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
KILO_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
},
Expand Down Expand Up @@ -952,6 +954,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
OPENCODE_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
KILO_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
API_KEY: 'test-key-123',
Expand Down Expand Up @@ -1056,6 +1059,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
OPENCODE_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
KILO_CONFIG_CONTENT: `{"permission":{"external_directory":{"/tmp/attachments/${sessionId}/**":"allow"}},"provider":{"kilo":{"options":{"apiKey":"token","kilocodeToken":"token","kilocodeOrganizationId":"org"}}},"model":"kilo/test-model"}`,
},
Expand Down
2 changes: 2 additions & 0 deletions cloud-agent-next/src/session-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ export class SessionService {
KILOCODE_TOKEN: kilocodeToken,
// Platform identifier - defaults to 'cloud-agent' if not specified
KILO_PLATFORM: createdOnPlatform ?? 'cloud-agent',
// Feature attribution for microdollar usage tracking
KILOCODE_FEATURE: createdOnPlatform ?? 'cloud-agent',
};

const providerOptions: Record<string, string> = {
Expand Down
4 changes: 4 additions & 0 deletions cloud-agent/src/session-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
},
cwd: `/workspace/org/user/sessions/${sessionId}`,
});
Expand Down Expand Up @@ -249,6 +250,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
},
cwd: `/workspace/org/user/sessions/${sessionId}`,
});
Expand Down Expand Up @@ -844,6 +846,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
API_KEY: 'test-key-123',
DATABASE_URL: 'postgres://localhost:5432/test',
NODE_ENV: 'development',
Expand Down Expand Up @@ -942,6 +945,7 @@ describe('SessionService', () => {
KILOCODE_TOKEN: 'token',
KILOCODE_ORGANIZATION_ID: 'org',
KILO_PLATFORM: 'cloud-agent',
KILOCODE_FEATURE: 'cloud-agent',
},
cwd: `/workspace/org/user/sessions/${sessionId}`,
});
Expand Down
2 changes: 2 additions & 0 deletions cloud-agent/src/session-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ export class SessionService {
KILOCODE_TOKEN: kilocodeToken,
// Platform identifier - defaults to 'cloud-agent' if not specified
KILO_PLATFORM: createdOnPlatform ?? 'cloud-agent',
// Feature attribution for microdollar usage tracking
KILOCODE_FEATURE: createdOnPlatform ?? 'cloud-agent',
};

// Set GH_TOKEN for GitHub repos only, respecting user overrides
Expand Down
1 change: 1 addition & 0 deletions cloudflare-auto-fix-infra/src/fix-orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export class AutoFixOrchestrator extends DurableObject<Env> {
model: config.model_slug,
githubToken,
autoCommit: true,
createdOnPlatform: 'autofix',
// upstreamBranch is intentionally NOT set - agent will create session/{sessionId} branch
callbackUrl,
callbackHeaders: {
Expand Down
1 change: 1 addition & 0 deletions cloudflare-auto-triage-infra/src/triage-orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export class TriageOrchestrator extends DurableObject<Env> {
mode: 'ask' as const, // Classification is a Q&A task
model: config.model_slug,
githubToken,
createdOnPlatform: 'auto-triage',
};

// Use CloudAgentClient to initiate session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ export class CodeReviewOrchestrator extends DurableObject<Env> {
// The callback URL includes reviewId in the path so cloud agent stays generic
const sessionInputWithCallback = {
...this.state.sessionInput,
createdOnPlatform: 'code-review',
callbackUrl: `${this.env.API_URL}/api/internal/code-review-status/${this.state.reviewId}`,
callbackHeaders: {
'X-Internal-Secret': this.env.INTERNAL_API_SECRET,
Expand Down
1 change: 1 addition & 0 deletions kiloclaw/src/gateway/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export async function buildEnvVars(

if (env.DEV_MODE) plainEnv.OPENCLAW_DEV_MODE = env.DEV_MODE;
if (env.KILOCODE_API_BASE_URL) plainEnv.KILOCODE_API_BASE_URL = env.KILOCODE_API_BASE_URL;
plainEnv.KILOCODE_FEATURE = 'kilo-claw';

// Collect all sensitive values
const sensitive: Record<string, string> = {};
Expand Down
Loading