Skip to content

Commit c78efb8

Browse files
authored
Merge pull request #81 from youdie006/fix/continue-project-suffix
fix: match a continued thread's project by its whole name
2 parents e6ed911 + 2d54c37 commit c78efb8

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Fixed
1010
- When ChatGPT's page could not draw an answer, prodex saved the page's own error, "This response couldn’t load", as the answer, and the consult reported done with its request verified. `pro browser recover` saved the same sentence again, because the tab was already on the thread and was not loaded again. Found 2026-10-30 in the browser container: Chromium could not start threads there, and ChatGPT held the finished answer ("OK") while the page showed the error in its place. A send now stops as `answer_render_failed` and names the `recover` command. Recovery loads the thread once more when it finds the error, and returns the answer drawn after that. If the error is still there, recovery stops as `answer_render_failed` instead of saving it. Checked live on WSL by marking an answer the way the failed page did: 0.40.48 recovered the error text; the fix blocked the send, then recovered "PROBE7731" once the page could draw it.
1111
- `--tool " "` (a tool name of only spaces, such as an empty script variable) was accepted, and the prompt went out with no tool and no warning. Measured 2026-10-29. MCP `pro_consult` with a blank entry in `tools` did the same. Both now stop before the browser with "--tool is blank".
12+
- `--continue` (and MCP `continue_thread`) matched the project by the end of a recorded thread's address, so `--project Notes` also accepted a conversation of a project called "My Notes" (`g-p-<id>-my-notes`). The project's id is read from the sidebar first; when the sidebar could not be read and no recorded thread carried exactly that name, the follow-up continued the other project's conversation. The thread it continues skips the project step, so the prompt went into that project. Found 2026-10-30 reading the matcher. The name must now be all of what follows the project id.
1213

1314
## 0.40.48
1415

‎src/continue-thread.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ export function threadMatchesProject(
114114
// of them slug to "". The id is the only thing that identifies those, and
115115
// the caller reads it off the live sidebar.
116116
const slug = chatGptProjectSlug(project);
117-
// The id comes first and the name follows it, so an exact suffix match keeps
118-
// "notes" from answering for "notes-archive".
119-
if (slug && projectSegment.toLowerCase().endsWith(`-${slug}`)) return true;
117+
// The segment is "g-p-", the id, a dash and the name, so the name has to be
118+
// all that follows the id. A suffix test let "notes" answer for "my-notes";
119+
// a prefix test would let it answer for "notes-archive".
120+
const named = /^g-p-[0-9a-f]+-(.+)$/i.exec(projectSegment)?.[1]?.toLowerCase();
121+
if (slug && named === slug) return true;
120122
// No name in the URL: fall back to the id this project has been seen using.
121123
// Nothing is guessed - the id came from another record of the same project -
122124
// and it survives a rename, which the name comparison cannot.

‎tests/continue-thread.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,21 @@ describe("matching a recorded thread to a project", () => {
257257
expect(threadMatchesProject(thread("aaa", "notes"), "Notes")).toBe(true);
258258
});
259259

260+
it("tells a project from another whose name ends the same way", () => {
261+
// The name was matched as a suffix of the URL segment, so "Notes" also
262+
// answered for "My Notes" (g-p-<id>-my-notes). When the sidebar could not
263+
// be read, --continue --project Notes picked that project's conversation,
264+
// and the follow-up went there: the pinned thread skips the project step.
265+
expect(threadMatchesProject(thread("aaa", "my-notes"), "Notes")).toBe(false);
266+
expect(threadMatchesProject(thread("aaa", "my-notes"), "My Notes")).toBe(true);
267+
const resolved = resolveContinuationThread({
268+
consults: [{ taskId: "task_other", sessionKey: "client-a", thread: thread("aaa", "my-notes"), status: "done", createdAt: "2026-10-30T00:00:00Z" }],
269+
project: "Notes",
270+
sessionKey: "client-a"
271+
});
272+
expect("error" in resolved).toBe(true);
273+
});
274+
260275
it("counts a root chat as belonging to no project", () => {
261276
expect(threadMatchesProject(thread("aaa"), undefined)).toBe(true);
262277
expect(threadMatchesProject(thread("aaa"), "Notes")).toBe(false);

0 commit comments

Comments
 (0)