2026-03-24 08:11:09 -05:00
|
|
|
import express from "express";
|
|
|
|
|
import request from "supertest";
|
|
|
|
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
|
|
|
|
|
|
const mockIssueService = vi.hoisted(() => ({
|
|
|
|
|
getById: vi.fn(),
|
|
|
|
|
getAncestors: vi.fn(),
|
2026-04-04 13:56:04 -05:00
|
|
|
getRelationSummaries: vi.fn(),
|
2026-03-24 08:11:09 -05:00
|
|
|
findMentionedProjectIds: vi.fn(),
|
|
|
|
|
getCommentCursor: vi.fn(),
|
|
|
|
|
getComment: vi.fn(),
|
2026-04-03 01:53:57 +09:00
|
|
|
listAttachments: vi.fn(),
|
2026-03-24 08:11:09 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const mockProjectService = vi.hoisted(() => ({
|
|
|
|
|
getById: vi.fn(),
|
|
|
|
|
listByIds: vi.fn(),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
const mockGoalService = vi.hoisted(() => ({
|
|
|
|
|
getById: vi.fn(),
|
|
|
|
|
getDefaultCompanyGoal: vi.fn(),
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
vi.mock("../services/index.js", () => ({
|
|
|
|
|
accessService: () => ({
|
|
|
|
|
canUser: vi.fn(),
|
|
|
|
|
hasPermission: vi.fn(),
|
|
|
|
|
}),
|
|
|
|
|
agentService: () => ({
|
|
|
|
|
getById: vi.fn(),
|
|
|
|
|
}),
|
|
|
|
|
documentService: () => ({
|
|
|
|
|
getIssueDocumentPayload: vi.fn(async () => ({})),
|
|
|
|
|
}),
|
|
|
|
|
executionWorkspaceService: () => ({
|
|
|
|
|
getById: vi.fn(),
|
|
|
|
|
}),
|
2026-04-02 09:11:49 -05:00
|
|
|
feedbackService: () => ({
|
|
|
|
|
listIssueVotesForUser: vi.fn(async () => []),
|
|
|
|
|
saveIssueVote: vi.fn(async () => ({ vote: null, consentEnabledNow: false, sharingEnabled: false })),
|
|
|
|
|
}),
|
2026-03-24 08:11:09 -05:00
|
|
|
goalService: () => mockGoalService,
|
|
|
|
|
heartbeatService: () => ({
|
|
|
|
|
wakeup: vi.fn(async () => undefined),
|
|
|
|
|
reportRunActivity: vi.fn(async () => undefined),
|
|
|
|
|
}),
|
2026-04-02 09:11:49 -05:00
|
|
|
instanceSettingsService: () => ({
|
|
|
|
|
get: vi.fn(async () => ({
|
|
|
|
|
id: "instance-settings-1",
|
|
|
|
|
general: {
|
|
|
|
|
censorUsernameInLogs: false,
|
|
|
|
|
feedbackDataSharingPreference: "prompt",
|
|
|
|
|
},
|
|
|
|
|
})),
|
|
|
|
|
listCompanyIds: vi.fn(async () => ["company-1"]),
|
|
|
|
|
}),
|
2026-03-24 08:11:09 -05:00
|
|
|
issueApprovalService: () => ({}),
|
|
|
|
|
issueService: () => mockIssueService,
|
|
|
|
|
logActivity: vi.fn(async () => undefined),
|
|
|
|
|
projectService: () => mockProjectService,
|
|
|
|
|
routineService: () => ({
|
|
|
|
|
syncRunStatusForIssue: vi.fn(async () => undefined),
|
|
|
|
|
}),
|
|
|
|
|
workProductService: () => ({
|
|
|
|
|
listForIssue: vi.fn(async () => []),
|
|
|
|
|
}),
|
|
|
|
|
}));
|
|
|
|
|
|
[codex] Harden execution reliability and heartbeat tooling (#3679)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - Reliable execution depends on heartbeat routing, issue lifecycle
semantics, telemetry, and a fast enough local verification loop to keep
regressions visible
> - The remaining commits on this branch were mostly server/runtime
correctness fixes plus test and documentation follow-ups in that area
> - Those changes are logically separate from the UI-focused
issue-detail and workspace/navigation branches even when they touch
overlapping issue APIs
> - This pull request groups the execution reliability, heartbeat,
telemetry, and tooling changes into one standalone branch
> - The benefit is a focused review of the control-plane correctness
work, including the follow-up fix that restored the implicit
comment-reopen helpers after branch splitting
## What Changed
- Hardened issue/heartbeat execution behavior, including self-review
stage skipping, deferred mention wakes during active execution, stranded
execution recovery, active-run scoping, assignee resolution, and
blocked-to-todo wake resumption
- Reduced noisy polling/logging overhead by trimming issue run payloads,
compacting persisted run logs, silencing high-volume request logs, and
capping heartbeat-run queries in dashboard/inbox surfaces
- Expanded telemetry and status semantics with adapter/model fields on
task completion plus clearer status guidance in docs/onboarding material
- Updated test infrastructure and verification defaults with faster
route-test module isolation, cheaper default `pnpm test`, e2e isolation
from local state, and repo verification follow-ups
- Included docs/release housekeeping from the branch and added a small
follow-up commit restoring the implicit comment-reopen helpers that were
dropped during branch reconstruction
## Verification
- `pnpm vitest run
server/src/__tests__/issue-comment-reopen-routes.test.ts
server/src/__tests__/issue-telemetry-routes.test.ts`
- `pnpm vitest run server/src/__tests__/http-log-policy.test.ts
server/src/__tests__/heartbeat-run-log.test.ts
server/src/__tests__/health.test.ts`
- `server/src/__tests__/activity-service.test.ts`,
`server/src/__tests__/heartbeat-comment-wake-batching.test.ts`, and
`server/src/__tests__/heartbeat-process-recovery.test.ts` were attempted
on this host but the embedded Postgres harness reported
init-script/data-dir problems and skipped or failed to start, so they
are noted as environment-limited
## Risks
- Medium: this branch changes core issue/heartbeat routing and
reopen/wakeup behavior, so regressions would affect agent execution flow
rather than isolated UI polish
- Because it also updates verification infrastructure, reviewers should
pay attention to whether the new tests are asserting the right failure
modes and not just reshaping harness behavior
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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)
- [ ] 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>
2026-04-14 13:34:52 -05:00
|
|
|
async function createApp() {
|
|
|
|
|
const [{ issueRoutes }, { errorHandler }] = await Promise.all([
|
|
|
|
|
vi.importActual<typeof import("../routes/issues.js")>("../routes/issues.js"),
|
|
|
|
|
vi.importActual<typeof import("../middleware/index.js")>("../middleware/index.js"),
|
|
|
|
|
]);
|
2026-03-24 08:11:09 -05:00
|
|
|
const app = express();
|
|
|
|
|
app.use(express.json());
|
|
|
|
|
app.use((req, _res, next) => {
|
|
|
|
|
(req as any).actor = {
|
|
|
|
|
type: "board",
|
|
|
|
|
userId: "local-board",
|
|
|
|
|
companyIds: ["company-1"],
|
|
|
|
|
source: "local_implicit",
|
|
|
|
|
isInstanceAdmin: false,
|
|
|
|
|
};
|
|
|
|
|
next();
|
|
|
|
|
});
|
|
|
|
|
app.use("/api", issueRoutes({} as any, {} as any));
|
|
|
|
|
app.use(errorHandler);
|
|
|
|
|
return app;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const legacyProjectLinkedIssue = {
|
|
|
|
|
id: "11111111-1111-4111-8111-111111111111",
|
|
|
|
|
companyId: "company-1",
|
|
|
|
|
identifier: "PAP-581",
|
|
|
|
|
title: "Legacy onboarding task",
|
|
|
|
|
description: "Seed the first CEO task",
|
|
|
|
|
status: "todo",
|
|
|
|
|
priority: "medium",
|
|
|
|
|
projectId: "22222222-2222-4222-8222-222222222222",
|
|
|
|
|
goalId: null,
|
|
|
|
|
parentId: null,
|
|
|
|
|
assigneeAgentId: "33333333-3333-4333-8333-333333333333",
|
|
|
|
|
assigneeUserId: null,
|
|
|
|
|
updatedAt: new Date("2026-03-24T12:00:00Z"),
|
|
|
|
|
executionWorkspaceId: null,
|
|
|
|
|
labels: [],
|
|
|
|
|
labelIds: [],
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const projectGoal = {
|
|
|
|
|
id: "44444444-4444-4444-8444-444444444444",
|
|
|
|
|
companyId: "company-1",
|
|
|
|
|
title: "Launch the company",
|
|
|
|
|
description: null,
|
|
|
|
|
level: "company",
|
|
|
|
|
status: "active",
|
|
|
|
|
parentId: null,
|
|
|
|
|
ownerAgentId: null,
|
|
|
|
|
createdAt: new Date("2026-03-20T00:00:00Z"),
|
|
|
|
|
updatedAt: new Date("2026-03-20T00:00:00Z"),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
describe("issue goal context routes", () => {
|
|
|
|
|
beforeEach(() => {
|
[codex] Harden execution reliability and heartbeat tooling (#3679)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - Reliable execution depends on heartbeat routing, issue lifecycle
semantics, telemetry, and a fast enough local verification loop to keep
regressions visible
> - The remaining commits on this branch were mostly server/runtime
correctness fixes plus test and documentation follow-ups in that area
> - Those changes are logically separate from the UI-focused
issue-detail and workspace/navigation branches even when they touch
overlapping issue APIs
> - This pull request groups the execution reliability, heartbeat,
telemetry, and tooling changes into one standalone branch
> - The benefit is a focused review of the control-plane correctness
work, including the follow-up fix that restored the implicit
comment-reopen helpers after branch splitting
## What Changed
- Hardened issue/heartbeat execution behavior, including self-review
stage skipping, deferred mention wakes during active execution, stranded
execution recovery, active-run scoping, assignee resolution, and
blocked-to-todo wake resumption
- Reduced noisy polling/logging overhead by trimming issue run payloads,
compacting persisted run logs, silencing high-volume request logs, and
capping heartbeat-run queries in dashboard/inbox surfaces
- Expanded telemetry and status semantics with adapter/model fields on
task completion plus clearer status guidance in docs/onboarding material
- Updated test infrastructure and verification defaults with faster
route-test module isolation, cheaper default `pnpm test`, e2e isolation
from local state, and repo verification follow-ups
- Included docs/release housekeeping from the branch and added a small
follow-up commit restoring the implicit comment-reopen helpers that were
dropped during branch reconstruction
## Verification
- `pnpm vitest run
server/src/__tests__/issue-comment-reopen-routes.test.ts
server/src/__tests__/issue-telemetry-routes.test.ts`
- `pnpm vitest run server/src/__tests__/http-log-policy.test.ts
server/src/__tests__/heartbeat-run-log.test.ts
server/src/__tests__/health.test.ts`
- `server/src/__tests__/activity-service.test.ts`,
`server/src/__tests__/heartbeat-comment-wake-batching.test.ts`, and
`server/src/__tests__/heartbeat-process-recovery.test.ts` were attempted
on this host but the embedded Postgres harness reported
init-script/data-dir problems and skipped or failed to start, so they
are noted as environment-limited
## Risks
- Medium: this branch changes core issue/heartbeat routing and
reopen/wakeup behavior, so regressions would affect agent execution flow
rather than isolated UI polish
- Because it also updates verification infrastructure, reviewers should
pay attention to whether the new tests are asserting the right failure
modes and not just reshaping harness behavior
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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)
- [ ] 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>
2026-04-14 13:34:52 -05:00
|
|
|
vi.resetModules();
|
|
|
|
|
vi.doUnmock("../routes/issues.js");
|
|
|
|
|
vi.doUnmock("../routes/authz.js");
|
|
|
|
|
vi.doUnmock("../middleware/index.js");
|
|
|
|
|
vi.resetAllMocks();
|
2026-03-24 08:11:09 -05:00
|
|
|
mockIssueService.getById.mockResolvedValue(legacyProjectLinkedIssue);
|
|
|
|
|
mockIssueService.getAncestors.mockResolvedValue([]);
|
2026-04-04 13:56:04 -05:00
|
|
|
mockIssueService.getRelationSummaries.mockResolvedValue({ blockedBy: [], blocks: [] });
|
2026-03-24 08:11:09 -05:00
|
|
|
mockIssueService.findMentionedProjectIds.mockResolvedValue([]);
|
|
|
|
|
mockIssueService.getCommentCursor.mockResolvedValue({
|
|
|
|
|
totalComments: 0,
|
|
|
|
|
latestCommentId: null,
|
|
|
|
|
latestCommentAt: null,
|
|
|
|
|
});
|
|
|
|
|
mockIssueService.getComment.mockResolvedValue(null);
|
2026-04-03 01:53:57 +09:00
|
|
|
mockIssueService.listAttachments.mockResolvedValue([]);
|
2026-03-24 08:11:09 -05:00
|
|
|
mockProjectService.getById.mockResolvedValue({
|
|
|
|
|
id: legacyProjectLinkedIssue.projectId,
|
|
|
|
|
companyId: "company-1",
|
|
|
|
|
urlKey: "onboarding",
|
|
|
|
|
goalId: projectGoal.id,
|
|
|
|
|
goalIds: [projectGoal.id],
|
|
|
|
|
goals: [{ id: projectGoal.id, title: projectGoal.title }],
|
|
|
|
|
name: "Onboarding",
|
|
|
|
|
description: null,
|
|
|
|
|
status: "in_progress",
|
|
|
|
|
leadAgentId: null,
|
|
|
|
|
targetDate: null,
|
|
|
|
|
color: null,
|
|
|
|
|
pauseReason: null,
|
|
|
|
|
pausedAt: null,
|
|
|
|
|
executionWorkspacePolicy: null,
|
|
|
|
|
codebase: {
|
|
|
|
|
workspaceId: null,
|
|
|
|
|
repoUrl: null,
|
|
|
|
|
repoRef: null,
|
|
|
|
|
defaultRef: null,
|
|
|
|
|
repoName: null,
|
|
|
|
|
localFolder: null,
|
|
|
|
|
managedFolder: "/tmp/company-1/project-1",
|
|
|
|
|
effectiveLocalFolder: "/tmp/company-1/project-1",
|
|
|
|
|
origin: "managed_checkout",
|
|
|
|
|
},
|
|
|
|
|
workspaces: [],
|
|
|
|
|
primaryWorkspace: null,
|
|
|
|
|
archivedAt: null,
|
|
|
|
|
createdAt: new Date("2026-03-20T00:00:00Z"),
|
|
|
|
|
updatedAt: new Date("2026-03-20T00:00:00Z"),
|
|
|
|
|
});
|
|
|
|
|
mockProjectService.listByIds.mockResolvedValue([]);
|
|
|
|
|
mockGoalService.getById.mockImplementation(async (id: string) =>
|
|
|
|
|
id === projectGoal.id ? projectGoal : null,
|
|
|
|
|
);
|
|
|
|
|
mockGoalService.getDefaultCompanyGoal.mockResolvedValue(null);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("surfaces the project goal from GET /issues/:id when the issue has no direct goal", async () => {
|
[codex] Harden execution reliability and heartbeat tooling (#3679)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - Reliable execution depends on heartbeat routing, issue lifecycle
semantics, telemetry, and a fast enough local verification loop to keep
regressions visible
> - The remaining commits on this branch were mostly server/runtime
correctness fixes plus test and documentation follow-ups in that area
> - Those changes are logically separate from the UI-focused
issue-detail and workspace/navigation branches even when they touch
overlapping issue APIs
> - This pull request groups the execution reliability, heartbeat,
telemetry, and tooling changes into one standalone branch
> - The benefit is a focused review of the control-plane correctness
work, including the follow-up fix that restored the implicit
comment-reopen helpers after branch splitting
## What Changed
- Hardened issue/heartbeat execution behavior, including self-review
stage skipping, deferred mention wakes during active execution, stranded
execution recovery, active-run scoping, assignee resolution, and
blocked-to-todo wake resumption
- Reduced noisy polling/logging overhead by trimming issue run payloads,
compacting persisted run logs, silencing high-volume request logs, and
capping heartbeat-run queries in dashboard/inbox surfaces
- Expanded telemetry and status semantics with adapter/model fields on
task completion plus clearer status guidance in docs/onboarding material
- Updated test infrastructure and verification defaults with faster
route-test module isolation, cheaper default `pnpm test`, e2e isolation
from local state, and repo verification follow-ups
- Included docs/release housekeeping from the branch and added a small
follow-up commit restoring the implicit comment-reopen helpers that were
dropped during branch reconstruction
## Verification
- `pnpm vitest run
server/src/__tests__/issue-comment-reopen-routes.test.ts
server/src/__tests__/issue-telemetry-routes.test.ts`
- `pnpm vitest run server/src/__tests__/http-log-policy.test.ts
server/src/__tests__/heartbeat-run-log.test.ts
server/src/__tests__/health.test.ts`
- `server/src/__tests__/activity-service.test.ts`,
`server/src/__tests__/heartbeat-comment-wake-batching.test.ts`, and
`server/src/__tests__/heartbeat-process-recovery.test.ts` were attempted
on this host but the embedded Postgres harness reported
init-script/data-dir problems and skipped or failed to start, so they
are noted as environment-limited
## Risks
- Medium: this branch changes core issue/heartbeat routing and
reopen/wakeup behavior, so regressions would affect agent execution flow
rather than isolated UI polish
- Because it also updates verification infrastructure, reviewers should
pay attention to whether the new tests are asserting the right failure
modes and not just reshaping harness behavior
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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)
- [ ] 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>
2026-04-14 13:34:52 -05:00
|
|
|
const res = await request(await createApp()).get("/api/issues/11111111-1111-4111-8111-111111111111");
|
2026-03-24 08:11:09 -05:00
|
|
|
|
|
|
|
|
expect(res.status).toBe(200);
|
|
|
|
|
expect(res.body.goalId).toBe(projectGoal.id);
|
|
|
|
|
expect(res.body.goal).toEqual(
|
|
|
|
|
expect.objectContaining({
|
|
|
|
|
id: projectGoal.id,
|
|
|
|
|
title: projectGoal.title,
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
expect(mockGoalService.getDefaultCompanyGoal).not.toHaveBeenCalled();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("surfaces the project goal from GET /issues/:id/heartbeat-context", async () => {
|
[codex] Harden execution reliability and heartbeat tooling (#3679)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - Reliable execution depends on heartbeat routing, issue lifecycle
semantics, telemetry, and a fast enough local verification loop to keep
regressions visible
> - The remaining commits on this branch were mostly server/runtime
correctness fixes plus test and documentation follow-ups in that area
> - Those changes are logically separate from the UI-focused
issue-detail and workspace/navigation branches even when they touch
overlapping issue APIs
> - This pull request groups the execution reliability, heartbeat,
telemetry, and tooling changes into one standalone branch
> - The benefit is a focused review of the control-plane correctness
work, including the follow-up fix that restored the implicit
comment-reopen helpers after branch splitting
## What Changed
- Hardened issue/heartbeat execution behavior, including self-review
stage skipping, deferred mention wakes during active execution, stranded
execution recovery, active-run scoping, assignee resolution, and
blocked-to-todo wake resumption
- Reduced noisy polling/logging overhead by trimming issue run payloads,
compacting persisted run logs, silencing high-volume request logs, and
capping heartbeat-run queries in dashboard/inbox surfaces
- Expanded telemetry and status semantics with adapter/model fields on
task completion plus clearer status guidance in docs/onboarding material
- Updated test infrastructure and verification defaults with faster
route-test module isolation, cheaper default `pnpm test`, e2e isolation
from local state, and repo verification follow-ups
- Included docs/release housekeeping from the branch and added a small
follow-up commit restoring the implicit comment-reopen helpers that were
dropped during branch reconstruction
## Verification
- `pnpm vitest run
server/src/__tests__/issue-comment-reopen-routes.test.ts
server/src/__tests__/issue-telemetry-routes.test.ts`
- `pnpm vitest run server/src/__tests__/http-log-policy.test.ts
server/src/__tests__/heartbeat-run-log.test.ts
server/src/__tests__/health.test.ts`
- `server/src/__tests__/activity-service.test.ts`,
`server/src/__tests__/heartbeat-comment-wake-batching.test.ts`, and
`server/src/__tests__/heartbeat-process-recovery.test.ts` were attempted
on this host but the embedded Postgres harness reported
init-script/data-dir problems and skipped or failed to start, so they
are noted as environment-limited
## Risks
- Medium: this branch changes core issue/heartbeat routing and
reopen/wakeup behavior, so regressions would affect agent execution flow
rather than isolated UI polish
- Because it also updates verification infrastructure, reviewers should
pay attention to whether the new tests are asserting the right failure
modes and not just reshaping harness behavior
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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)
- [ ] 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>
2026-04-14 13:34:52 -05:00
|
|
|
const res = await request(await createApp()).get(
|
2026-03-24 08:11:09 -05:00
|
|
|
"/api/issues/11111111-1111-4111-8111-111111111111/heartbeat-context",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(res.status).toBe(200);
|
|
|
|
|
expect(res.body.issue.goalId).toBe(projectGoal.id);
|
|
|
|
|
expect(res.body.goal).toEqual(
|
|
|
|
|
expect.objectContaining({
|
|
|
|
|
id: projectGoal.id,
|
|
|
|
|
title: projectGoal.title,
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
expect(mockGoalService.getDefaultCompanyGoal).not.toHaveBeenCalled();
|
2026-04-05 21:57:15 +09:00
|
|
|
expect(res.body.attachments).toEqual([]);
|
2026-03-24 08:11:09 -05:00
|
|
|
});
|
2026-04-04 13:56:04 -05:00
|
|
|
|
|
|
|
|
it("surfaces blocker summaries on GET /issues/:id/heartbeat-context", async () => {
|
|
|
|
|
mockIssueService.getRelationSummaries.mockResolvedValue({
|
|
|
|
|
blockedBy: [
|
|
|
|
|
{
|
|
|
|
|
id: "55555555-5555-4555-8555-555555555555",
|
|
|
|
|
identifier: "PAP-580",
|
|
|
|
|
title: "Finish wakeup plumbing",
|
|
|
|
|
status: "done",
|
|
|
|
|
priority: "medium",
|
|
|
|
|
assigneeAgentId: null,
|
|
|
|
|
assigneeUserId: null,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
blocks: [],
|
|
|
|
|
});
|
|
|
|
|
|
[codex] Harden execution reliability and heartbeat tooling (#3679)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - Reliable execution depends on heartbeat routing, issue lifecycle
semantics, telemetry, and a fast enough local verification loop to keep
regressions visible
> - The remaining commits on this branch were mostly server/runtime
correctness fixes plus test and documentation follow-ups in that area
> - Those changes are logically separate from the UI-focused
issue-detail and workspace/navigation branches even when they touch
overlapping issue APIs
> - This pull request groups the execution reliability, heartbeat,
telemetry, and tooling changes into one standalone branch
> - The benefit is a focused review of the control-plane correctness
work, including the follow-up fix that restored the implicit
comment-reopen helpers after branch splitting
## What Changed
- Hardened issue/heartbeat execution behavior, including self-review
stage skipping, deferred mention wakes during active execution, stranded
execution recovery, active-run scoping, assignee resolution, and
blocked-to-todo wake resumption
- Reduced noisy polling/logging overhead by trimming issue run payloads,
compacting persisted run logs, silencing high-volume request logs, and
capping heartbeat-run queries in dashboard/inbox surfaces
- Expanded telemetry and status semantics with adapter/model fields on
task completion plus clearer status guidance in docs/onboarding material
- Updated test infrastructure and verification defaults with faster
route-test module isolation, cheaper default `pnpm test`, e2e isolation
from local state, and repo verification follow-ups
- Included docs/release housekeeping from the branch and added a small
follow-up commit restoring the implicit comment-reopen helpers that were
dropped during branch reconstruction
## Verification
- `pnpm vitest run
server/src/__tests__/issue-comment-reopen-routes.test.ts
server/src/__tests__/issue-telemetry-routes.test.ts`
- `pnpm vitest run server/src/__tests__/http-log-policy.test.ts
server/src/__tests__/heartbeat-run-log.test.ts
server/src/__tests__/health.test.ts`
- `server/src/__tests__/activity-service.test.ts`,
`server/src/__tests__/heartbeat-comment-wake-batching.test.ts`, and
`server/src/__tests__/heartbeat-process-recovery.test.ts` were attempted
on this host but the embedded Postgres harness reported
init-script/data-dir problems and skipped or failed to start, so they
are noted as environment-limited
## Risks
- Medium: this branch changes core issue/heartbeat routing and
reopen/wakeup behavior, so regressions would affect agent execution flow
rather than isolated UI polish
- Because it also updates verification infrastructure, reviewers should
pay attention to whether the new tests are asserting the right failure
modes and not just reshaping harness behavior
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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)
- [ ] 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>
2026-04-14 13:34:52 -05:00
|
|
|
const res = await request(await createApp()).get(
|
2026-04-04 13:56:04 -05:00
|
|
|
"/api/issues/11111111-1111-4111-8111-111111111111/heartbeat-context",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(res.status).toBe(200);
|
|
|
|
|
expect(res.body.issue.blockedBy).toEqual([
|
|
|
|
|
expect.objectContaining({
|
|
|
|
|
id: "55555555-5555-4555-8555-555555555555",
|
|
|
|
|
identifier: "PAP-580",
|
|
|
|
|
}),
|
|
|
|
|
]);
|
|
|
|
|
});
|
2026-03-24 08:11:09 -05:00
|
|
|
});
|