fix(team): harden retained log cleanup fallback
This commit is contained in:
parent
a713d4f058
commit
98657f8b5f
2 changed files with 17 additions and 9 deletions
|
|
@ -2290,9 +2290,12 @@ function updateProgress(
|
||||||
return run.progress;
|
return run.progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildCombinedLogs(stdoutBuffer: string, stderrBuffer: string): string {
|
function buildCombinedLogs(
|
||||||
const stdoutTrimmed = stdoutBuffer.trim();
|
stdoutBuffer: string | undefined,
|
||||||
const stderrTrimmed = stderrBuffer.trim();
|
stderrBuffer: string | undefined
|
||||||
|
): string {
|
||||||
|
const stdoutTrimmed = (stdoutBuffer ?? '').trim();
|
||||||
|
const stderrTrimmed = (stderrBuffer ?? '').trim();
|
||||||
|
|
||||||
if (stdoutTrimmed.length === 0 && stderrTrimmed.length === 0) {
|
if (stdoutTrimmed.length === 0 && stderrTrimmed.length === 0) {
|
||||||
return '';
|
return '';
|
||||||
|
|
@ -2372,7 +2375,10 @@ function normalizeRecordStringValues(value: unknown): Record<string, string> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractLogsTail(stdoutBuffer: string, stderrBuffer: string): string | undefined {
|
function extractLogsTail(
|
||||||
|
stdoutBuffer: string | undefined,
|
||||||
|
stderrBuffer: string | undefined
|
||||||
|
): string | undefined {
|
||||||
const trimmed = buildCombinedLogs(stdoutBuffer, stderrBuffer).trim();
|
const trimmed = buildCombinedLogs(stdoutBuffer, stderrBuffer).trim();
|
||||||
if (trimmed.length === 0) {
|
if (trimmed.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
@ -2394,8 +2400,9 @@ function extractLogsTail(stdoutBuffer: string, stderrBuffer: string): string | u
|
||||||
* in provisioning before any output has been line-split).
|
* in provisioning before any output has been line-split).
|
||||||
*/
|
*/
|
||||||
function extractCliLogsFromRun(run: ProvisioningRun): string | undefined {
|
function extractCliLogsFromRun(run: ProvisioningRun): string | undefined {
|
||||||
if (run.claudeLogLines.length > 0) {
|
const claudeLogLines = Array.isArray(run.claudeLogLines) ? run.claudeLogLines : [];
|
||||||
const joined = run.claudeLogLines.join('\n').trim();
|
if (claudeLogLines.length > 0) {
|
||||||
|
const joined = claudeLogLines.join('\n').trim();
|
||||||
if (joined.length === 0) {
|
if (joined.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
@ -2417,9 +2424,10 @@ interface PersistedTranscriptClaudeLogsCacheEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildRetainedClaudeLogsSnapshot(run: ProvisioningRun): RetainedClaudeLogsSnapshot | null {
|
function buildRetainedClaudeLogsSnapshot(run: ProvisioningRun): RetainedClaudeLogsSnapshot | null {
|
||||||
if (run.claudeLogLines.length > 0) {
|
const claudeLogLines = Array.isArray(run.claudeLogLines) ? run.claudeLogLines : [];
|
||||||
|
if (claudeLogLines.length > 0) {
|
||||||
return {
|
return {
|
||||||
lines: [...run.claudeLogLines],
|
lines: [...claudeLogLines],
|
||||||
updatedAt: run.claudeLogsUpdatedAt,
|
updatedAt: run.claudeLogsUpdatedAt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ describe('TaskLogStreamSection integration', () => {
|
||||||
expect(text).toContain('Task Log Stream');
|
expect(text).toContain('Task Log Stream');
|
||||||
expect(text).toContain('Grep');
|
expect(text).toContain('Grep');
|
||||||
expect(text).toContain('Edit');
|
expect(text).toContain('Edit');
|
||||||
expect(text).toContain('Claude');
|
expect(text).toContain('Agent');
|
||||||
expect(text).toContain('3 tool calls');
|
expect(text).toContain('3 tool calls');
|
||||||
expect(text).not.toContain('[]');
|
expect(text).not.toContain('[]');
|
||||||
expect(text).not.toContain('Audit complete');
|
expect(text).not.toContain('Audit complete');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue