GeezerVison is showing github.com — fix(acp): report failed native history imports by StiensWout · Pull Request #39576 · pingdotgg/t3code
Conversation
When a first-time ACP history read failed, Settings marked the session as imported and prevented a retry. The server now returns the read error and identifies the bound thread when it is still eligible for history repair, so Settings keeps Import available and disables Delete. A session list refresh already in flight preserves that row update.
Fixes #39575
Reproduction on main
Commit 59651c1761 (main). Settings reports a successful import and disables Import. The T3 thread lacks the earlier messages, and the Import button only reappears after refreshing the list. The cause is at apps/server/src/provider/AcpRegistrySessions.ts:257. Ran pnpm scenarios:prove scripts/scenarios/acp-failed-history-keeps-import-available.e2e.ts --base main with the repro test added: it failed in 2 of 2 runs on a clean checkout, with Import can be retried after the history read failed in the output.
Evidence
Environment: boat.dev default machine, Linux x64, a fresh checkout of each commit
Steps: A failed native ACP history read leaves Import available without refreshing Settings: app.open ; expect.not.toHaveURL //pair(?:[?#]|$)/; app.open /settings/providers?instanceId=scenario-history-agent; locator.tap getByRole("button", name: "List sessions"); locator.waitFor getByText("Conversation with temporarily unavailable history") → visible; expect.toBeEnabled getByRole("button", name: "Delete"); locator.tap getByRole("button", name: "Import"); locator.waitFor getByRole("button", name: "Importing") → hidden; app.screenshot native-session-after-history-failure; expect.toBeDisabled getByRole("button", name: "Delete"); locator.tap getByRole("button", name: "Import"); locator.waitFor getByRole("button", name: "Imported") → visible; expect.toBeDisabled getByRole("button", name: "Imported"); expect.toBeVisible getByText("ACP session imported").
Proven: the scenario fails on base 272cd38379 and passes on head 4f596b0814.
Scenario source: scripts/scenarios/acp-failed-history-keeps-import-available.e2e.ts
// @effect-diagnostics nodeBuiltinImport:off -- The scenario supplies a local ACP agent.
import * as NodeFSP from "node:fs/promises";
import * as NodePath from "node:path";
import { ProviderDriverKind, ProviderInstanceId } from "@t3tools/contracts";
import { expect } from "e2e";
import * as Effect from "effect/Effect";
import { T3_HOME } from "../e2e.config.ts";
import { rpcClient, runPromise, test, WEB } from "./t3.ts";
const SESSION_TITLE = "Conversation with temporarily unavailable history";
const ACP = `
import { existsSync } from "node:fs";
import { createInterface } from "node:readline";
const [recovered] = process.argv.slice(2);
const withSessionDelete = (result) => {
result.agentCapabilities.sessionCapabilities.delete = {};
return result;
};
for await (const line of createInterface({ input: process.stdin })) {
const { id, method, params } = JSON.parse(line);
if (id === undefined) continue;
const reply = (body) => process.stdout.write(JSON.stringify({ jsonrpc: "2.0", ...body }) + "\\n");
if (method === "initialize") {
reply({ id, result: {
protocolVersion: 1,
agentInfo: { name: "history-scenario", version: "1.0.0" },
...withSessionDelete({
agentCapabilities: { loadSession: true, sessionCapabilities: { list: {} } },
}),
authMethods: [],
} });
} else if (method === "session/new") {
reply({ id, result: { sessionId: "health-probe" } });
} else if (method === "session/list") {
reply({ id, result: { sessions: [{
sessionId: "native-history",
cwd: params.cwd,
title: ${JSON.stringify(SESSION_TITLE)},
}] } });
} else if (method === "session/load") {
if (!existsSync(recovered)) {
reply({ id, error: { code: -32000, message: "History temporarily unavailable" } });
continue;
}
reply({ method: "session/update", params: {
sessionId: params.sessionId,
update: {
sessionUpdate: "agent_message_chunk",
content: { type: "text", text: "An earlier answer from the native session" },
},
} });
reply({ id, result: {} });
} else {
reply({ id, error: { code: -32601, message: "Method not found" } });
}
}
`;
test(
"A failed native ACP history read leaves Import available without refreshing Settings",
WEB,
async ({ t3, app, screen }) => {
const instanceId = ProviderInstanceId.make("scenario-history-agent");
const workspaceRoot = await t3.project("demo", { "history-agent.mjs": ACP });
const recovered = NodePath.join(workspaceRoot, "history-recovered");
await runPromise(
Effect.gen(function* () {
const client = yield* rpcClient(T3_HOME, app.baseUrl ?? "");
yield* client["server.updateSettings"]({
patch: {},
providerInstanceMutation: {
operation: "upsert",
instanceId,
instance: {
driver: ProviderDriverKind.make("acpRegistry"),
displayName: "History scenario agent",
enabled: true,
config: {
source: "local",
commandPath: process.execPath,
commandArgs: [NodePath.join(workspaceRoot, "history-agent.mjs"), recovered],
},
},
},
});
}).pipe(Effect.scoped),
);
await t3.open(`/settings/providers?instanceId=${instanceId}`);
await screen.getByRole("button", "List sessions", { exact: true }).tap({ timeout: 60_000 });
await screen.getByText(SESSION_TITLE, { exact: true }).waitFor();
const importButton = screen.getByRole("button", "Import", { exact: true });
const deleteButton = screen.getByRole("button", "Delete", { exact: true });
await expect(deleteButton).toBeEnabled();
await importButton.tap();
await screen.getByRole("button", "Importing", { exact: true }).waitFor({
state: "hidden",
timeout: 60_000,
});
await NodeFSP.writeFile(recovered, "");
await app.screenshot("native-session-after-history-failure");
expect(
(await importButton.isVisible()) && (await importButton.isEnabled()),
"Import can be retried after the history read failed",
).toBe(true);
await expect(deleteButton).toBeDisabled();
await importButton.tap();
const importedButton = screen.getByRole("button", "Imported", { exact: true });
await importedButton.waitFor({ timeout: 60_000 });
await expect(importedButton).toBeDisabled();
await expect(screen.getByText("ACP session imported", { exact: true })).toBeVisible();
},
);
Tests
- 913e7112fe adds the failing test, alone, before the fix.
pnpm exec vp run check:changed passed on head.
Not in this change
- Provider lookup, missing projects, unsupported capabilities, and invalid session IDs use existing checks.
- Session identity still uses provider and session IDs, so duplicate names do not affect ownership.
- Thread launch errors and competing launches retain existing ownership and conflict handling.
- Completed, run-bearing, and empty-history threads retain the importer’s existing completion rules.
- ACP replay readiness, late responses, and history read deadlines retain their existing policies.
- List errors, empty results, pagination cursors, and project switches retain existing handling.
- The server continues to reject native deletion while a T3 thread owns the session.
- Desktop shares web Settings. The mobile client has no native ACP session import screen.
Who did the work
- Written by GPT 6.2 Sol, in Codex
- Review findings fixed by GPT 6.2 Sol, in Codex
- Reviewed by GPT 6.2 Sol, in Codex, and by Claude Opus 5.5, in Claude Code, each on its own
- Also reviewed by cubic, run locally by a program, with no score
- Reproduction, checks and proof run by a program on base and head, not by an agent
Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 20, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The server now fails ACP session imports when native-history import fails and reports a pending thread ID when history remains pending. The settings UI preserves import state across concurrent session-list requests and allows retry after a failed history import.
Changes: ACP history import and retry
| Layer / File(s) |
Summary |
Report history-import failures packages/contracts/src/acpRegistry.ts, apps/server/src/provider/AcpRegistrySessions.ts, apps/server/src/ws.test.ts |
AcpRegistryOperationError can include a pending history thread ID. Existing-thread and new-thread imports use shared history-import error handling. Server tests cover failures with and without a pending thread ID. |
Reconcile session state and retry apps/web/src/components/settings/AcpSessionManagementSection.tsx, apps/web/src/components/settings/AcpSessionManagementSection.browser.test.tsx, scripts/scenarios/acp-failed-history-keeps-import-available.e2e.ts |
The settings UI applies import and deletion changes to pending list results. A failed import with a pending thread ID updates the session state, and deletion is blocked during import. Browser and end-to-end tests cover retry and imported states. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)
sequenceDiagram
participant Settings
participant AcpRegistrySessions
participant ACPAgent
Settings->>AcpRegistrySessions: Import native session
AcpRegistrySessions->>ACPAgent: Load native history
ACPAgent-->>AcpRegistrySessions: History load fails
AcpRegistrySessions-->>Settings: Return failure with pending thread ID
Settings->>AcpRegistrySessions: Retry import
AcpRegistrySessions->>ACPAgent: Load native history
ACPAgent-->>AcpRegistrySessions: Return history
AcpRegistrySessions-->>Settings: Return successful import
Loading
Possibly related PRs
- pingdotgg/t3code#22155: Adds native-history import for ACP Registry sessions. This change updates the same history-import failure path and retry state.
Suggested reviewers: macroscopeapp
Merge Risk: Minimal · up to fae68
-
A failed ACP history import now stays retryable in Settings instead of being marked complete. No merge-blocking risk was found in the supplied changes.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title "fix(acp): report failed native history imports" matches the main change. The server now returns the history read error and the bound pending-history thread ID, and Settings keeps Import ava… |
| Description check |
 |
The description follows the template sections: Problem, Change, Scope, Verification, and attribution. The Problem is stated clearly with the failed first-time ACP history read and its effect on Settin… |
| Linked Issues check |
 |
Issue #39575 is the only direct linked issue. Its coding requirement is that a failed ACP history read leaves a retry path (Import enabled) in the session row, without a list refresh. Source evidence … |
| Out of Scope Changes check |
 |
Server changes in AcpRegistrySessions.ts (importHistory helper, pending-thread error, new-thread failure handling) directly implement the issue's retry requirement. The contract change adds one option… |
Full details: Title check
-
Explanation
The title "fix(acp): report failed native history imports" matches the main change. The server now returns the history read error and the bound pending-history thread ID, and Settings keeps Import available and disables Delete. The title is a conventional commit, short, and specific. It does not name the Settings UI behavior, but it covers the primary change.
Full details: Description check
-
Explanation
The description follows the template sections: Problem, Change, Scope, Verification, and attribution. The Problem is stated clearly with the failed first-time ACP history read and its effect on Settings. The Change explains the server error reporting, the pending-history thread ID, and the in-flight list refresh handling. Scope links issue #39575 and describes the bug fix. Verification gives a reproduction on main, a before/after scenario proof on base and head, and the check command result. The Problem section lacks a dedicated heading-level reproduction, but reproduction steps appear under the Reproduction section. The description is mostly complete.
Full details: Linked Issues check
-
Explanation
Issue #39575 is the only direct linked issue. Its coding requirement is that a failed ACP history read leaves a retry path (Import enabled) in the session row, without a list refresh. Source evidence at the reviewed head: AcpRegistrySessions.ts adds a shared importHistory helper (whole-PR diff, base de0466f to head fae68bf). On a history-import failure, the helper reads the thread shell (a lookup failure is treated as no shell), checks AgentSessionImporter.isNativeHistoryPending, and returns session_import_failed with pendingHistoryThreadId when the thread is still eligible for repair. The helper is used for both existing threads and newly created threads. Previously, a new-thread history failure was only logged as a warning and the import reported success; that false 'imported' result, which the issue describes, is removed. The contract adds the optional pendingHistoryThreadId field. Web and test evidence: the whole-PR diff for AcpSessionManagementSection.tsx could not be read (changed blobs missing from the checkout), so the row-state logic was not confirmed from source. The browser test, ws.test.ts coverage, and the scenario proof reported in the PR description support the UI behavior but were not rerun here. Remaining uncertainty is limited to the web row-state code.
Full details: Out of Scope Changes check
-
Explanation
Server changes in AcpRegistrySessions.ts (importHistory helper, pending-thread error, new-thread failure handling) directly implement the issue's retry requirement. The contract change adds one optional field that carries the server signal. The web changes (per the PR summary) update row state for pending imports and in-flight list refreshes, and block Delete during import; these support the retry path. Test and scenario files cover the same behavior. The PR description lists existing behavior kept unchanged (provider lookup, pagination, list errors, native deletion rejection), and no changed area in the reviewed evidence falls outside this scope. Limit: the web component diff could not be read directly, so its scope was judged from the file summary.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 4f596b0 and fae68bf.
Files selected for processing: 1
-
scripts/scenarios/acp-failed-history-keeps-import-available.e2e.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Additional comments: 1
-
apps/web/src/components/settings/AcpSessionManagementSection.browser.test.tsx-205-205: 1
-
205-205: Trivial · Maintainability & Code Quality · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Use the required browser assertion path.
These assertions read button.disabled with ordinary expect. Use expect.element with button locators, or put the state assertions inside vi.waitFor. Keep the deferred refresh ordering.
As per coding guidelines and path instructions, “Browser tests assert through expect.element or vi.waitFor.”
Also applies to: 215-215, 219-220, 223-223
Sources: Coding guidelines, Path instructions
Review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between de0466f and 4f596b0.
Files selected for processing: 6
-
apps/server/src/provider/AcpRegistrySessions.ts
apps/server/src/ws.test.ts
apps/web/src/components/settings/AcpSessionManagementSection.browser.test.tsx
apps/web/src/components/settings/AcpSessionManagementSection.tsx
packages/contracts/src/acpRegistry.ts
scripts/scenarios/acp-failed-history-keeps-import-available.e2e.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…history-import-is-marked-co
This was referenced Nov 28, 2026
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|