mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
fix(recovery): stabilize delegated reuse response
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
ba86e74dd3
commit
1ca659d9e9
2 files changed
+10
-7
No files matched your search
@@ -1441,6 +1441,10 @@ describeEmbeddedPostgres("issue recovery actions", () => {
|
||||
|
||||
expect(second.body).toMatchObject({
|
||||
reused: true,
|
||||
issue: {
|
||||
id: sourceIssueId,
|
||||
activeRecoveryAction: null,
|
||||
},
|
||||
recoveryIssue: {
|
||||
id: first.body.recoveryIssue.id,
|
||||
},
|
||||
|
||||
@@ -4347,11 +4347,7 @@ export function issueRoutes(
|
||||
return false;
|
||||
}
|
||||
|
||||
async function resolveDelegatedRecoveryTargetAgentId(companyId: string, target: "ceo") {
|
||||
if (target !== "ceo") {
|
||||
throw unprocessable("Unsupported delegated recovery target");
|
||||
}
|
||||
|
||||
async function resolveDelegatedRecoveryTargetAgentId(companyId: string) {
|
||||
const ceoCandidates = await db
|
||||
.select({
|
||||
id: agents.id,
|
||||
@@ -5753,7 +5749,10 @@ export function issueRoutes(
|
||||
const recoveryIssue = await svc.getById(resolvedAction.recoveryIssueId);
|
||||
if (recoveryIssue && recoveryIssue.companyId === existing.companyId) {
|
||||
res.json({
|
||||
issue: existing,
|
||||
issue: {
|
||||
...existing,
|
||||
activeRecoveryAction: null,
|
||||
},
|
||||
recoveryIssue,
|
||||
recoveryAction: resolvedAction,
|
||||
reused: true,
|
||||
@@ -5778,7 +5777,7 @@ export function issueRoutes(
|
||||
}
|
||||
|
||||
const actor = getActorInfo(req);
|
||||
const assigneeAgentId = await resolveDelegatedRecoveryTargetAgentId(existing.companyId, target);
|
||||
const assigneeAgentId = await resolveDelegatedRecoveryTargetAgentId(existing.companyId);
|
||||
await assertCanAssignTasks(req, existing.companyId, {
|
||||
projectId: await resolveAssignmentProjectId({
|
||||
companyId: existing.companyId,
|
||||
|
||||
Reference in new issue
Block a user