Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pm-stack/aggregator/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,10 @@ const GH_URL = /https:\/\/github\.com\/([\w.-]+\/[\w.-]+)\/(?:issues|pull)\/(\d+
/** Every GitHub issue/PR URL in a piece of text, as ref keys (deduplicated). */
export function refsInText(text: string): RefKey[] {
const out = new Set<RefKey>();
for (const m of text.matchAll(GH_URL)) out.add(`${m[1]}#${m[2]}`);
for (const m of text.matchAll(GH_URL)) {
const key = m[1] + "#" + m[2];
if (isValidRef(key)) out.add(key);
}
return [...out];
}

Expand Down
24 changes: 24 additions & 0 deletions pm-stack/aggregator/test/registry-hygiene-4284.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,28 @@ describe("both producers still emit gate-accepted records (#4284)", () => {
expect(isSessionRecord(fromLaunch)).toBe(true);
expect(fromLaunch.taskRefs).toEqual([]);
});

test("oversized URLs in session fields do not poison task refs (#4890)", () => {
const fromEntry = recordFromSessionEntry({
sessionId: "ses_oversized_refs",
source: "opencode-sandbox",
title:
"bad https://github.com/developing-today/code/issues/99999999999999999999 " +
"good https://github.com/developing-today/code/issues/123",
pr:
"bad https://github.com/developing-today/code/pull/9007199254740992 " +
"good https://github.com/developing-today/code/pull/124",
branch:
"bad https://github.com/developing-today/code/issues/99999999999999999999 " +
"good https://github.com/developing-today/code/pull/125",
lastActivityAt: "2026-11-02T00:00:00Z",
});

expect(fromEntry.taskRefs.sort()).toEqual([
"developing-today/code#123",
"developing-today/code#124",
"developing-today/code#125",
]);
expect(isSessionRecord(fromEntry)).toBe(true);
});
});
8 changes: 8 additions & 0 deletions pm-stack/aggregator/test/render.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ describe("ref parsing", () => {
);
expect(refs.sort()).toEqual(["developing-today/code#752", "dezren39/nix#501"].sort());
});
test("skips URLs with unsafe numbers while keeping valid refs", () => {
const refs = refsInText(
"bad https://github.com/developing-today/code/issues/99999999999999999999 " +
"bad https://github.com/developing-today/code/pull/9007199254740992 " +
"good https://github.com/developing-today/code/issues/123",
);
expect(refs).toEqual(["developing-today/code#123"]);
});
test("refUrl builds issue vs pr paths", () => {
expect(refUrl("developing-today/code#752", "pr")).toBe("https://github.com/developing-today/code/pull/752");
expect(refUrl("developing-today/code#752")).toBe("https://github.com/developing-today/code/issues/752");
Expand Down
Loading