Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit 49645f2

Browse files
TSavoWOPRclaude
authored
fix: auto-detect hosted_proxy mode when PAPERCLIP_HOSTED_MODE=true (#9)
* feat: use generic model alias for gateway-routed agents Replaces hardcoded DEFAULT_GATEWAY_MODEL with GATEWAY_MODEL_ALIAS ("default"). The actual upstream model is now controlled server-side via GATEWAY_DEFAULT_MODEL on the platform gateway — agents never need to know what model is being served. New instances get adapterConfig.model = "paperclip-gateway/default". Existing instances need a one-time DB update. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: update provision-members tests to match current ROLE_PERMISSIONS PERMISSION_KEYS no longer includes company:delete, and member role now has [agents:create, tasks:assign, tasks:assign_scope] instead of [tasks:assign, joins:approve]. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: auto-detect hosted_proxy mode when PAPERCLIP_HOSTED_MODE=true When PAPERCLIP_HOSTED_MODE=true is set, force deployment mode to hosted_proxy regardless of what the config file or PAPERCLIP_DEPLOYMENT_MODE env var says. This eliminates the dead end where a non-managed Docker image boots in authenticated mode expecting an interactive onboard step. Also marks authReady=true for hosted_proxy mode since auth is handled by the platform proxy — the server shouldn't report auth as not ready. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: WOPR <wopr@localhost> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2fe363c commit 49645f2

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

server/src/config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,16 @@ export function loadConfig(): Config {
119119
? process.env.PAPERCLIP_STORAGE_S3_FORCE_PATH_STYLE === "true"
120120
: (fileStorage?.s3?.forcePathStyle ?? false);
121121

122+
const hostedMode = process.env.PAPERCLIP_HOSTED_MODE === "true";
122123
const deploymentModeFromEnvRaw = process.env.PAPERCLIP_DEPLOYMENT_MODE;
123124
const deploymentModeFromEnv =
124125
deploymentModeFromEnvRaw && DEPLOYMENT_MODES.includes(deploymentModeFromEnvRaw as DeploymentMode)
125126
? (deploymentModeFromEnvRaw as DeploymentMode)
126127
: null;
127-
const deploymentMode: DeploymentMode = deploymentModeFromEnv ?? fileConfig?.server.deploymentMode ?? "local_trusted";
128+
// Hosted mode forces hosted_proxy — any image works as a managed instance
129+
const deploymentMode: DeploymentMode = hostedMode
130+
? "hosted_proxy"
131+
: (deploymentModeFromEnv ?? fileConfig?.server.deploymentMode ?? "local_trusted");
128132
const deploymentExposureFromEnvRaw = process.env.PAPERCLIP_DEPLOYMENT_EXPOSURE;
129133
const deploymentExposureFromEnv =
130134
deploymentExposureFromEnvRaw &&
@@ -253,6 +257,6 @@ export function loadConfig(): Config {
253257
heartbeatSchedulerEnabled: process.env.HEARTBEAT_SCHEDULER_ENABLED !== "false",
254258
heartbeatSchedulerIntervalMs: Math.max(10000, Number(process.env.HEARTBEAT_SCHEDULER_INTERVAL_MS) || 30000),
255259
companyDeletionEnabled,
256-
hostedMode: process.env.PAPERCLIP_HOSTED_MODE === "true",
260+
hostedMode,
257261
};
258262
}

server/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export async function startServer(): Promise<StartedServer> {
423423
}
424424
}
425425

426-
let authReady = config.deploymentMode === "local_trusted";
426+
let authReady = config.deploymentMode === "local_trusted" || config.deploymentMode === "hosted_proxy";
427427
let betterAuthHandler: RequestHandler | undefined;
428428
let resolveSession:
429429
| ((req: ExpressRequest) => Promise<BetterAuthSessionResult | null>)

0 commit comments

Comments
 (0)