fix wrong herdr response parse + add labels and branch names to delegations
CI / verify (pull_request) Failing after 8s
CI / verify (pull_request) Failing after 8s
This commit is contained in:
@@ -18,14 +18,26 @@ class FixtureHerdr extends Herdr {
|
||||
verified = 0;
|
||||
delayCreation = false;
|
||||
creationAborted = false;
|
||||
createdBase: string | undefined;
|
||||
createdBranch: string | undefined;
|
||||
createdLabel: string | undefined;
|
||||
creationStarted = Promise.withResolvers<void>();
|
||||
override async root(directory: string) {
|
||||
return this.eligible && directory === "/root"
|
||||
? { directory, workspaceID: "w1", repo: "/root/.git" }
|
||||
: undefined;
|
||||
}
|
||||
override async create(_root: HerdrRoot, _base: string, branch: string, signal: AbortSignal) {
|
||||
override async create(
|
||||
_root: HerdrRoot,
|
||||
base: string,
|
||||
branch: string,
|
||||
signal: AbortSignal,
|
||||
label?: string,
|
||||
) {
|
||||
this.creations++;
|
||||
this.createdBase = base;
|
||||
this.createdBranch = branch;
|
||||
this.createdLabel = label;
|
||||
if (!this.eligible) throw new Error("root closed");
|
||||
if (this.delayCreation) {
|
||||
this.creationStarted.resolve();
|
||||
@@ -295,7 +307,13 @@ const request = z.object({
|
||||
agent: z.string(),
|
||||
description: z.string(),
|
||||
prompt: z.string(),
|
||||
worktree: z.object({ base: z.string() }).optional(),
|
||||
worktree: z
|
||||
.object({
|
||||
base: z.string(),
|
||||
branch: z.string().optional(),
|
||||
label: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
sessionID: z.string().optional(),
|
||||
background: z.boolean().optional(),
|
||||
});
|
||||
@@ -348,6 +366,83 @@ test("local fast-lo uses native delegation without a worktree", async () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("custom branch and workspace label pass through delegation", async () => {
|
||||
const f = fixture();
|
||||
await Effect.runPromise(
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
yield* f.install;
|
||||
const result = yield* f.execute({
|
||||
agent: "coordinate",
|
||||
description: "Fix login timeout",
|
||||
prompt: "work",
|
||||
worktree: {
|
||||
base: "main",
|
||||
branch: "fix/login-timeout",
|
||||
label: "Fix login timeout",
|
||||
},
|
||||
});
|
||||
expect(f.herdr.createdBase).toBe("main");
|
||||
expect(f.herdr.createdBranch).toBe("fix/login-timeout");
|
||||
expect(f.herdr.createdLabel).toBe("Fix login timeout");
|
||||
expect(result.metadata?.branch).toBe("fix/login-timeout");
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test("omitted naming retains generated branch and no explicit label", async () => {
|
||||
const f = fixture();
|
||||
await Effect.runPromise(
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
yield* f.install;
|
||||
yield* f.invoke();
|
||||
expect(f.herdr.createdBranch).toMatch(/^multi-work\/[0-9a-f-]{36}$/);
|
||||
expect(f.herdr.createdLabel).toBeUndefined();
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test("rejects empty naming fields and naming on resume", async () => {
|
||||
const f = fixture();
|
||||
await Effect.runPromise(
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
yield* f.install;
|
||||
for (const worktree of [
|
||||
{ base: "main", branch: " " },
|
||||
{ base: "main", label: " " },
|
||||
])
|
||||
expect(
|
||||
(yield* Effect.exit(
|
||||
f.execute({
|
||||
agent: "coordinate",
|
||||
description: "invalid",
|
||||
prompt: "work",
|
||||
worktree,
|
||||
}),
|
||||
))._tag,
|
||||
).toBe("Failure");
|
||||
yield* f.invoke();
|
||||
expect(
|
||||
(yield* Effect.exit(
|
||||
f.execute({
|
||||
agent: "coordinate",
|
||||
description: "resume",
|
||||
prompt: "work",
|
||||
sessionID: "ses_child1",
|
||||
worktree: { base: "main", branch: "fix/other" },
|
||||
}),
|
||||
))._tag,
|
||||
).toBe("Failure");
|
||||
expect(f.herdr.creations).toBe(1);
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test("root loss, session permission denial and missing destination fail before prompting", async () => {
|
||||
for (const failure of ["root", "permission", "ask", "destination", "project"] as const) {
|
||||
const f = fixture();
|
||||
|
||||
Reference in New Issue
Block a user