fix(web): interrupted imports count as incomplete; gate timer waits for hydration
- runImport counts successes rather than non-interrupted failures, so an all-interrupted import no longer reports as fully imported - FirstRunGate's fallback timer starts only after client settings hydrate, so slow hydration can't resolve to the app before the flag is read - The install terminal's open and teardown share one effect, so a Strict Mode setup/cleanup/setup cycle re-opens instead of leaving the drawer attached to a closed session - Docs match the actual connect and sign-in steps Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
7192bbef24
commit
cdb78361bc
3 files changed
+62
-42
No files matched your search
@@ -87,11 +87,14 @@ export function FirstRunGate({
|
||||
workspaceFresh,
|
||||
]);
|
||||
|
||||
// The fallback only guards a stalled *server* read. It must not start
|
||||
// before settings hydrate, or slow hydration would resolve to the app
|
||||
// without the decision effect ever seeing `onboardingCompletedAt`.
|
||||
useEffect(() => {
|
||||
if (decision !== "pending") return;
|
||||
if (decision !== "pending" || !hydrated) return;
|
||||
const timer = window.setTimeout(() => setDecision("app"), FIRST_RUN_DECISION_TIMEOUT_MS);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [decision]);
|
||||
}, [decision, hydrated]);
|
||||
|
||||
useEffect(() => {
|
||||
if (decision === "wizard") {
|
||||
|
||||
@@ -671,43 +671,53 @@ function AgentInstallTerminal({
|
||||
: (AGENT_INSTALL_COMMANDS[driver] ?? "");
|
||||
const [preTypeFailed, setPreTypeFailed] = useState(false);
|
||||
|
||||
// Open + pre-type, and tear the PTY down again on cleanup. Both live in one
|
||||
// effect so a Strict Mode setup/cleanup/setup cycle (or any remount) always
|
||||
// re-opens: the previous run's session is closed and `preparedRef` is reset
|
||||
// together, instead of the ref surviving a teardown and leaving the drawer
|
||||
// attached to a dead session.
|
||||
useEffect(() => {
|
||||
if (preparedRef.current || cwd === null) return;
|
||||
void (async () => {
|
||||
const opened = await openTerminal({
|
||||
environmentId,
|
||||
input: { threadId: AGENT_ONBOARDING_THREAD_ID, terminalId, cwd },
|
||||
});
|
||||
// Only a successful open ends the attempts, so a transient RPC failure
|
||||
// retries on the next render instead of leaving a dead terminal.
|
||||
if (opened._tag !== "Success") return;
|
||||
if (cwd === null) return;
|
||||
let cancelled = false;
|
||||
if (!preparedRef.current) {
|
||||
preparedRef.current = true;
|
||||
if (command.length === 0) return;
|
||||
// Pre-type without the trailing carriage return; the user submits.
|
||||
// The terminal id is unique to this mount, so this session has never
|
||||
// been written to before.
|
||||
const wrote = await writeTerminal({
|
||||
environmentId,
|
||||
input: { threadId: AGENT_ONBOARDING_THREAD_ID, terminalId, data: command },
|
||||
});
|
||||
// A silent failure would leave a blank prompt under copy that says
|
||||
// "review the command" — fall back to telling the user what to type.
|
||||
if (wrote._tag !== "Success") setPreTypeFailed(true);
|
||||
})();
|
||||
}, [command, cwd, environmentId, openTerminal, terminalId, writeTerminal]);
|
||||
|
||||
// Every exit path unmounts the drawer (Done, Continue/Skip, card switch,
|
||||
// session exit), so unmount cleanup is the single place the PTY dies —
|
||||
// nothing is left running behind the wizard. An interrupted install is
|
||||
// re-runnable from the card.
|
||||
useEffect(() => {
|
||||
void (async () => {
|
||||
const opened = await openTerminal({
|
||||
environmentId,
|
||||
input: { threadId: AGENT_ONBOARDING_THREAD_ID, terminalId, cwd },
|
||||
});
|
||||
// A transient RPC failure should retry rather than leave a dead
|
||||
// terminal, so only a successful open keeps the ref set.
|
||||
if (opened._tag !== "Success") {
|
||||
preparedRef.current = false;
|
||||
return;
|
||||
}
|
||||
if (cancelled || command.length === 0) return;
|
||||
// Pre-type without the trailing carriage return; the user submits.
|
||||
// The terminal id is unique to this mount, so this session has never
|
||||
// been written to before.
|
||||
const wrote = await writeTerminal({
|
||||
environmentId,
|
||||
input: { threadId: AGENT_ONBOARDING_THREAD_ID, terminalId, data: command },
|
||||
});
|
||||
// A silent failure would leave a blank prompt under copy that says
|
||||
// "review the command" — fall back to telling the user what to type.
|
||||
if (!cancelled && wrote._tag !== "Success") setPreTypeFailed(true);
|
||||
})();
|
||||
}
|
||||
// Every exit path unmounts the drawer (Done, Continue/Skip, card switch,
|
||||
// session exit), so this cleanup is the single place the PTY dies —
|
||||
// nothing is left running behind the wizard. An interrupted install is
|
||||
// re-runnable from the card.
|
||||
return () => {
|
||||
cancelled = true;
|
||||
preparedRef.current = false;
|
||||
void closeTerminal({
|
||||
environmentId,
|
||||
input: { threadId: AGENT_ONBOARDING_THREAD_ID, terminalId },
|
||||
});
|
||||
};
|
||||
}, [closeTerminal, environmentId, terminalId]);
|
||||
}, [closeTerminal, command, cwd, environmentId, openTerminal, terminalId, writeTerminal]);
|
||||
|
||||
if (cwd === null) {
|
||||
return null;
|
||||
@@ -797,7 +807,11 @@ function ImportStep({ onDone }: { readonly onDone: () => void }) {
|
||||
setIsImporting(true);
|
||||
setImportError("");
|
||||
const defaultModelSelection = resolveDefaultProviderModelSelection(providers ?? [], null);
|
||||
let failures = 0;
|
||||
// Interrupted imports are neither failures nor successes — the command was
|
||||
// superseded or the environment dropped — but they still didn't land, so
|
||||
// they must not read as "imported everything".
|
||||
let imported = 0;
|
||||
let failed = 0;
|
||||
for (const candidate of selection) {
|
||||
const result = await createProject({
|
||||
environmentId,
|
||||
@@ -809,16 +823,18 @@ function ImportStep({ onDone }: { readonly onDone: () => void }) {
|
||||
defaultModelSelection,
|
||||
},
|
||||
});
|
||||
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
|
||||
failures += 1;
|
||||
if (result._tag === "Success") {
|
||||
imported += 1;
|
||||
} else if (!isAtomCommandInterrupted(result)) {
|
||||
failed += 1;
|
||||
}
|
||||
}
|
||||
setIsImporting(false);
|
||||
if (failures > 0) {
|
||||
if (imported < selection.length) {
|
||||
setImportError(
|
||||
failures === selection.length
|
||||
imported === 0
|
||||
? "Import failed. You can add projects manually from the command palette."
|
||||
: `Imported ${selection.length - failures} of ${selection.length} projects. The rest can be added from the command palette.`,
|
||||
: `Imported ${imported} of ${selection.length} projects. The rest can be added from the command palette.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ Installs with existing projects or completed onboarding skip it.
|
||||
- **T3 Connect** — sign in and reach any of your machines from anywhere.
|
||||
Machines signed into your account connect automatically. If none are
|
||||
connected yet, the wizard shows the command to run on the machine with your
|
||||
code (`npx t3 connect`) and advances when it appears.
|
||||
code (`npx t3 connect`); the machine appears in the list once it signs in,
|
||||
and **Continue** becomes available.
|
||||
- **Direct** — connect to a server by URL. Works over LAN and Tailscale. Run
|
||||
`npx t3 pair` on the server and paste the pairing URL it prints.
|
||||
|
||||
@@ -18,10 +19,10 @@ Installs with existing projects or completed onboarding skip it.
|
||||
|
||||
The wizard checks the connected machine for Claude Code and Codex and shows
|
||||
their install and sign-in status. If one is missing, an inline terminal opens
|
||||
with the install command pre-typed — press Enter to run it. It's a real shell,
|
||||
so you can run the CLI's sign-in there too, or use the card's **Sign in**
|
||||
action after the install finishes. Other supported agents are configured in
|
||||
Settings → Providers.
|
||||
with the install command pre-typed — press Enter to run it, then click
|
||||
**Done**. Once the agent is detected, its card offers **Sign in**, which opens
|
||||
a fresh terminal with the CLI's login command ready to run. Other supported
|
||||
agents are configured in Settings → Providers.
|
||||
|
||||
## Import your projects
|
||||
|
||||
|
||||
Reference in new issue
Block a user