mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 02:20:38 +09:00
[codex] Show bundled plugins in plugin manager (#6734)
## Thinking Path > - Paperclip orchestrates AI agents for zero-human companies. > - The plugin system is how Paperclip exposes optional capabilities and integrations without bloating the control plane. > - Operators need the Instance Settings plugin manager to show both installed external plugins and bundled built-in plugins. > - Bundled plugins were available in the server/UI surface but were not represented consistently in the plugin manager list. > - Workspace runtime reuse also needed to stay pinned to the current branch/base so the plugin manager can be validated from the intended checkout. > - This pull request shows bundled plugins in the manager, marks experimental bundled plugins clearly, and tightens runtime/worktree reuse guards. > - The benefit is that operators can discover bundled plugins from the same management screen as installed plugins without stale workspace sessions hiding the latest branch state. ## What Changed - Lists bundled monorepo plugin packages through the plugin routes API, including plugin status and install metadata needed by the UI. - Updates the plugin manager UI/API client to render bundled plugins and display experimental badges based on installed plugin records. - Adds server authorization coverage around plugin routes so board and agent access stay company-scoped. - Guards execution workspace/runtime reuse against stale base refs and defaults new worktrees to the fetched target base. - Expands workspace runtime tests for service reuse, stale workspace prevention, and controlled runtime stops. - Addressed Greptile feedback by respecting `origin/HEAD`, using async cached bundled-plugin discovery, and avoiding duplicated UI experimental plugin lists. ## Verification - `pnpm exec vitest run server/src/__tests__/plugin-routes-authz.test.ts server/src/__tests__/workspace-runtime.test.ts server/src/__tests__/heartbeat-workspace-session.test.ts` - `pnpm --filter @paperclipai/ui typecheck` - `pnpm --filter @paperclipai/plugin-sdk build && pnpm --filter @paperclipai/server typecheck` - `pnpm --filter @paperclipai/server typecheck` - `gh pr checks 6734 --repo paperclipai/paperclip` reports all checks passing on `10e1ba9e0f505637cd913713fb28c2c99ae92011`. - Greptile Review reports 5/5 on `10e1ba9e0f505637cd913713fb28c2c99ae92011`. - Confirmed the branch is rebased onto `public-gh/master` and the PR diff does not include `pnpm-lock.yaml` or `.github/workflows` changes. - UI screenshots were not captured in this PR-creation pass because the available local board runtime is authenticated; the visible UI path is covered by the plugin manager code changes and server/API tests above. ## Risks - Medium risk: this touches shared plugin listing behavior and workspace runtime reuse, so regressions could affect plugin manager visibility or service reuse across execution workspaces. - No database migrations. - No lockfile or GitHub workflow changes. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - OpenAI GPT-5 Codex, coding-agent workflow with shell/tool use in a local Paperclip worktree. Context window not surfaced by the runtime; reasoning mode not externally reported. ## 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 run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] If this change affects the UI, I have included before/after screenshots - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
9aea3e3d35
commit
f0ddd24d61
9 changed files with 609 additions and 93 deletions
|
|
@ -87,6 +87,7 @@ import { logActivity, publishPluginDomainEvent, type LogActivityInput } from "./
|
|||
import {
|
||||
buildWorkspaceReadyComment,
|
||||
cleanupExecutionWorkspaceArtifacts,
|
||||
ensurePersistedExecutionWorkspaceAvailable,
|
||||
ensureRuntimeServicesForRun,
|
||||
persistAdapterManagedRuntimeServices,
|
||||
realizeExecutionWorkspace,
|
||||
|
|
@ -594,6 +595,8 @@ export function mergeExecutionWorkspaceMetadataForPersistence(input: {
|
|||
createdByRuntime: boolean;
|
||||
configSnapshot: Record<string, unknown> | null;
|
||||
shouldReuseExisting: boolean;
|
||||
baseRef: string | null | undefined;
|
||||
baseRefSha: string | null | undefined;
|
||||
}) {
|
||||
const base = {
|
||||
...(input.existingMetadata ?? {}),
|
||||
|
|
@ -601,6 +604,17 @@ export function mergeExecutionWorkspaceMetadataForPersistence(input: {
|
|||
createdByRuntime: input.createdByRuntime,
|
||||
} as Record<string, unknown>;
|
||||
|
||||
const existingSnapshot = parseObject(base.baseRefSnapshot);
|
||||
if (
|
||||
typeof existingSnapshot.resolvedSha !== "string"
|
||||
&& input.baseRefSha
|
||||
) {
|
||||
base.baseRefSnapshot = {
|
||||
baseRef: input.baseRef ?? null,
|
||||
resolvedSha: input.baseRefSha,
|
||||
};
|
||||
}
|
||||
|
||||
if (input.shouldReuseExisting || !input.configSnapshot) {
|
||||
return base;
|
||||
}
|
||||
|
|
@ -624,6 +638,8 @@ export function buildRealizedExecutionWorkspaceFromPersisted(input: {
|
|||
}
|
||||
|
||||
const strategy = input.workspace.strategyType === "git_worktree" ? "git_worktree" : "project_primary";
|
||||
const baseRefSnapshot = parseObject(input.workspace.metadata?.baseRefSnapshot);
|
||||
const baseRefSha = typeof baseRefSnapshot.resolvedSha === "string" ? baseRefSnapshot.resolvedSha : null;
|
||||
return {
|
||||
baseCwd: input.base.baseCwd,
|
||||
source: input.workspace.mode === "shared_workspace" ? "project_primary" : "task_session",
|
||||
|
|
@ -637,6 +653,7 @@ export function buildRealizedExecutionWorkspaceFromPersisted(input: {
|
|||
worktreePath: strategy === "git_worktree" ? (readNonEmptyString(input.workspace.providerRef) ?? cwd) : null,
|
||||
warnings: [],
|
||||
created: false,
|
||||
baseRefSha,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -7229,7 +7246,34 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||
repoRef: resolvedWorkspace.repoRef,
|
||||
} satisfies ExecutionWorkspaceInput;
|
||||
const reusedExecutionWorkspace = shouldReuseExisting && existingExecutionWorkspace
|
||||
? buildRealizedExecutionWorkspaceFromPersisted({
|
||||
? await ensurePersistedExecutionWorkspaceAvailable({
|
||||
base: executionWorkspaceBase,
|
||||
workspace: {
|
||||
mode: existingExecutionWorkspace.mode,
|
||||
strategyType: existingExecutionWorkspace.strategyType,
|
||||
cwd: existingExecutionWorkspace.cwd,
|
||||
providerRef: existingExecutionWorkspace.providerRef,
|
||||
projectId: existingExecutionWorkspace.projectId,
|
||||
projectWorkspaceId: existingExecutionWorkspace.projectWorkspaceId,
|
||||
repoUrl: existingExecutionWorkspace.repoUrl,
|
||||
baseRef: existingExecutionWorkspace.baseRef,
|
||||
branchName: existingExecutionWorkspace.branchName,
|
||||
metadata: existingExecutionWorkspace.metadata as Record<string, unknown> | null,
|
||||
config: {
|
||||
provisionCommand:
|
||||
existingExecutionWorkspace.config?.provisionCommand
|
||||
?? projectExecutionWorkspacePolicy?.workspaceStrategy?.provisionCommand
|
||||
?? null,
|
||||
},
|
||||
},
|
||||
issue: issueRef,
|
||||
agent: {
|
||||
id: agent.id,
|
||||
name: agent.name,
|
||||
companyId: agent.companyId,
|
||||
},
|
||||
recorder: workspaceOperationRecorder,
|
||||
}) ?? buildRealizedExecutionWorkspaceFromPersisted({
|
||||
base: executionWorkspaceBase,
|
||||
workspace: existingExecutionWorkspace,
|
||||
})
|
||||
|
|
@ -7254,6 +7298,8 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
|
|||
createdByRuntime: executionWorkspace.created,
|
||||
configSnapshot,
|
||||
shouldReuseExisting,
|
||||
baseRef: executionWorkspace.repoRef,
|
||||
baseRefSha: executionWorkspace.baseRefSha ?? null,
|
||||
});
|
||||
try {
|
||||
persistedExecutionWorkspace = shouldReuseExisting && existingExecutionWorkspace
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ export interface RealizedExecutionWorkspace extends ExecutionWorkspaceInput {
|
|||
worktreePath: string | null;
|
||||
warnings: string[];
|
||||
created: boolean;
|
||||
baseRefSha?: string | null;
|
||||
}
|
||||
|
||||
export interface RuntimeServiceRef {
|
||||
|
|
@ -524,11 +525,110 @@ async function runGit(args: string[], cwd: string): Promise<string> {
|
|||
return proc.stdout.trim();
|
||||
}
|
||||
|
||||
function formatShortSha(value: string | null | undefined) {
|
||||
return value ? value.slice(0, 12) : "unknown";
|
||||
}
|
||||
|
||||
function gitErrorIncludes(error: unknown, needle: string) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return message.toLowerCase().includes(needle.toLowerCase());
|
||||
}
|
||||
|
||||
function parseRemoteTrackingRef(ref: string): { remote: string; branch: string } | null {
|
||||
const trimmed = ref.trim();
|
||||
const refsRemotesPrefix = "refs/remotes/";
|
||||
const normalized = trimmed.startsWith(refsRemotesPrefix)
|
||||
? trimmed.slice(refsRemotesPrefix.length)
|
||||
: trimmed;
|
||||
const slashIndex = normalized.indexOf("/");
|
||||
if (slashIndex <= 0 || slashIndex === normalized.length - 1) return null;
|
||||
const remote = normalized.slice(0, slashIndex);
|
||||
const branch = normalized.slice(slashIndex + 1);
|
||||
if (!/^[A-Za-z0-9._-]+$/.test(remote)) return null;
|
||||
return { remote, branch };
|
||||
}
|
||||
|
||||
async function refreshRemoteTrackingBaseRef(repoRoot: string, baseRef: string): Promise<string[]> {
|
||||
const remoteTracking = parseRemoteTrackingRef(baseRef);
|
||||
if (!remoteTracking) return [];
|
||||
|
||||
const remoteExists = await runGit(["remote", "get-url", remoteTracking.remote], repoRoot)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
if (!remoteExists) return [];
|
||||
|
||||
try {
|
||||
await runGit([
|
||||
"fetch",
|
||||
"--prune",
|
||||
remoteTracking.remote,
|
||||
`+refs/heads/${remoteTracking.branch}:refs/remotes/${remoteTracking.remote}/${remoteTracking.branch}`,
|
||||
], repoRoot);
|
||||
return [];
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return [`Could not refresh base ref ${baseRef} before preparing the execution workspace: ${message}`];
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveBaseRefSha(repoRoot: string, baseRef: string): Promise<string | null> {
|
||||
return await runGit(["rev-parse", "--verify", `${baseRef}^{commit}`], repoRoot).catch(() => null);
|
||||
}
|
||||
|
||||
function readRecordedBaseRefSha(metadata: Record<string, unknown> | null | undefined): string | null {
|
||||
const snapshot = parseObject(metadata?.baseRefSnapshot);
|
||||
const resolvedSha = snapshot.resolvedSha;
|
||||
return typeof resolvedSha === "string" && resolvedSha.trim().length > 0 ? resolvedSha.trim() : null;
|
||||
}
|
||||
|
||||
export async function inspectExecutionWorkspaceBaseDrift(input: {
|
||||
repoRoot: string;
|
||||
worktreePath: string;
|
||||
branchName: string | null;
|
||||
baseRef: string | null;
|
||||
recordedBaseRefSha?: string | null;
|
||||
skipRefresh?: boolean;
|
||||
}): Promise<{
|
||||
warnings: string[];
|
||||
currentBaseRefSha: string | null;
|
||||
branchBaseRefSha: string | null;
|
||||
}> {
|
||||
const baseRef = input.baseRef?.trim();
|
||||
if (!baseRef) {
|
||||
return { warnings: [], currentBaseRefSha: null, branchBaseRefSha: null };
|
||||
}
|
||||
|
||||
const warnings = input.skipRefresh ? [] : await refreshRemoteTrackingBaseRef(input.repoRoot, baseRef);
|
||||
const currentBaseRefSha = await resolveBaseRefSha(input.repoRoot, baseRef);
|
||||
if (!currentBaseRefSha) {
|
||||
warnings.push(`Could not resolve base ref ${baseRef} while checking execution workspace freshness.`);
|
||||
return { warnings, currentBaseRefSha: null, branchBaseRefSha: null };
|
||||
}
|
||||
|
||||
const branchBaseRefSha = await runGit(["merge-base", "HEAD", baseRef], input.worktreePath).catch(() => null);
|
||||
if (!branchBaseRefSha) {
|
||||
warnings.push(`Could not compare execution workspace ${input.branchName ?? "branch"} against base ref ${baseRef}.`);
|
||||
return { warnings, currentBaseRefSha, branchBaseRefSha: null };
|
||||
}
|
||||
|
||||
if (branchBaseRefSha !== currentBaseRefSha) {
|
||||
const behindCountRaw = await runGit(["rev-list", "--count", `HEAD..${baseRef}`], input.worktreePath).catch(() => "");
|
||||
const behindCount = Number.parseInt(behindCountRaw, 10);
|
||||
const behindText = Number.isFinite(behindCount) && behindCount > 0
|
||||
? `${behindCount} commit${behindCount === 1 ? "" : "s"}`
|
||||
: "newer commits";
|
||||
const recordedText = input.recordedBaseRefSha
|
||||
? `recorded base ${formatShortSha(input.recordedBaseRefSha)}`
|
||||
: `merge-base ${formatShortSha(branchBaseRefSha)}`;
|
||||
warnings.push(
|
||||
`Execution workspace branch ${input.branchName ? `"${input.branchName}"` : "HEAD"} is behind ${baseRef} by ${behindText}: ${recordedText}, current base ${formatShortSha(currentBaseRefSha)}. Refresh or rebase the workspace before relying on recent base-branch fixes.`,
|
||||
);
|
||||
}
|
||||
|
||||
return { warnings, currentBaseRefSha, branchBaseRefSha };
|
||||
}
|
||||
|
||||
|
||||
type GitWorktreeListEntry = {
|
||||
worktree: string;
|
||||
branch: string | null;
|
||||
|
|
@ -597,16 +697,19 @@ async function detectDefaultBranch(repoRoot: string): Promise<string | null> {
|
|||
["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"],
|
||||
repoRoot,
|
||||
);
|
||||
const branch = remoteHead?.startsWith("origin/") ? remoteHead.slice("origin/".length) : remoteHead;
|
||||
if (branch) return branch;
|
||||
if (remoteHead) {
|
||||
await refreshRemoteTrackingBaseRef(repoRoot, remoteHead);
|
||||
if (await resolveBaseRefSha(repoRoot, remoteHead)) return remoteHead;
|
||||
}
|
||||
} catch {
|
||||
// Not set — fall through to heuristic
|
||||
}
|
||||
|
||||
// Fallback: check for common default branch names on the remote
|
||||
for (const candidate of ["main", "master"]) {
|
||||
for (const candidate of ["origin/master", "origin/main", "main", "master"]) {
|
||||
try {
|
||||
await runGit(["rev-parse", "--verify", `refs/remotes/origin/${candidate}`], repoRoot);
|
||||
await refreshRemoteTrackingBaseRef(repoRoot, candidate);
|
||||
await runGit(["rev-parse", "--verify", `${candidate}^{commit}`], repoRoot);
|
||||
return candidate;
|
||||
} catch {
|
||||
// Not found — try next
|
||||
|
|
@ -1003,6 +1106,7 @@ export async function realizeExecutionWorkspace(input: {
|
|||
worktreePath: null,
|
||||
warnings: [],
|
||||
created: false,
|
||||
baseRefSha: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1026,10 +1130,20 @@ export async function realizeExecutionWorkspace(input: {
|
|||
const baseRef = configuredBaseRef
|
||||
?? await detectDefaultBranch(repoRoot)
|
||||
?? "HEAD";
|
||||
const baseRefreshWarnings = await refreshRemoteTrackingBaseRef(repoRoot, baseRef);
|
||||
const currentBaseRefSha = await resolveBaseRefSha(repoRoot, baseRef);
|
||||
|
||||
await fs.mkdir(worktreeParentDir, { recursive: true });
|
||||
|
||||
async function reuseExistingWorktree(reusablePath: string) {
|
||||
const baseDrift = await inspectExecutionWorkspaceBaseDrift({
|
||||
repoRoot,
|
||||
worktreePath: reusablePath,
|
||||
branchName,
|
||||
baseRef,
|
||||
recordedBaseRefSha: null,
|
||||
skipRefresh: true,
|
||||
});
|
||||
if (input.recorder) {
|
||||
await input.recorder.recordOperation({
|
||||
phase: "worktree_prepare",
|
||||
|
|
@ -1039,6 +1153,8 @@ export async function realizeExecutionWorkspace(input: {
|
|||
worktreePath: reusablePath,
|
||||
branchName,
|
||||
baseRef,
|
||||
currentBaseRefSha: baseDrift.currentBaseRefSha,
|
||||
branchBaseRefSha: baseDrift.branchBaseRefSha,
|
||||
created: false,
|
||||
reused: true,
|
||||
},
|
||||
|
|
@ -1066,8 +1182,9 @@ export async function realizeExecutionWorkspace(input: {
|
|||
cwd: reusablePath,
|
||||
branchName,
|
||||
worktreePath: reusablePath,
|
||||
warnings: [],
|
||||
warnings: [...baseRefreshWarnings, ...baseDrift.warnings],
|
||||
created: false,
|
||||
baseRefSha: baseDrift.branchBaseRefSha ?? baseDrift.currentBaseRefSha,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1109,6 +1226,7 @@ export async function realizeExecutionWorkspace(input: {
|
|||
worktreePath,
|
||||
branchName,
|
||||
baseRef,
|
||||
baseRefSha: currentBaseRefSha,
|
||||
created: true,
|
||||
},
|
||||
successMessage: `Created git worktree at ${worktreePath}\n`,
|
||||
|
|
@ -1128,6 +1246,7 @@ export async function realizeExecutionWorkspace(input: {
|
|||
worktreePath,
|
||||
branchName,
|
||||
baseRef,
|
||||
baseRefSha: currentBaseRefSha,
|
||||
created: false,
|
||||
reusedExistingBranch: true,
|
||||
},
|
||||
|
|
@ -1163,8 +1282,9 @@ export async function realizeExecutionWorkspace(input: {
|
|||
cwd: worktreePath,
|
||||
branchName,
|
||||
worktreePath,
|
||||
warnings: [],
|
||||
warnings: baseRefreshWarnings,
|
||||
created: true,
|
||||
baseRefSha: currentBaseRefSha,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1180,6 +1300,7 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
repoUrl: string | null | undefined;
|
||||
baseRef: string | null | undefined;
|
||||
branchName: string | null | undefined;
|
||||
metadata?: Record<string, unknown> | null;
|
||||
config?: {
|
||||
provisionCommand?: string | null;
|
||||
} | null;
|
||||
|
|
@ -1205,15 +1326,26 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
worktreePath: strategy === "git_worktree" ? (input.workspace.providerRef ?? cwd) : null,
|
||||
warnings: [],
|
||||
created: false,
|
||||
baseRefSha: readRecordedBaseRefSha(input.workspace.metadata),
|
||||
};
|
||||
const provisionCommand = asString(input.workspace.config?.provisionCommand, "").trim();
|
||||
|
||||
if (strategy !== "git_worktree") {
|
||||
return realized;
|
||||
}
|
||||
const repoRoot = await runGit(["rev-parse", "--show-toplevel"], input.base.baseCwd);
|
||||
const recordedBaseRefSha = readRecordedBaseRefSha(input.workspace.metadata);
|
||||
if (await directoryExists(cwd)) {
|
||||
const baseDrift = await inspectExecutionWorkspaceBaseDrift({
|
||||
repoRoot,
|
||||
worktreePath: realized.worktreePath ?? cwd,
|
||||
branchName: realized.branchName,
|
||||
baseRef: input.workspace.baseRef ?? input.base.repoRef ?? null,
|
||||
recordedBaseRefSha,
|
||||
});
|
||||
realized.warnings = baseDrift.warnings;
|
||||
realized.baseRefSha = recordedBaseRefSha ?? baseDrift.branchBaseRefSha ?? baseDrift.currentBaseRefSha;
|
||||
if (provisionCommand) {
|
||||
const repoRoot = await runGit(["rev-parse", "--show-toplevel"], input.base.baseCwd);
|
||||
await provisionExecutionWorktree({
|
||||
strategy: {
|
||||
type: "git_worktree",
|
||||
|
|
@ -1232,7 +1364,6 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
return realized;
|
||||
}
|
||||
|
||||
const repoRoot = await runGit(["rev-parse", "--show-toplevel"], input.base.baseCwd);
|
||||
const worktreePath = realized.worktreePath ?? cwd;
|
||||
const branchName = asString(input.workspace.branchName, "").trim();
|
||||
if (!branchName) {
|
||||
|
|
@ -1241,6 +1372,9 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
|
||||
await fs.mkdir(path.dirname(worktreePath), { recursive: true });
|
||||
await runGit(["worktree", "prune"], repoRoot).catch(() => {});
|
||||
const restoreBaseRef = input.workspace.baseRef ?? input.base.repoRef ?? null;
|
||||
const restoreRefreshWarnings = restoreBaseRef ? await refreshRemoteTrackingBaseRef(repoRoot, restoreBaseRef) : [];
|
||||
const restoreCurrentBaseRefSha = restoreBaseRef ? await resolveBaseRefSha(repoRoot, restoreBaseRef) : null;
|
||||
|
||||
let created = false;
|
||||
try {
|
||||
|
|
@ -1253,6 +1387,7 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
worktreePath,
|
||||
branchName,
|
||||
baseRef: input.workspace.baseRef ?? input.base.repoRef ?? null,
|
||||
currentBaseRefSha: restoreCurrentBaseRefSha,
|
||||
created: false,
|
||||
restored: true,
|
||||
},
|
||||
|
|
@ -1268,6 +1403,7 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
throw error;
|
||||
}
|
||||
const baseRef = input.workspace.baseRef ?? await detectDefaultBranch(repoRoot) ?? "HEAD";
|
||||
const recreatedBaseRefSha = await resolveBaseRefSha(repoRoot, baseRef);
|
||||
await recordGitOperation(input.recorder, {
|
||||
phase: "worktree_prepare",
|
||||
args: ["worktree", "add", "-b", branchName, worktreePath, baseRef],
|
||||
|
|
@ -1277,6 +1413,7 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
worktreePath,
|
||||
branchName,
|
||||
baseRef,
|
||||
baseRefSha: recreatedBaseRefSha,
|
||||
created: true,
|
||||
restored: true,
|
||||
},
|
||||
|
|
@ -1286,6 +1423,15 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
created = true;
|
||||
}
|
||||
|
||||
const baseDrift = await inspectExecutionWorkspaceBaseDrift({
|
||||
repoRoot,
|
||||
worktreePath,
|
||||
branchName,
|
||||
baseRef: input.workspace.baseRef ?? input.base.repoRef ?? null,
|
||||
recordedBaseRefSha,
|
||||
skipRefresh: true,
|
||||
});
|
||||
|
||||
await provisionExecutionWorktree({
|
||||
strategy: {
|
||||
type: "git_worktree",
|
||||
|
|
@ -1305,7 +1451,12 @@ export async function ensurePersistedExecutionWorkspaceAvailable(input: {
|
|||
...realized,
|
||||
cwd: worktreePath,
|
||||
worktreePath,
|
||||
warnings: [...restoreRefreshWarnings, ...baseDrift.warnings],
|
||||
created,
|
||||
baseRefSha:
|
||||
recordedBaseRefSha
|
||||
?? (created ? restoreCurrentBaseRefSha : baseDrift.branchBaseRefSha)
|
||||
?? baseDrift.currentBaseRefSha,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue