fix(runner): complete live hot restart adoption (#12852)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Paperclip Runner owns durable provider sessions and streams their
work to the control plane.
> - Pull request #12845 added native restart recovery for live and dead
local runners.
> - A real browser test found three live-adoption gaps after that pull
request merged.
> - Lazy runner process ownership was not always stored before restart.
> - The old controller did not release its PRP authority without closing
the provider turn.
> - Reconnect events could arrive before the active provider turn was
restored.
> - This pull request closes those gaps and proves the same turn
completes after a UI hot restart.

## Linked Issues or Issue Description

Refs #12845

Related search results: #12646 covers indeterminate command results
after a runner restart. It does not cover controller adoption or
active-turn rebinding. No open duplicate pull request was found.

## What Changed

- Store lazy runnerd process ownership after provider session creation,
read, and resume.
- Detach native PRP controller authority during coordinated hot
shutdown. Keep the live provider turn running.
- Restore the exact checkpointed provider session when bounded PRP
identity events have been compacted.
- Restore the active provider turn before reconnect events are replayed.
This prevents `turn_binding_mismatch`.
- Keep exact live ownership by the current controller out of generic
orphan recovery.
- Add driver, transport, and server regression tests for these paths.

## Verification

- Ran 12 Codex driver lifecycle tests.
- Ran 53 runnerd transport tests.
- Ran 143 recovery and orphan-reaper server tests.
- Ran all 8 real-process restart recovery scenarios.
- Ran all 96 existing runner E2E unit tests.
- Ran runner TypeScript typecheck.
- Ran server TypeScript typecheck.
- Ran the migration replay test and migration safety checks.
- Tested the board UI on an isolated local instance. A real local
Codex-backed turn entered a 120-second terminal wait. The UI `Restart
now` action replaced the server and kept the same runner PID, process
start time, run ID, native session ID, runner ID, provider session ID,
and active turn. The original turn then completed.
- Confirmed one heartbeat run, no retry row, one result, one
proposed-result event, one terminal event, no protocol errors, no active
recovery state, and no surviving runner or provider process.

## Risks

- A live runner can continue provider work while no server owns the
control route. Recovery fails closed when the process fingerprint or
durable identity is ambiguous.
- Provider identity can be restored from the database only for an exact
verified adoption claim. An authenticated live `session.snapshot`
validates that identity before the driver can resume.
- The new detach path applies only to native sessions that expose
restart detachment. Other adapters keep their existing shutdown
behavior.
- This follow-up does not change the database migration or
`package.json`. The migration in #12845 remains replay-safe through `ADD
COLUMN IF NOT EXISTS` and its embedded-Postgres idempotence test. The
dedicated real-process command remains in `doc/DEVELOPING.md`.

## Model Used

- OpenAI Codex based on GPT-5. The exact serving build and
context-window size are not exposed. The run used extended reasoning,
repository tools, shell execution, and in-app browser automation.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change and contains no internal
Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
This commit is contained in:
Dotta authored and GitHub committed 2026-09-04 17:54:44 -05:00
1 parent bb920fb859
commit 263f181fed
20 files changed
+1040 -321

No files matched your search

@@ -117,6 +117,7 @@ import {
redactDetectedSuccessfulRunProgressSummaryForBoard,
redactSuccessfulRunHandoffEvidence,
} from "../services/heartbeat.ts";
import { currentNativeControllerIdentity } from "../services/native-runtime/native-restart-recovery.ts";
import {
readHotRestartIntent,
readProcessStartedAt,
@@ -1445,6 +1446,48 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
expect(wakeup?.status).toBe("claimed");
});
it("keeps a live native run owned by the current controller out of ambiguous recovery", async () => {
const child = spawnAliveProcess();
childProcesses.add(child);
expect(child.pid).toBeTypeOf("number");
const { companyId, runId, issueId } = await seedRunFixture({
adapterType: "paperclip_runner",
runtimeMode: "native",
processPid: child.pid ?? null,
});
const controller = await currentNativeControllerIdentity();
await db
.update(heartbeatRuns)
.set({ nativeIssueId: issueId, nativePhase: "observed" })
.where(eq(heartbeatRuns.id, runId));
await db.insert(nativeRunFinalizations).values({
runId,
companyId,
issueId,
phase: "observed",
attempt: 1,
leaseOwner: "current-controller:test",
leaseExpiresAt: new Date(Date.now() + 60_000),
controllerBootId: controller.bootId,
controllerPid: controller.pid,
controllerProcessStartedAt: controller.processStartedAt,
controllerGeneration: 1,
});
const heartbeat = heartbeatService(db);
const result = await heartbeat.reapOrphanedRuns();
expect(result).toEqual({ reaped: 0, runIds: [] });
expect(await heartbeat.getRun(runId)).toMatchObject({
status: "running",
error: null,
errorCode: null,
processPid: child.pid,
});
expect(mockTerminateLocalService).not.toHaveBeenCalled();
});
it("does not reap a retryable native run while its same-run recovery path owns it", async () => {
const { companyId, agentId, runId, issueId, wakeupRequestId } =
await seedRunFixture({
@@ -2577,12 +2620,11 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
});
it("suspends native Paperclip Runner ownership on graceful restart without cancelling or creating a retry run", async () => {
const { agentId, runId, issueId, wakeupRequestId } =
await seedRunFixture({
adapterType: "paperclip_runner",
agentStatus: "running",
runtimeMode: "native",
});
const { agentId, runId, issueId, wakeupRequestId } = await seedRunFixture({
adapterType: "paperclip_runner",
agentStatus: "running",
runtimeMode: "native",
});
await db
.update(heartbeatRuns)
.set({ nativeIssueId: issueId })
+77 -48
View File
@@ -128,7 +128,9 @@ import {
buildNativeRuntimeContext,
cancelNativeSession,
claimNativeRestartRecoveries,
currentNativeControllerIdentity,
dispatchNativeSessionResumptions,
detachNativeSessionsForRestart,
ensureNativeCompletionContract,
executePaperclipNativeSession,
finalizeNativeRun,
@@ -12544,11 +12546,22 @@ export function heartbeatService(
});
}
const nativeRunIds = activeRuns
.filter(
({ run, adapterType }) =>
adapterType === "paperclip_runner" &&
isNativeSessionId(run.nativeSessionId),
)
.map(({ run }) => run.id);
const detachedNativeSessions =
await detachNativeSessionsForRestart(nativeRunIds);
logger.info(
{
signal,
previousServerPid: intent.previousServerPid,
activeRunIds: snapshotRuns.map((run) => run.runId),
detachedNativeSessions,
},
"hot-restart shutdown snapshot captured; skipping graceful run drain",
);
@@ -12719,10 +12732,7 @@ export function heartbeatService(
continue;
}
if (
run.runtimeMode === "native" &&
adapterType === "paperclip_runner"
) {
if (run.runtimeMode === "native" && adapterType === "paperclip_runner") {
classify(candidate, "skipped", "native_restart_recovery_owned", patch);
continue;
}
@@ -12987,7 +12997,9 @@ export function heartbeatService(
);
});
activeRunExecutionPromises.add(execution);
void execution.finally(() => activeRunExecutionPromises.delete(execution));
void execution.finally(() =>
activeRunExecutionPromises.delete(execution),
);
}
return {
@@ -16965,6 +16977,11 @@ export function heartbeatService(
adapterConfig: agents.adapterConfig,
nativeCoordinatorPhase: nativeRunFinalizations.phase,
nativeRecoveryState: nativeRunFinalizations.recoveryState,
nativeControllerBootId: nativeRunFinalizations.controllerBootId,
nativeControllerPid: nativeRunFinalizations.controllerPid,
nativeControllerProcessStartedAt:
nativeRunFinalizations.controllerProcessStartedAt,
nativeControllerLeaseExpiresAt: nativeRunFinalizations.leaseExpiresAt,
})
.from(heartbeatRuns)
.innerJoin(agents, eq(heartbeatRuns.agentId, agents.id))
@@ -17004,6 +17021,7 @@ export function heartbeatService(
);
const reaped: string[] = [];
const currentNativeController = await currentNativeControllerIdentity();
for (const {
run,
@@ -17011,6 +17029,10 @@ export function heartbeatService(
adapterConfig,
nativeCoordinatorPhase,
nativeRecoveryState,
nativeControllerBootId,
nativeControllerPid,
nativeControllerProcessStartedAt,
nativeControllerLeaseExpiresAt,
} of activeRuns) {
const nativeRun = run.runtimeMode === "native";
const nativeProcessPidAlive =
@@ -17019,19 +17041,27 @@ export function heartbeatService(
nativeRun &&
!!run.processGroupId &&
isProcessGroupAlive(run.processGroupId);
const coordinatorOwnedByCurrentController =
nativeRun &&
nativeControllerBootId === currentNativeController.bootId &&
nativeControllerPid === currentNativeController.pid &&
nativeControllerProcessStartedAt?.getTime() ===
currentNativeController.processStartedAt.getTime() &&
!!nativeControllerLeaseExpiresAt &&
nativeControllerLeaseExpiresAt.getTime() > now.getTime();
const locallyTracked =
runningProcesses.has(run.id) || activeRunExecutions.has(run.id);
runningProcesses.has(run.id) ||
activeRunExecutions.has(run.id) ||
coordinatorOwnedByCurrentController;
if (
nativeRun &&
(
[
"awaiting_evidence",
"awaiting_runner_reattach",
"resuming_session",
"bootstrap_incomplete",
].includes(nativeRecoveryState ?? "") ||
nativeCoordinatorPhase === "retryable_failure"
)
([
"awaiting_evidence",
"awaiting_runner_reattach",
"resuming_session",
"bootstrap_incomplete",
].includes(nativeRecoveryState ?? "") ||
nativeCoordinatorPhase === "retryable_failure")
) {
continue;
}
@@ -17050,9 +17080,10 @@ export function heartbeatService(
// intentionally precedes resumedRunIds so a claim cannot bypass the
// ownership check.
if (
nativeProcessPidAlive ||
nativeProcessGroupAlive ||
observedOwnerUnverified
!locallyTracked &&
(nativeProcessPidAlive ||
nativeProcessGroupAlive ||
observedOwnerUnverified)
) {
await markNativeOwnershipUnverified(run, {
reason:
@@ -20180,30 +20211,29 @@ export function heartbeatService(
// recovery existed. Only an entirely unused replacement row may
// inherit its source checkpoint; any process/provider evidence on the
// replacement makes the ownership ambiguous and therefore ineligible.
const legacyRetrySource =
run.retryOfRunId
? await db
.select({
id: heartbeatRuns.id,
companyId: heartbeatRuns.companyId,
agentId: heartbeatRuns.agentId,
runnerInstanceId: heartbeatRuns.runnerInstanceId,
nativeSessionId: heartbeatRuns.nativeSessionId,
runnerProfileJson: heartbeatRuns.runnerProfileJson,
runtimeMode: heartbeatRuns.runtimeMode,
status: heartbeatRuns.status,
})
.from(heartbeatRuns)
.where(
and(
eq(heartbeatRuns.id, run.retryOfRunId),
eq(heartbeatRuns.companyId, agent.companyId),
eq(heartbeatRuns.agentId, agent.id),
),
)
.limit(1)
.then((rows) => rows[0] ?? null)
: null;
const legacyRetrySource = run.retryOfRunId
? await db
.select({
id: heartbeatRuns.id,
companyId: heartbeatRuns.companyId,
agentId: heartbeatRuns.agentId,
runnerInstanceId: heartbeatRuns.runnerInstanceId,
nativeSessionId: heartbeatRuns.nativeSessionId,
runnerProfileJson: heartbeatRuns.runnerProfileJson,
runtimeMode: heartbeatRuns.runtimeMode,
status: heartbeatRuns.status,
})
.from(heartbeatRuns)
.where(
and(
eq(heartbeatRuns.id, run.retryOfRunId),
eq(heartbeatRuns.companyId, agent.companyId),
eq(heartbeatRuns.agentId, agent.id),
),
)
.limit(1)
.then((rows) => rows[0] ?? null)
: null;
const legacyRetryHasProviderEvidence = legacyRetrySource
? await db
.select({ id: heartbeatRunEvents.id })
@@ -20233,18 +20263,17 @@ export function heartbeatService(
})
? legacyRetrySource
: null;
const legacyRetrySessionId = compatibleLegacyRetrySource
?.nativeSessionId;
const legacyRetrySessionId =
compatibleLegacyRetrySource?.nativeSessionId;
const taskResumeRunId =
taskSessionForRun?.lastRunId &&
taskSessionForRun.lastRunId !== run.id &&
isNativeSessionId(taskNativeSessionId)
? taskSessionForRun.lastRunId
: null;
const resumableTaskSessionId =
taskResumeRunId
? taskNativeSessionId
: legacyRetrySessionId ?? null;
const resumableTaskSessionId = taskResumeRunId
? taskNativeSessionId
: (legacyRetrySessionId ?? null);
const priorNativeRunId =
taskResumeRunId ?? compatibleLegacyRetrySource?.id ?? null;
const previousNativeRun =
@@ -32,7 +32,13 @@ type BackendFactoryOptions = {
runnerInstanceId?: string;
acpxRuntimeDirectory?: string;
workingDirectoryAuthority?: "local_filesystem" | "remote_runner";
codexTransportFactory?: () => unknown;
codexTransportFactory?: (recoveryContext?: {
persistedSession?: {
driverSessionId: string;
providerSessionId?: string | null;
activeTurnId?: string | null;
};
}) => unknown;
dynamicToolHandler?: (call: unknown) => Promise<unknown>;
onSpawn?: (meta: {
pid: number;
@@ -53,6 +59,12 @@ type RunnerTransportOptions = {
opencodePermissionMode?: "allow" | "ask" | "deny";
acpxAgent?: "claude" | "codex";
acpxPermissionMode?: "approve-all" | "approve-reads" | "deny-all";
resumeActiveTurnId?: string | null;
resumeProviderSession?: {
driverSessionId: string;
providerSessionId?: string | null;
activeTurnId?: string | null;
};
};
const durableControlPlaneState = (identity: Record<string, unknown>) => ({
@@ -2339,6 +2351,100 @@ describe("native session same-turn steering", () => {
});
describe("native warm session supervision", () => {
it("preserves the active turn when a warm checkpoint resumes the same run", async () => {
const stateBase = await mkdtemp(
join(tmpdir(), "paperclip-warm-same-run-recovery-"),
);
const previousPaperclipHome = process.env.PAPERCLIP_HOME;
process.env.PAPERCLIP_HOME = stateBase;
const activeRun = {
...execution,
binding: {
...execution.binding,
runId: "run-warm-same-run-recovery",
executionWorkspaceId: "workspace-warm-same-run-recovery",
},
session: {
...execution.session,
normalizedSessionId: "session-warm-same-run-recovery",
lifecyclePolicy: { mode: "warm" as const, idleTimeoutMs: 20 },
},
} as NativeExecutionInputV1;
const checkpoint = {
identity: {
runId: activeRun.binding.runId,
sessionId: activeRun.session.normalizedSessionId,
companyId: activeRun.binding.companyId,
issueId: activeRun.binding.issueId,
agentId: activeRun.binding.agentId,
},
sessionId: activeRun.session.normalizedSessionId,
driverSessionId: "driver-warm-same-run-recovery",
providerSessionId: "provider-warm-same-run-recovery",
activeTurnId: "provider-turn-warm-same-run-recovery",
semanticResult: null,
terminal: null,
terminalTurns: [],
pendingRuntimeRequests: [],
};
const result = {
result: { summary: "completed" },
terminal: { runTerminalState: "succeeded" },
turnId: checkpoint.activeTurnId,
normalizedSessionId: activeRun.session.normalizedSessionId,
providerSessionId: checkpoint.providerSessionId,
driverKind: "test",
driverVersion: "1",
nativeEventCount: 1,
highestContiguousSourceSeq: 1,
usage: null,
};
const firstClose = vi.fn(async () => undefined);
state.execute
.mockReset()
.mockImplementationOnce(async (options) => {
await options.onCheckpoint?.(checkpoint);
options.onSession?.({ close: firstClose });
return result;
})
.mockImplementationOnce(async (options) => {
expect(options.persistedSession).toEqual(
expect.objectContaining({
identity: checkpoint.identity,
driverSessionId: checkpoint.driverSessionId,
providerSessionId: checkpoint.providerSessionId,
activeTurnId: checkpoint.activeTurnId,
}),
);
return result;
});
try {
await executePaperclipNativeSession({
db: leaseDb(activeRun),
execution: activeRun,
runnerInstanceId: "runner-warm-same-run-recovery",
});
await vi.waitFor(() => expect(firstClose).toHaveBeenCalled(), {
timeout: 500,
});
await expect(
executePaperclipNativeSession({
db: leaseDb(activeRun),
execution: activeRun,
runnerInstanceId: "runner-warm-same-run-recovery",
}),
).resolves.toBeDefined();
} finally {
if (previousPaperclipHome === undefined) {
delete process.env.PAPERCLIP_HOME;
} else {
process.env.PAPERCLIP_HOME = previousPaperclipHome;
}
await rm(stateBase, { recursive: true, force: true });
}
});
it("reuses one session across distinct governed runs and closes it after idle expiry", async () => {
const close = vi.fn(async () => undefined);
const sharedSession = { close };
@@ -2470,6 +2576,7 @@ describe("native warm session supervision", () => {
agentId: first.binding.agentId,
},
providerSessionId: "provider-runnerd-warm",
activeTurnId: "provider-turn-runnerd-warm-first",
});
options.onSession?.(firstSession);
return result;
@@ -2483,6 +2590,7 @@ describe("native warm session supervision", () => {
sessionId: second.session.normalizedSessionId,
}),
providerSessionId: "provider-runnerd-warm",
activeTurnId: null,
}),
);
options.onSession?.(secondSession);
@@ -3031,6 +3139,36 @@ describe("runnerd provider runtime wiring", () => {
await rm(isolatedStateDirectory, { recursive: true, force: true });
});
it("passes the run checkpoint active turn into restart recovery", async () => {
state.createBackend.mockClear();
state.createTransport.mockClear();
await createRunnerdBackend({
db: leaseDb(execution),
execution,
runnerInstanceId: "runner-active-turn-recovery",
});
state.createTransport.mockClear();
state.createBackend.mock.calls[0]![1].codexTransportFactory!({
persistedSession: {
driverSessionId: "driver-session-active-turn",
providerSessionId: "provider-session-active-turn",
activeTurnId: "provider-turn-active",
},
});
expect(state.createTransport).toHaveBeenCalledWith(
expect.objectContaining({
resumeActiveTurnId: "provider-turn-active",
resumeProviderSession: expect.objectContaining({
driverSessionId: "driver-session-active-turn",
providerSessionId: "provider-session-active-turn",
activeTurnId: "provider-turn-active",
}),
}),
);
});
it("rejects overlapping runs for the same runnerd provider session scope", async () => {
const first = {
...execution,
@@ -120,6 +120,32 @@ export class NativeCancellationPendingRecoveryError extends Error {
}
const activeNativeSessions = new Map<string, ActiveNativeSession>();
export async function detachNativeSessionsForRestart(
runIds: readonly string[],
): Promise<{
detachedRunIds: string[];
inactiveRunIds: string[];
unsupportedRunIds: string[];
}> {
const detachedRunIds: string[] = [];
const inactiveRunIds: string[] = [];
const unsupportedRunIds: string[] = [];
for (const runId of new Set(runIds)) {
const active = activeNativeSessions.get(runId);
if (!active) {
inactiveRunIds.push(runId);
continue;
}
if (active.session.detachControllerForRestart === undefined) {
unsupportedRunIds.push(runId);
continue;
}
await active.session.detachControllerForRestart();
detachedRunIds.push(runId);
}
return { detachedRunIds, inactiveRunIds, unsupportedRunIds };
}
const MAX_REMOTE_CHECKPOINT_ARCHIVE_BYTES = 64 * 1024 * 1024;
const MAX_REMOTE_CHECKPOINT_EXPANDED_BYTES = 64 * 1024 * 1024;
const MAX_REMOTE_CHECKPOINT_ENTRIES = 20_000;
@@ -1524,7 +1550,11 @@ async function migrateRunnerdStateRootForExecution(input: {
export function runnerdStateProvesIncompleteBootstrap(root: string): boolean {
try {
const statePath = resolve(root, "control-plane", "control-plane-state.json");
const statePath = resolve(
root,
"control-plane",
"control-plane-state.json",
);
const state = record(
JSON.parse(
readBoundedNativeFile(
@@ -2158,21 +2188,29 @@ function loadWarmNativeCheckpoint(
) {
throw new Error("native_session_supervisor_checkpoint_mismatch");
}
const resumed = {
...envelope.snapshot,
identity: {
runId: execution.binding.runId,
sessionId: nativeSessionKey(execution),
companyId: execution.binding.companyId,
issueId: execution.binding.issueId,
agentId: execution.binding.agentId,
},
semanticResult: null,
terminal: null,
activeTurnId: null,
terminalTurns: [],
pendingRuntimeRequests: [],
};
const sameRunRecovery =
persistedIdentity.runId === execution.binding.runId &&
persistedIdentity.issueId === execution.binding.issueId;
const resumed = sameRunRecovery
? structuredClone(envelope.snapshot)
: {
...envelope.snapshot,
identity: {
runId: execution.binding.runId,
sessionId: nativeSessionKey(execution),
companyId: execution.binding.companyId,
issueId: execution.binding.issueId,
agentId: execution.binding.agentId,
},
// A warm provider can be rebound only after the previous run settled.
// Its provider identity survives, but run-scoped turn, result, and
// request authority must not cross into the new heartbeat run.
semanticResult: null,
terminal: null,
activeTurnId: null,
terminalTurns: [],
pendingRuntimeRequests: [],
};
if (path !== scopedPath) {
// Copy the validated legacy checkpoint into the fully scoped location.
// persistWarmNativeCheckpoint uses an atomic rename and leaving the old
@@ -3174,7 +3212,8 @@ export async function renewNativeSessionExecutionLease(input: {
controller?: NativeControllerIdentity;
leaseTtlMs?: number;
}): Promise<void> {
const controller = input.controller ?? (await currentNativeControllerIdentity());
const controller =
input.controller ?? (await currentNativeControllerIdentity());
const leaseTtlMs = input.leaseTtlMs ?? NATIVE_SESSION_EXECUTION_LEASE_TTL_MS;
if (
!Number.isInteger(leaseTtlMs) ||
@@ -6887,13 +6926,13 @@ async function createRunnerdBackendWithinSessionClaim(
runnerProcessLauncher: remoteProcessLauncher,
runnerReconnectGraceMs: remoteTarget ? 120_000 : undefined,
adoptExistingRunner: adoptedProcess
? {
...adoptedProcess,
isAlive: () => verifiedRecoveryProcessIsAlive(adoptedProcess),
signal: (signal) =>
signalVerifiedRecoveryProcess(adoptedProcess, signal),
}
: undefined,
? {
...adoptedProcess,
isAlive: () => verifiedRecoveryProcessIsAlive(adoptedProcess),
signal: (signal) =>
signalVerifiedRecoveryProcess(adoptedProcess, signal),
}
: undefined,
environment: effectiveRunnerEnvironment,
lifecyclePolicy: input.execution.session.lifecyclePolicy,
runtimeContext:
@@ -6913,6 +6952,9 @@ async function createRunnerdBackendWithinSessionClaim(
(criterion) => criterion.id,
),
},
resumeActiveTurnId:
recoveryContext?.persistedSession?.activeTurnId ?? null,
resumeProviderSession: recoveryContext?.persistedSession,
providerRecoveryPolicy:
recoveryContext?.providerRecoveryPolicy ??
(input.execution.provider.kind === "acpx" &&