chore: test deploy snapshot

This commit is contained in:
2026-05-27 19:32:28 +09:00
parent 10805d242e
commit e195ac8088
5 changed files with 1226 additions and 274 deletions

View File

@@ -3042,6 +3042,19 @@ async function cancelRunnerCodexExecution(requestId: string) {
}
}
function isRunnerTerminatedMessage(message: string) {
const normalizedMessage = message.trim().toLowerCase();
return normalizedMessage === 'terminated' || normalizedMessage.endsWith(': terminated');
}
function normalizeRunnerExecutionErrorMessage(message: string) {
if (isRunnerTerminatedMessage(message)) {
return 'Codex 실행이 중간에 종료되었습니다. 잠시 후 다시 시도해 주세요.';
}
return message;
}
async function runAgenticCodexReply(
context: ChatContext | null,
input: string,
@@ -3441,7 +3454,16 @@ async function runAgenticCodexReply(
}
if (remoteErrorMessage) {
reject(new Error(remoteErrorMessage));
const hasMeaningfulOutput = Boolean(
completedAgentMessage.trim() || streamedOutput.trim() || stdoutTail.trim(),
);
if (isRunnerTerminatedMessage(remoteErrorMessage) && hasMeaningfulOutput) {
resolve();
return;
}
reject(new Error(normalizeRunnerExecutionErrorMessage(remoteErrorMessage)));
return;
}

View File

@@ -58,6 +58,48 @@ const CODEX_LIVE_FINISHED_RETENTION_MS = Math.max(
);
const activeCodexExecutions = new Map();
const recentCodexExecutions = new Map();
let runnerShutdownSignal = null;
function logRunner(message) {
process.stdout.write("[server-command-runner] " + new Date().toISOString() + " " + message + "\n");
}
function summarizeActiveExecutionIds(limit = 8) {
const requestIds = Array.from(activeCodexExecutions.keys()).slice(0, limit);
const suffix = activeCodexExecutions.size > requestIds.length ? " +" + (activeCodexExecutions.size - requestIds.length) + " more" : "";
return requestIds.length > 0 ? requestIds.join(", ") + suffix : "none";
}
function resolveSignalExitCode(signal) {
switch (signal) {
case "SIGINT":
return 130;
case "SIGHUP":
return 129;
case "SIGTERM":
return 143;
default:
return 1;
}
}
function shutdownRunnerFromSignal(signal) {
if (runnerShutdownSignal) {
return;
}
runnerShutdownSignal = signal;
logRunner("received " + signal + "; activeExecutions=" + activeCodexExecutions.size + "; requestIds=" + summarizeActiveExecutionIds());
process.exit(resolveSignalExitCode(signal));
}
process.once("SIGTERM", () => shutdownRunnerFromSignal("SIGTERM"));
process.once("SIGINT", () => shutdownRunnerFromSignal("SIGINT"));
process.once("SIGHUP", () => shutdownRunnerFromSignal("SIGHUP"));
process.on("exit", (code) => {
const shutdownLabel = runnerShutdownSignal === null ? "none" : runnerShutdownSignal;
logRunner("exiting with code " + code + "; shutdownSignal=" + shutdownLabel + "; activeExecutions=" + activeCodexExecutions.size);
});
function resolveCodexLiveModel(value) {
const normalized = String(value ?? '').trim();
@@ -798,6 +840,7 @@ async function runCodexLiveExecution(payload, response) {
child,
tempDir,
});
logRunner("spawned Codex child pid=" + (child.pid ?? "unknown") + " requestId=" + requestId + " sessionId=" + sessionId + " model=" + codexModel + " idleTimeoutMs=" + configuredIdleTimeoutMs + " maxExecutionMs=" + configuredMaxExecutionMs);
activeCodexExecutions.set(requestId, executionRecord);
attachCodexExecutionSubscriber(executionRecord, response);
broadcastCodexExecutionEvent(executionRecord, {
@@ -820,7 +863,7 @@ async function runCodexLiveExecution(payload, response) {
}
};
const requestTermination = (message) => {
const requestTermination = (message, reason = 'runner-termination') => {
if (terminationRequested) {
return;
}
@@ -833,6 +876,7 @@ async function runCodexLiveExecution(payload, response) {
message,
});
logRunner("terminating Codex child pid=" + (child.pid ?? "unknown") + " requestId=" + requestId + " reason=" + reason + " message=" + message);
child.kill('SIGTERM');
setTimeout(() => {
if (!child.killed) {
@@ -853,6 +897,7 @@ async function runCodexLiveExecution(payload, response) {
idleTimer = setTimeout(() => {
requestTermination(
`Codex Live 실행이 ${Math.round(configuredIdleTimeoutMs / 1000)}초 동안 출력이 없어 중단되었습니다.`,
'idle-timeout',
);
}, configuredIdleTimeoutMs);
idleTimer.unref?.();
@@ -861,6 +906,7 @@ async function runCodexLiveExecution(payload, response) {
executionTimer = setTimeout(() => {
requestTermination(
`Codex Live 실행이 ${Math.round(configuredMaxExecutionMs / 1000)}초를 넘어 중단되었습니다.`,
'max-execution-timeout',
);
}, configuredMaxExecutionMs);
executionTimer.unref?.();
@@ -968,6 +1014,7 @@ async function runCodexLiveExecution(payload, response) {
child.on('error', async (error) => {
clearExecutionTimers();
logRunner("Codex child process error requestId=" + requestId + " pid=" + (child.pid ?? "unknown") + " message=" + (error instanceof Error ? error.message : String(error)));
broadcastCodexExecutionEvent(executionRecord, {
type: 'error',
message: error instanceof Error ? error.message : String(error),
@@ -979,8 +1026,9 @@ async function runCodexLiveExecution(payload, response) {
finalizeCodexExecution(executionRecord);
});
child.on('close', async (code) => {
child.on('close', async (code, signal) => {
clearExecutionTimers();
logRunner("Codex child closed requestId=" + requestId + " pid=" + (child.pid ?? "unknown") + " exitCode=" + (code ?? "null") + " signal=" + (signal ?? "none") + " terminationRequested=" + terminationRequested);
const trailingLine = jsonLineBuffer.trim();
if (trailingLine) {
handleCodexJsonLine(trailingLine);
@@ -1204,6 +1252,7 @@ const server = createServer(async (request, response) => {
}
try {
logRunner("received cancel request for requestId=" + requestId + "; forwarding SIGTERM to child pid=" + (activeExecution.child.pid ?? "unknown"));
activeExecution.child.kill('SIGTERM');
setTimeout(() => {
const current = activeCodexExecutions.get(requestId);
@@ -1239,5 +1288,5 @@ server.listen(port, host, () => {
});
}, 10_000);
heartbeatTimer.unref();
process.stdout.write(`server-command-runner listening on http://${host}:${port}\n`);
logRunner("listening on http://" + host + ":" + port + "; pid=" + process.pid + "; ppid=" + process.ppid + "; startedAt=" + startedAt + "; logFile=" + runnerLogFile);
});

0
scripts/server-command-runner-supervisor.sh Normal file → Executable file
View File

View File

@@ -235,41 +235,46 @@
min-width: 0;
}
.chat-share-page__room-swipe {
.chat-share-page__room-item {
position: relative;
overflow: hidden;
width: 100%;
border-radius: 14px;
isolation: isolate;
-webkit-tap-highlight-color: transparent;
}
.chat-share-page__room-delete-action {
position: absolute;
inset: 0 0 0 auto;
top: 9px;
right: 9px;
display: flex;
align-items: center;
justify-content: center;
width: 96px;
width: 26px;
height: 26px;
border: 0;
border-radius: 14px;
background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
border-radius: 999px;
background: rgba(255, 255, 255, 0.92);
color: #dc2626;
font-size: 12px;
box-shadow:
inset 0 0 0 1px rgba(248, 113, 113, 0.26),
0 6px 14px rgba(15, 23, 42, 0.08);
cursor: pointer;
transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
z-index: 2;
}
.chat-share-page__room-delete-action:hover,
.chat-share-page__room-delete-action:focus-visible {
background: #dc2626;
color: #fff;
font-size: 1rem;
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.2s ease, visibility 0.2s ease;
box-shadow:
inset 0 0 0 1px rgba(220, 38, 38, 0.18),
0 8px 16px rgba(220, 38, 38, 0.22);
transform: translateY(-1px);
}
.chat-share-page__room-swipe.is-swiped .chat-share-page__room-delete-action,
.chat-share-page__room-swipe.is-dragging .chat-share-page__room-delete-action {
opacity: 1;
visibility: visible;
pointer-events: auto;
}
.chat-share-page__room-swipe.is-delete-locked .chat-share-page__room-delete-action {
.chat-share-page__room-item.is-delete-locked .chat-share-page__room-delete-action {
display: none;
}
@@ -280,7 +285,7 @@
z-index: 1;
width: 100%;
min-width: 0;
padding: 12px;
padding: 12px 42px 12px 12px;
border: 0;
border-radius: 14px;
background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
@@ -290,10 +295,7 @@
text-align: left;
cursor: pointer;
transition: box-shadow 0.2s ease, background 0.2s ease, transform 0.16s ease;
touch-action: pan-y;
will-change: transform;
backface-visibility: hidden;
transform: translate3d(0, 0, 0);
}
.chat-share-page__room-card--active {
@@ -303,10 +305,6 @@
0 10px 24px rgba(59, 130, 246, 0.16);
}
.chat-share-page__room-swipe.is-dragging .chat-share-page__room-card {
transition: box-shadow 0.2s ease, background 0.2s ease;
}
.chat-share-page__room-card--default {
background:
linear-gradient(180deg, #f4fbff 0%, #e3f4ff 100%);
@@ -1223,6 +1221,332 @@
flex-wrap: wrap;
}
.chat-share-page__process-inspector {
position: fixed;
top: 0;
left: 0;
width: min(920px, calc(100vw - 24px));
max-height: min(720px, calc(100dvh - 24px));
display: grid;
grid-template-rows: auto minmax(0, 1fr);
border: 1px solid rgba(148, 163, 184, 0.42);
border-radius: 22px;
background: rgba(248, 250, 252, 0.98);
box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
overflow: hidden;
backdrop-filter: blur(16px);
}
.chat-share-page__process-inspector--fullscreen {
inset: 0;
width: 100vw;
max-height: 100dvh;
height: 100dvh;
border-radius: 0;
border-width: 0;
}
.chat-share-page__process-inspector--minimized {
width: min(380px, calc(100vw - 24px));
max-height: none;
}
.chat-share-page__process-inspector-drag {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 14px;
background:
linear-gradient(135deg, rgba(12, 74, 110, 0.96), rgba(30, 64, 175, 0.94)),
linear-gradient(90deg, rgba(56, 189, 248, 0.22), rgba(125, 211, 252, 0));
cursor: grab;
user-select: none;
}
.chat-share-page__process-inspector-drag:active {
cursor: grabbing;
}
.chat-share-page__process-inspector-drag-copy {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.chat-share-page__process-inspector-drag-grip {
width: 16px;
height: 16px;
border-radius: 999px;
background:
radial-gradient(circle, rgba(71, 85, 105, 0.8) 1.1px, transparent 1.2px) center / 5px 5px,
rgba(226, 232, 240, 0.85);
box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.28);
flex: 0 0 auto;
}
.chat-share-page__process-inspector-drag-text {
display: grid;
min-width: 0;
}
.chat-share-page__process-inspector-drag-text .ant-typography {
margin: 0;
color: rgba(255, 255, 255, 0.96);
}
.chat-share-page__process-inspector-request-id {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: rgba(191, 219, 254, 0.96) !important;
}
.chat-share-page__process-inspector-window-actions {
display: flex;
align-items: center;
gap: 4px;
}
.chat-share-page__process-inspector-window-button.ant-btn {
width: 30px;
min-width: 30px;
height: 30px;
border-radius: 999px;
color: rgba(255, 255, 255, 0.92);
background: rgba(15, 23, 42, 0.14);
}
.chat-share-page__process-inspector-body {
display: grid;
grid-template-rows: auto minmax(0, 1fr);
min-height: 0;
}
.chat-share-page__process-inspector-summary {
display: grid;
gap: 12px;
padding: 14px 18px 14px;
border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.chat-share-page__process-inspector-summary .ant-typography {
margin: 0;
}
.chat-share-page__process-inspector-summary-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
flex-wrap: wrap;
}
.chat-share-page__process-inspector-summary-head-main {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
flex-wrap: wrap;
}
.chat-share-page__process-inspector-summary-toggle.ant-btn {
border-radius: 999px;
color: rgba(30, 41, 59, 0.92);
background: rgba(226, 232, 240, 0.72);
}
.chat-share-page__process-inspector-sections {
display: grid;
grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
align-content: start;
align-items: start;
gap: 12px;
padding: 14px 18px 18px;
min-height: 0;
overflow: auto;
}
.chat-share-page__process-inspector-section {
display: grid;
gap: 6px;
min-height: 0;
}
.chat-share-page__process-inspector-section--checklist,
.chat-share-page__process-inspector-section--narratives {
grid-column: 1;
}
.chat-share-page__process-inspector-section--log {
grid-column: 2;
grid-row: 1 / span 2;
}
.chat-share-page__process-inspector-section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
flex-wrap: wrap;
}
.chat-share-page__process-inspector-checklist,
.chat-share-page__process-inspector-narratives,
.chat-share-page__process-inspector-log {
display: grid;
gap: 0;
border: 1px solid rgba(203, 213, 225, 0.88);
border-radius: 16px;
background: rgba(255, 255, 255, 0.92);
overflow: hidden;
}
.chat-share-page__process-inspector-summary-table {
display: grid;
gap: 0;
border: 1px solid rgba(203, 213, 225, 0.88);
border-radius: 16px;
background: rgba(255, 255, 255, 0.92);
overflow: hidden;
}
.chat-share-page__process-inspector-table-row,
.chat-share-page__process-inspector-narrative,
.chat-share-page__process-inspector-log-line {
display: grid;
grid-template-columns: 104px minmax(0, 1fr);
gap: 12px;
align-items: start;
padding: 10px 12px;
}
.chat-share-page__process-inspector-check-item {
display: grid;
grid-template-columns: minmax(0, 132px) auto minmax(0, 1fr);
gap: 10px;
align-items: center;
padding: 8px 12px;
}
.chat-share-page__process-inspector-table-row + .chat-share-page__process-inspector-table-row,
.chat-share-page__process-inspector-narrative + .chat-share-page__process-inspector-narrative,
.chat-share-page__process-inspector-log-line + .chat-share-page__process-inspector-log-line {
border-top: 1px solid rgba(226, 232, 240, 0.9);
}
.chat-share-page__process-inspector-check-item + .chat-share-page__process-inspector-check-item {
border-top: 1px solid rgba(226, 232, 240, 0.9);
}
.chat-share-page__process-inspector-table-label {
min-width: 0;
font-size: 12px;
line-height: 1.5;
}
.chat-share-page__process-inspector-table-value {
min-width: 0;
line-height: 1.55;
word-break: break-word;
}
.chat-share-page__process-inspector-table-value--mono {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
font-size: 12px;
}
.chat-share-page__process-inspector-check-title {
min-width: 0;
}
.chat-share-page__process-inspector-check-note {
min-width: 0;
line-height: 1.45;
}
.chat-share-page__process-inspector-log {
background: rgba(2, 6, 23, 0.96);
border-color: rgba(30, 41, 59, 0.98);
min-height: 0;
align-content: start;
overflow: auto;
}
.chat-share-page__process-inspector-log-line {
grid-template-columns: 34px minmax(0, 1fr);
color: rgba(226, 232, 240, 0.96);
font-size: 12px;
line-height: 1.55;
}
.chat-share-page__process-inspector-log-index {
color: rgba(125, 211, 252, 0.88);
font-variant-numeric: tabular-nums;
}
.chat-share-page__process-inspector-log-text {
white-space: pre-wrap;
word-break: break-word;
}
@media (max-width: 960px) {
.chat-share-page__process-inspector {
width: min(100vw - 16px, 720px);
}
.chat-share-page__process-inspector-sections {
grid-template-columns: minmax(0, 1fr);
}
.chat-share-page__process-inspector-section--checklist,
.chat-share-page__process-inspector-section--narratives,
.chat-share-page__process-inspector-section--log {
grid-column: 1;
grid-row: auto;
}
}
.chat-share-page__process-inspector-minimized {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 12px 14px 14px;
}
.chat-share-page__process-inspector-minimized-copy {
display: grid;
gap: 4px;
min-width: 0;
flex: 1 1 auto;
}
.chat-share-page__process-inspector-minimized-head {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
.chat-share-page__process-inspector-minimized-time {
min-width: 0;
}
.chat-share-page__process-inspector-minimized-log {
display: block;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.chat-share-page__process-inspector-minimized-button.ant-btn {
border-radius: 999px;
flex: 0 0 auto;
}
.chat-share-page__room-settings-checkbox-group {
display: grid;
gap: 10px;
@@ -1623,7 +1947,7 @@
top: env(safe-area-inset-top, 0px);
left: env(safe-area-inset-left, 0px);
z-index: 1605;
width: min(176px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
width: min(240px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
padding: 8px 8px 10px;
border-radius: 18px;
background: rgba(15, 23, 42, 0.88);
@@ -1760,7 +2084,7 @@
}
.chat-share-page__program-minimized {
width: min(164px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
width: min(220px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
padding: 8px;
}

File diff suppressed because it is too large Load Diff