GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix Claude Process leak[MEMORY INTENSIVE], archiving, and stale claude session monitoring. by crafael23 · Pull Request #2042 · pingdotgg/t3code

Fix Claude Process leak[MEMORY INTENSIVE], archiving, and stale claude session monitoring. #2042

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.

Sign up for GitHub

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

Merged
juliusmarminge merged 12 commits into pingdotgg:main from crafael23:fixfeat-claude-process-cleanup-process-reaper
Apr 16, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Fix Claude Process leak[MEMORY INTENSIVE], archiving, and stale claude session monitoring. #2042

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit Hold shift + click to select a range
cf63c06
Prevent session leaks during archive and Claude restarts
crafael23 Apr 15, 2026
656f610
portable scripts to a ignored directory between branches.
crafael23 Apr 15, 2026
4f1c0e4
Increase reaper inactivity threshold to 30min and add test script
crafael23 Apr 15, 2026
d32e8cd
Merge branch 'main' into fixfeat-claude-process-cleanup-process-reaper
crafael23 Apr 15, 2026
d7a76f2
Format ClaudeAdapter and use catchCause for session replace cleanup
crafael23 Apr 15, 2026
f0277d7
Use catchCause in reaper to survive stop defects
crafael23 Apr 15, 2026
ec3ec19
Use catchCause in archive to survive session stop defects
crafael23 Apr 15, 2026
63386bf
Fix provider session replacement cleanup
juliusmarminge Apr 16, 2026
7422d26
Make codex replacement cleanup best-effort
juliusmarminge Apr 16, 2026
c811373
Use granular thread lookup for archive handling
juliusmarminge Apr 16, 2026
83b005e
Make archive session lookup best-effort
juliusmarminge Apr 16, 2026
59fdbb0
Preflight archive session cleanup
juliusmarminge Apr 16, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Preflight archive session cleanup
Co-authored-by: codex <[email protected]>
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge @codex
juliusmarminge and codex committed Apr 16, 2026
commit 59fdbb019e791969ca4941e33a6a00bc9fa65599

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

78 changes: 78 additions & 0 deletions 78 apps/server/src/server.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3043,6 +3043,84 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
}).pipe(Effect.provide(NodeHttpServer.layerTest)),
);

it.effect("checks session status before archiving removes the thread from active lookups", () =>
Effect.gen(function* () {
const threadId = ThreadId.make("thread-archive-precheck");
const effects: string[] = [];
const dispatchedCommands: Array<OrchestrationCommand> = [];
const now = new Date().toISOString();
let archived = false;

yield* buildAppUnderTest({
layers: {
terminalManager: {
close: (input) =>
Effect.sync(() => {
effects.push(`terminal.close:${input.threadId}`);
}),
},
orchestrationEngine: {
dispatch: (command) =>
Effect.sync(() => {
dispatchedCommands.push(command);
effects.push(`dispatch:${command.type}`);
if (command.type === "thread.archive") {
archived = true;
}
return { sequence: dispatchedCommands.length };
}),
},
projectionSnapshotQuery: {
getThreadShellById: () =>
Effect.sync(() => {
effects.push(`query:thread-shell:${archived ? "archived" : "active"}`);
return archived
? Option.none()
: Option.some(
makeDefaultOrchestrationThreadShell({
id: threadId,
updatedAt: now,
session: {
threadId,
status: "ready",
providerName: "claudeAgent",
runtimeMode: "full-access",
activeTurnId: null,
lastError: null,
updatedAt: now,
},
}),
);
}),
},
},
});

const wsUrl = yield* getWsServerUrl("/ws");
const dispatchResult = yield* Effect.scoped(
withWsRpcClient(wsUrl, (client) =>
client[ORCHESTRATION_WS_METHODS.dispatchCommand]({
type: "thread.archive",
commandId: CommandId.make("cmd-thread-archive-precheck"),
threadId,
}),
),
);

assert.equal(dispatchResult.sequence, 1);
assert.deepEqual(effects, [
"query:thread-shell:active",
"dispatch:thread.archive",
"dispatch:thread.session.stop",
`terminal.close:${threadId}`,
]);
assert.deepEqual(
dispatchedCommands.map((command) => command.type),
["thread.archive", "thread.session.stop"],
);
}).pipe(Effect.provide(NodeHttpServer.layerTest)),
);

it.effect("archives without dispatching session stop when the thread has no session", () =>
Effect.gen(function* () {
const threadId = ThreadId.make("thread-archive-no-session");
Expand Down
27 changes: 16 additions & 11 deletions 27 apps/server/src/ws.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -550,19 +550,24 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
ORCHESTRATION_WS_METHODS.dispatchCommand,
Effect.gen(function* () {
const normalizedCommand = yield* normalizeDispatchCommand(command);
const shouldStopSessionAfterArchive =
normalizedCommand.type === "thread.archive"
? yield* projectionSnapshotQuery
.getThreadShellById(normalizedCommand.threadId)
.pipe(
Effect.map(
Option.match({
onNone: () => false,
onSome: (thread) =>
thread.session !== null && thread.session.status !== "stopped",
}),
),
Effect.catch(() => Effect.succeed(false)),
)
: false;
const result = yield* dispatchNormalizedCommand(normalizedCommand);
if (normalizedCommand.type === "thread.archive") {
const existingSessionStatus = yield* projectionSnapshotQuery
.getThreadShellById(normalizedCommand.threadId)
.pipe(
Effect.map(Option.flatMapNullishOr((thread) => thread.session?.status)),
Effect.catch(() => Effect.succeedNone),
);

if (
Option.isSome(existingSessionStatus) &&
existingSessionStatus.value !== "stopped"
) {
if (shouldStopSessionAfterArchive) {
yield* Effect.gen(function* () {
const stopCommand = yield* normalizeDispatchCommand({
type: "thread.session.stop",
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.