Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/coding-agent/.changes/eng-5838-traces-outbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Reworked agent-trace upload scheduling as a disk-cursor outbox: upload intent and per-session uploaded-content cursors persist as one small entry file per session under `agent-traces-outbox/` in the agent dir, a startup catch-up uploads anything a previous process never finished (pruning cursors of deleted session files), scheduled and catch-up uploads never re-send unchanged sessions (the explicit `/traces upload` command still force-uploads), and rate-limited uploads reschedule (honoring an advertised Retry-After) instead of sleeping. Session disposal and process exit no longer wait on trace uploads at all, and upload timers never keep the process alive; the exit drain barrier is gone (the startup catch-up replaces it).
10 changes: 0 additions & 10 deletions packages/coding-agent/src/core/agent-session-runtime.ts
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type {
AgentSessionRuntimeDiagnostic,
AgentSessionServices,
} from "./agent-session-services.js";
import { flushAgentTraceUpload, logDetachedAgentTraceFlushFailure } from "./agent-traces.js";
import { isNoModelsAvailableMessage } from "./auth-guidance.js";
import type { ReplacedSessionContext, SessionShutdownEvent, SessionStartEvent } from "./extensions/index.js";
import { emitSessionShutdownEvent } from "./extensions/runner.js";
Expand Down Expand Up @@ -204,7 +203,6 @@ export class AgentSessionRuntime implements SubagentRuntimeHost {
reason,
targetSessionFile,
});
this.detachTraceFlush();
this.beforeSessionInvalidate?.();
// Await the kernel's final snapshot flush before invalidating the session.
await this.session.disposeAsync();
Expand Down Expand Up @@ -686,13 +684,6 @@ export class AgentSessionRuntime implements SubagentRuntimeHost {
return { cancelled: false };
}

private detachTraceFlush(): void {
const sessionManager = this.session.sessionManager;
void flushAgentTraceUpload(sessionManager).catch((error) =>
logDetachedAgentTraceFlushFailure(sessionManager.getSessionFile(), error),
);
}

private async disposeOnce(options: AgentSessionRuntimeDisposeOptions): Promise<void> {
let disposeError: unknown;
try {
Expand All @@ -703,7 +694,6 @@ export class AgentSessionRuntime implements SubagentRuntimeHost {
} catch (error) {
disposeError ??= error;
}
this.detachTraceFlush();
try {
this.beforeSessionInvalidate?.();
} catch (error) {
Expand Down
2 changes: 0 additions & 2 deletions packages/coding-agent/src/core/agent-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import {
normalizeObserveMaxChars,
ORCHESTRATION_HEARTBEAT_SKILL_NAME,
} from "./agent-observe.js";
import { flushAgentTraceUpload } from "./agent-traces.js";
import {
addLoginGuidanceToAuthError,
formatAuthenticationFailedMessage,
Expand Down Expand Up @@ -10591,7 +10590,6 @@ export class AgentSession {
}
const text = compactRlmText(readAssistantText(assistant));
if (text) run.answerPreview = text;
void flushAgentTraceUpload(child.sessionManager).catch(() => undefined);
emitChildUpdate();
} else if (event.type === "message_start" || event.type === "message_update") {
if (event.message.role === "assistant") {
Expand Down
Loading
Loading