-
-
Notifications
You must be signed in to change notification settings - Fork 181
feat(codex): add session ID auto-completion for Codex requests #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ALTER TABLE "system_settings" ADD COLUMN "enable_codex_session_id_completion" boolean DEFAULT true NOT NULL; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CRITICAL] [STANDARD-VIOLATION] Database setting added but never used Why this is a problem: The migration adds Evidence:
Suggested fix: // 1. First add to src/drizzle/schema.ts:
export const systemSettings = pgTable('system_settings', {
// ... existing fields
enableCodexSessionIdCompletion: boolean('enable_codex_session_id_completion')
.notNull()
.default(true),
});
// 2. Then in session-completer.ts:
import { systemSettingsRepo } from "@/repository/system-settings";
static async complete(
keyId: number,
headers: Headers,
requestBody: Record<string, unknown>
): Promise<CodexSessionIdCompletionResult> {
const settings = await systemSettingsRepo.getSettings();
if (!settings.enableCodexSessionIdCompletion) {
return {
applied: false,
action: "noop",
sessionId: null,
fingerprint: null,
redis: { used: false, hit: false },
};
}
// ... rest of existing logic
}
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] [LOGIC-BUG] Why this is a problem: This migration introduces a new flag: ALTER TABLE "system_settings" ADD COLUMN "enable_codex_session_id_completion" boolean DEFAULT true NOT NULL;…but there is no corresponding field in the Drizzle schema / Suggested fix: // src/drizzle/schema.ts (systemSettings table)
enableCodexSessionIdCompletion: boolean("enable_codex_session_id_completion").notNull().default(true),// src/types/system-config.ts
export interface SystemSettings {
// ...
enableCodexSessionIdCompletion: boolean;
}
export interface UpdateSystemSettingsInput {
// ...
enableCodexSessionIdCompletion?: boolean;
}// Example usage once wired (e.g. src/app/v1/_lib/proxy/session-guard.ts)
const settings = await getCachedSystemSettings();
if (settings.enableCodexSessionIdCompletion) {
await CodexSessionIdCompleter.complete(keyId, session.headers, session.request.message);
} |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the database setting
enable_codex_session_id_completionis added but is never checked or used anywhere in the codebase. Searching for this setting reveals it only exists in the migration files. This means:CodexSessionIdCompleter.complete()The integration code should check this setting (probably from system_settings table) before applying session ID completion
Prompt To Fix With AI