fix(ui): include task identifier in browser tab title (#14212)

## Thinking Path

Paperclip's task breadcrumbs already carry identifiers, while browser
tab titles omit them. Showing a valid identifier before the task name
makes tabs easier to distinguish. Preserve existing titles for missing,
blank, or duplicate identifiers.

## Linked Issues or Issue Description

- Fixes #13615.
- Refs #10933, which added identifiers to visible task breadcrumbs.
- Refs #14583. This branch reuses the existing test-only CI repair by
itsjeremyjohnson and Codex, preserving its authored commit and
attribution.

## What Changed

- Show task titles as `IDENTIFIER — Name` when the breadcrumb has a
nonblank identifier.
- Preserve the existing title when the identifier is missing, blank, or
equals the label.
- Cover task/identifier/company changes, empty breadcrumbs, and
duplicate identifiers.
- Merge current master and keep its expanded clipboard-feedback test
unchanged. The earlier #14583 repair remains credited in history. The
net change against master is limited to the two title files.

## Verification

Integration base: `b110271c9b2fd6dd5a1beb119e7f0663385df8b9`.

Current head: `5fd1105c78d16418876b70921cca97a836359da6`. Its merge
parents are the previous PR head and the integration base above.

- macOS arm64, official Node 24.21.0, Vitest 5.0.3, original current
Vitest config/setup, one worker, 512 MiB heap: **16/16 passed** in
BreadcrumbContext and ProjectWorkspaceSummaryCard.
- The same tests against master's original title implementation produced
**14 passed / 2 failed**. Both failures concern the missing identifier
in the helper and live document title. The candidate passes both. This
comparison keeps the same dependencies and test bytes.
- Master's clipboard regression remains byte-for-byte unchanged. Its
four text/icon controls and 1499ms-visible/1500ms-expired checks pass.
- All four current token gates passed across 1,416 files. `git diff
--check` passed. The exact committed tree matches the tested candidate.
The net diff from the integration base contains only the two
BreadcrumbContext files.
- The diagnostic dependency environment uses 170 exact packages from the
unchanged current lockfile. It reuses 156 packages from the prior
integrity-checked cache and verifies registry and archive integrity for
14 added versions. No lifecycle scripts or dependency overrides ran.
This is a minimal test environment, not a full workspace installation.
- Checks for this new head are pending. The prior [workflow
39381608779](https://github.com/paperclipai/paperclip/actions/runs/39381608779)
passed all 48 jobs at `574f0c9`, with 54 successful and two skipped
checks. That result and the old Greptile 5/5 are historical; they do not
validate this integration.
- Full-workspace typecheck, build, backend and browser acceptance were
not repeated locally on this integration. The current local environment
covers the affected regressions. Full repository checks remain for
upstream CI.

The original failed clipboard CI attempt is retained in history. Its
exact Ubuntu timing cause was not independently reproduced locally. No
assertion, workflow or gate was disabled. The upstream-expanded test now
replaces our imported test diff while preserving its authored history.

## Risks

The application change affects tab text for task breadcrumbs with a
valid identifier. Master now contains a broader workspace
clipboard-feedback regression. This merge keeps that file exactly as
master. The imported #14583 commits and original attribution remain in
branch history. No clipboard production code changes.

Historical real-backend browser acceptance at `4040c564` remains
historical only. Authentication, multi-user permissions, agent execution
and other browser engines were outside that acceptance. Maintainer
review and checks for the new head remain pending.

## Model Used

OpenAI Codex, GPT-6 family, assisted with implementation, tests,
repository inspection and GitHub checks. The exact served model ID,
context window and reasoning settings were not exposed. The reused test
repair retains the AI disclosure and authorship recorded in #14583.

## 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 searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [ ] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
SealdotandCodex authored and GitHub committed 2026-12-04 17:39:12 -08:00
1 parent d939c64a6b
commit dfe392dada
2 files changed
+83 -1

No files matched your search

+77
View File
@@ -115,8 +115,85 @@ describe("BreadcrumbContext", () => {
).toBe("PAP-3515 • Issues • Anachronist Wiki • Paperclip");
});
it("includes a task identifier before its name without changing breadcrumb order", () => {
expect(
buildDocumentTitle(
[{ label: "Issues" }, { label: "First task prompt", identifier: "PAP-1204" }],
"Anachronist Wiki",
),
).toBe("PAP-1204 — First task prompt • Issues • Anachronist Wiki • Paperclip");
expect(buildDocumentTitle([{ label: "First task prompt", identifier: " PAP-1204 " }])).toBe(
"PAP-1204 — First task prompt • Paperclip",
);
});
it("keeps titles unchanged when identifiers are missing or blank", () => {
expect(buildDocumentTitle([{ label: "First task prompt" }], "Anachronist Wiki")).toBe(
"First task prompt • Anachronist Wiki • Paperclip",
);
expect(buildDocumentTitle([{ label: "First task prompt", identifier: " " }])).toBe(
"First task prompt • Paperclip",
);
});
it("does not repeat an identifier that is already the label", () => {
expect(buildDocumentTitle([{ label: "PAP-1204", identifier: "PAP-1204" }])).toBe(
"PAP-1204 • Paperclip",
);
expect(buildDocumentTitle([{ label: "PAP-1204", identifier: " PAP-1204 " }])).toBe(
"PAP-1204 • Paperclip",
);
});
it("omits blank company names from page titles", () => {
expect(buildDocumentTitle([{ label: "Inbox" }], " ")).toBe("Inbox • Paperclip");
expect(buildDocumentTitle([], null)).toBe("Paperclip");
});
it("updates the document title when tasks and identifiers change", () => {
let updateBreadcrumbs: ReturnType<typeof useBreadcrumbs>["setBreadcrumbs"] | null = null;
function TestConsumer() {
updateBreadcrumbs = useBreadcrumbs().setBreadcrumbs;
return null;
}
act(() => {
root.render(
<BreadcrumbProvider companyName="Anachronist Wiki">
<TestConsumer />
</BreadcrumbProvider>,
);
});
expect(document.title).toBe("Anachronist Wiki • Paperclip");
act(() => {
updateBreadcrumbs?.([{ label: "First task prompt", identifier: "PAP-1204" }]);
});
expect(document.title).toBe("PAP-1204 — First task prompt • Anachronist Wiki • Paperclip");
act(() => {
updateBreadcrumbs?.([{ label: "First task prompt", identifier: "PAP-1205" }]);
});
expect(document.title).toBe("PAP-1205 — First task prompt • Anachronist Wiki • Paperclip");
act(() => {
updateBreadcrumbs?.([{ label: "Second task prompt", identifier: "PAP-1206" }]);
});
expect(document.title).toBe("PAP-1206 — Second task prompt • Anachronist Wiki • Paperclip");
act(() => {
root.render(
<BreadcrumbProvider companyName="Another Company">
<TestConsumer />
</BreadcrumbProvider>,
);
});
expect(document.title).toBe("PAP-1206 — Second task prompt • Another Company • Paperclip");
act(() => {
updateBreadcrumbs?.([]);
});
expect(document.title).toBe("Another Company • Paperclip");
});
});
+6 -1
View File
@@ -73,7 +73,12 @@ function breadcrumbsEqual(left: Breadcrumb[], right: Breadcrumb[]) {
export function buildDocumentTitle(breadcrumbs: Breadcrumb[], companyName?: string | null) {
const pageParts = breadcrumbs.length === 0
? []
: [...breadcrumbs].reverse().map((breadcrumb) => breadcrumb.label);
: [...breadcrumbs].reverse().map((breadcrumb) => {
const identifier = breadcrumb.identifier?.trim();
return identifier && identifier !== breadcrumb.label.trim()
? `${identifier} — ${breadcrumb.label}`
: breadcrumb.label;
});
const companyPart = companyName?.trim() ? [companyName.trim()] : [];
const parts = [...pageParts, ...companyPart, "Paperclip"];
return parts.join(" • ");