mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 11:20:37 +09:00
Improve operator workflow QoL (#5291)
## Thinking Path > - Paperclip is a control plane operators use repeatedly to supervise agent companies. > - Common operator workflows depend on fast scanning of inboxes, issue sidebars, workspaces, cost totals, and runtime services. > - Several small UI and service gaps made those workflows slower or less clear. > - This pull request groups the operator-facing QoL changes that can stand alone from recovery and adapter work. > - The benefit is a denser, clearer board experience for issue triage and workspace operation. ## What Changed - Added inbox assignee/project grouping and issue list token/runtime totals. - Improved issue properties with removable blocker chips and workspace task links. - Improved execution workspace layout, runtime controls, issues tab default, and stopped-port reuse behavior. - Added mobile markdown/routine dialog fixes, page title company names, sidebar polish, and dashboard run task label cleanup. ## Verification - `pnpm install --frozen-lockfile` - `pnpm exec vitest run ui/src/lib/inbox.test.ts ui/src/components/IssueProperties.test.tsx ui/src/components/WorkspaceRuntimeControls.test.tsx server/src/__tests__/workspace-runtime.test.ts server/src/__tests__/costs-service.test.ts` ## Risks - Medium UI risk because this touches several operator surfaces. The branch is intentionally grouped around workflow/QoL files and keeps the file count below the Greptile limit. ## Model Used - OpenAI GPT-5 Codex via Paperclip `codex_local` adapter, with shell/git/GitHub CLI tool use. ## 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 - [x] 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
11ffd6f2c5
commit
424e81d087
47 changed files with 1739 additions and 250 deletions
|
|
@ -1322,9 +1322,69 @@ describe("inbox helpers", () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it("persists workspace grouping preferences", () => {
|
||||
it("groups assignee sections by latest issue activity while preserving non-issue sections", () => {
|
||||
const agentIssue = makeIssue("agent", true);
|
||||
agentIssue.assigneeAgentId = "agent-1";
|
||||
|
||||
const userIssue = makeIssue("user", false);
|
||||
userIssue.assigneeUserId = "user-1";
|
||||
|
||||
const unassignedIssue = makeIssue("unassigned", false);
|
||||
|
||||
const items: InboxWorkItem[] = [
|
||||
{ kind: "issue", timestamp: 5, issue: agentIssue },
|
||||
{ kind: "approval", timestamp: 8, approval: makeApproval("pending") },
|
||||
{ kind: "issue", timestamp: 7, issue: userIssue },
|
||||
{ kind: "issue", timestamp: 2, issue: unassignedIssue },
|
||||
];
|
||||
|
||||
expect(groupInboxWorkItems(items, "assignee", {
|
||||
agentById: new Map([["agent-1", "Coder"]]),
|
||||
userLabelById: new Map([["user-1", "Riley"]]),
|
||||
})).toEqual([
|
||||
{ key: "kind:approval", label: "Approvals", items: [items[1]] },
|
||||
{ key: "assignee:user:user-1", label: "Riley", items: [items[2]] },
|
||||
{ key: "assignee:agent:agent-1", label: "Coder", items: [items[0]] },
|
||||
{ key: "assignee:none", label: "Unassigned", items: [items[3]] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("groups project sections by latest issue activity while preserving non-issue sections", () => {
|
||||
const paperclipIssue = makeIssue("paperclip", true);
|
||||
paperclipIssue.projectId = "project-1";
|
||||
|
||||
const onboardingIssue = makeIssue("onboarding", false);
|
||||
onboardingIssue.projectId = "project-2";
|
||||
|
||||
const noProjectIssue = makeIssue("no-project", false);
|
||||
|
||||
const items: InboxWorkItem[] = [
|
||||
{ kind: "issue", timestamp: 9, issue: paperclipIssue },
|
||||
{ kind: "issue", timestamp: 4, issue: onboardingIssue },
|
||||
{ kind: "join_request", timestamp: 6, joinRequest: makeJoinRequest("join-1") },
|
||||
{ kind: "issue", timestamp: 2, issue: noProjectIssue },
|
||||
];
|
||||
|
||||
expect(groupInboxWorkItems(items, "project", {
|
||||
projectById: new Map([
|
||||
["project-1", { name: "Paperclip App" }],
|
||||
["project-2", { name: "Onboarding" }],
|
||||
]),
|
||||
})).toEqual([
|
||||
{ key: "project:project-1", label: "Paperclip App", items: [items[0]] },
|
||||
{ key: "kind:join_request", label: "Join requests", items: [items[2]] },
|
||||
{ key: "project:project-2", label: "Onboarding", items: [items[1]] },
|
||||
{ key: "project:none", label: "No project", items: [items[3]] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("persists inbox grouping preferences", () => {
|
||||
saveInboxWorkItemGroupBy("workspace");
|
||||
expect(loadInboxWorkItemGroupBy()).toBe("workspace");
|
||||
saveInboxWorkItemGroupBy("assignee");
|
||||
expect(loadInboxWorkItemGroupBy()).toBe("assignee");
|
||||
saveInboxWorkItemGroupBy("project");
|
||||
expect(loadInboxWorkItemGroupBy()).toBe("project");
|
||||
});
|
||||
|
||||
it("persists collapsed inbox groups per company", () => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {
|
|||
normalizeIssueFilterState,
|
||||
type IssueFilterState,
|
||||
} from "./issue-filters";
|
||||
import { formatAssigneeUserLabel } from "./assignees";
|
||||
|
||||
export const RECENT_ISSUES_LIMIT = 100;
|
||||
export const FAILED_RUN_STATUSES = new Set(["failed", "timed_out"]);
|
||||
|
|
@ -33,7 +34,7 @@ export type InboxCategoryFilter =
|
|||
| "failed_runs"
|
||||
| "alerts";
|
||||
export type InboxApprovalFilter = "all" | "actionable" | "resolved";
|
||||
export type InboxWorkItemGroupBy = "none" | "type" | "workspace";
|
||||
export type InboxWorkItemGroupBy = "none" | "type" | "assignee" | "project" | "workspace";
|
||||
export const inboxIssueColumns = [
|
||||
"status",
|
||||
"id",
|
||||
|
|
@ -137,6 +138,10 @@ export interface InboxWorkspaceGroupingOptions {
|
|||
executionWorkspaceById?: ReadonlyMap<string, InboxExecutionWorkspaceLookup>;
|
||||
projectWorkspaceById?: ReadonlyMap<string, InboxProjectWorkspaceLookup>;
|
||||
defaultProjectWorkspaceIdByProjectId?: ReadonlyMap<string, string>;
|
||||
projectById?: ReadonlyMap<string, { name: string | null | undefined }>;
|
||||
agentById?: ReadonlyMap<string, string | null | undefined>;
|
||||
userLabelById?: ReadonlyMap<string, string>;
|
||||
currentUserId?: string | null;
|
||||
}
|
||||
|
||||
const defaultInboxFilterPreferences: InboxFilterPreferences = {
|
||||
|
|
@ -342,7 +347,7 @@ export function saveInboxIssueColumns(columns: InboxIssueColumn[]) {
|
|||
export function loadInboxWorkItemGroupBy(): InboxWorkItemGroupBy {
|
||||
try {
|
||||
const raw = localStorage.getItem(INBOX_GROUP_BY_KEY);
|
||||
return raw === "type" || raw === "workspace" ? raw : "none";
|
||||
return raw === "type" || raw === "assignee" || raw === "project" || raw === "workspace" ? raw : "none";
|
||||
} catch {
|
||||
return "none";
|
||||
}
|
||||
|
|
@ -805,6 +810,86 @@ const inboxWorkItemKindLabels: Record<InboxWorkItem["kind"], string> = {
|
|||
join_request: "Join requests",
|
||||
};
|
||||
|
||||
function resolveIssueAssigneeGroup(
|
||||
issue: Pick<Issue, "assigneeAgentId" | "assigneeUserId">,
|
||||
{
|
||||
agentById,
|
||||
currentUserId,
|
||||
userLabelById,
|
||||
}: Pick<InboxWorkspaceGroupingOptions, "agentById" | "currentUserId" | "userLabelById">,
|
||||
): { key: string; label: string } {
|
||||
if (issue.assigneeAgentId) {
|
||||
const agentName = agentById?.get(issue.assigneeAgentId)?.trim();
|
||||
return {
|
||||
key: `assignee:agent:${issue.assigneeAgentId}`,
|
||||
label: agentName || issue.assigneeAgentId.slice(0, 8),
|
||||
};
|
||||
}
|
||||
|
||||
if (issue.assigneeUserId) {
|
||||
return {
|
||||
key: `assignee:user:${issue.assigneeUserId}`,
|
||||
label: formatAssigneeUserLabel(issue.assigneeUserId, currentUserId, userLabelById) ?? "User",
|
||||
};
|
||||
}
|
||||
|
||||
return { key: "assignee:none", label: "Unassigned" };
|
||||
}
|
||||
|
||||
function resolveIssueProjectGroup(
|
||||
issue: Pick<Issue, "projectId">,
|
||||
{ projectById }: Pick<InboxWorkspaceGroupingOptions, "projectById">,
|
||||
): { key: string; label: string } {
|
||||
if (!issue.projectId) return { key: "project:none", label: "No project" };
|
||||
|
||||
const projectName = projectById?.get(issue.projectId)?.name?.trim();
|
||||
return {
|
||||
key: `project:${issue.projectId}`,
|
||||
label: projectName || issue.projectId.slice(0, 8),
|
||||
};
|
||||
}
|
||||
|
||||
function groupInboxWorkItemsByIssueGroup(
|
||||
items: InboxWorkItem[],
|
||||
resolveIssueGroup: (issue: Issue) => { key: string; label: string },
|
||||
): InboxWorkItemGroup[] {
|
||||
const groups = new Map<string, { label: string; items: InboxWorkItem[]; latestTimestamp: number }>();
|
||||
for (const item of items) {
|
||||
const resolvedGroup = item.kind === "issue"
|
||||
? resolveIssueGroup(item.issue)
|
||||
: { key: `kind:${item.kind}`, label: inboxWorkItemKindLabels[item.kind] };
|
||||
const existing = groups.get(resolvedGroup.key);
|
||||
if (existing) {
|
||||
existing.items.push(item);
|
||||
existing.latestTimestamp = Math.max(existing.latestTimestamp, item.timestamp);
|
||||
} else {
|
||||
groups.set(resolvedGroup.key, {
|
||||
label: resolvedGroup.label,
|
||||
items: [item],
|
||||
latestTimestamp: item.timestamp,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return [...groups.entries()]
|
||||
.map(([key, value]) => ({
|
||||
key,
|
||||
label: value.label,
|
||||
items: value.items,
|
||||
latestTimestamp: value.latestTimestamp,
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
const timestampDiff = b.latestTimestamp - a.latestTimestamp;
|
||||
if (timestampDiff !== 0) return timestampDiff;
|
||||
return a.label.localeCompare(b.label);
|
||||
})
|
||||
.map(({ key, label, items: groupItems }) => ({
|
||||
key,
|
||||
label,
|
||||
items: groupItems,
|
||||
}));
|
||||
}
|
||||
|
||||
export function groupInboxWorkItems(
|
||||
items: InboxWorkItem[],
|
||||
groupBy: InboxWorkItemGroupBy,
|
||||
|
|
@ -815,41 +900,15 @@ export function groupInboxWorkItems(
|
|||
}
|
||||
|
||||
if (groupBy === "workspace") {
|
||||
const groups = new Map<string, { label: string; items: InboxWorkItem[]; latestTimestamp: number }>();
|
||||
for (const item of items) {
|
||||
const resolvedGroup = item.kind === "issue"
|
||||
? resolveIssueWorkspaceGroup(item.issue, options)
|
||||
: { key: `kind:${item.kind}`, label: inboxWorkItemKindLabels[item.kind] };
|
||||
const existing = groups.get(resolvedGroup.key);
|
||||
if (existing) {
|
||||
existing.items.push(item);
|
||||
existing.latestTimestamp = Math.max(existing.latestTimestamp, item.timestamp);
|
||||
} else {
|
||||
groups.set(resolvedGroup.key, {
|
||||
label: resolvedGroup.label,
|
||||
items: [item],
|
||||
latestTimestamp: item.timestamp,
|
||||
});
|
||||
}
|
||||
}
|
||||
return groupInboxWorkItemsByIssueGroup(items, (issue) => resolveIssueWorkspaceGroup(issue, options));
|
||||
}
|
||||
|
||||
return [...groups.entries()]
|
||||
.map(([key, value]) => ({
|
||||
key,
|
||||
label: value.label,
|
||||
items: value.items,
|
||||
latestTimestamp: value.latestTimestamp,
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
const timestampDiff = b.latestTimestamp - a.latestTimestamp;
|
||||
if (timestampDiff !== 0) return timestampDiff;
|
||||
return a.label.localeCompare(b.label);
|
||||
})
|
||||
.map(({ key, label, items: groupItems }) => ({
|
||||
key,
|
||||
label,
|
||||
items: groupItems,
|
||||
}));
|
||||
if (groupBy === "assignee") {
|
||||
return groupInboxWorkItemsByIssueGroup(items, (issue) => resolveIssueAssigneeGroup(issue, options));
|
||||
}
|
||||
|
||||
if (groupBy === "project") {
|
||||
return groupInboxWorkItemsByIssueGroup(items, (issue) => resolveIssueProjectGroup(issue, options));
|
||||
}
|
||||
|
||||
const groups = new Map<InboxWorkItem["kind"], InboxWorkItem[]>();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@ export const queryKeys = {
|
|||
comments: (issueId: string) => ["issues", "comments", issueId] as const,
|
||||
interactions: (issueId: string) => ["issues", "interactions", issueId] as const,
|
||||
feedbackVotes: (issueId: string) => ["issues", "feedback-votes", issueId] as const,
|
||||
costSummary: (issueId: string) => ["issues", "cost-summary", issueId] as const,
|
||||
costSummary: (issueId: string, options: { excludeRoot?: boolean } = {}) =>
|
||||
options.excludeRoot
|
||||
? (["issues", "cost-summary", issueId, "exclude-root"] as const)
|
||||
: (["issues", "cost-summary", issueId] as const),
|
||||
attachments: (issueId: string) => ["issues", "attachments", issueId] as const,
|
||||
documents: (issueId: string) => ["issues", "documents", issueId] as const,
|
||||
document: (issueId: string, key: string) => ["issues", "document", issueId, key] as const,
|
||||
|
|
|
|||
|
|
@ -75,6 +75,24 @@ export function formatTokens(n: number): string {
|
|||
return String(n);
|
||||
}
|
||||
|
||||
/** Humanize a millisecond duration into a compact `1h 2m`, `45m 12s`, `12s` string. */
|
||||
export function formatDurationMs(ms: number): string {
|
||||
if (!Number.isFinite(ms) || ms <= 0) return "0s";
|
||||
const totalSeconds = Math.round(ms / 1000);
|
||||
if (totalSeconds < 60) return `${totalSeconds}s`;
|
||||
const minutes = Math.floor(totalSeconds / 60);
|
||||
const seconds = totalSeconds % 60;
|
||||
if (minutes < 60) return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const remainingMinutes = minutes % 60;
|
||||
if (hours < 24) {
|
||||
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
||||
}
|
||||
const days = Math.floor(hours / 24);
|
||||
const remainingHours = hours % 24;
|
||||
return remainingHours > 0 ? `${days}d ${remainingHours}h` : `${days}d`;
|
||||
}
|
||||
|
||||
/** Map a raw provider slug to a display-friendly name. */
|
||||
export function providerDisplayName(provider: string): string {
|
||||
const map: Record<string, string> = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue