Repository navigation
feat(ui): let a link's slug settle a shared short-id prefix - #114486
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 6:01 AM ET / 10:01 UTC. ClawSweeper reviewWhat this changesThe PR carries the display-name slug from a short session URL into route resolution and uses it only to choose one session from a complete short-ID collision when that slug matches exactly one candidate. Merge readinessKeep open for explicit owner acceptance of the intentional short-URL compatibility change: a complete UUID-prefix tie with exactly one matching current slug now opens that session instead of showing the chooser. Likely related people: steipete (high confidence), based on the immediately preceding merged gateway-backed session URL resolver and this follow-up. Priority: P2 Review scores
Verification
How this fits togetherControl UI session links are parsed into a namespace, agent, and session reference, then the chat route loader queries the gateway for matching sessions. This change adds a non-authoritative slug hint so an otherwise ambiguous short UUID prefix can resolve directly while unresolved ties still go to the existing chooser. flowchart LR
A[Short session URL] --> B[URL parser]
B --> C[Short ID and slug hint]
C --> D[Gateway session lookup]
D --> E{Complete unique result?}
E -->|One candidate after slug tie-break| F[Open and canonicalize session]
E -->|Still ambiguous or incomplete| G[Disambiguation view]
Decision needed
Why: The implementation is bounded and documented, but it deliberately changes an established user-visible URL-resolution outcome rather than repairing an unambiguous broken contract. Before merge
Agent review detailsSecurityNone. PR surfaceSource +35, Tests +67, Docs +6. Total +108 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept the direct-resolution rule only if the owner agrees that a current slug may settle a complete short-ID collision; otherwise retain the existing chooser contract and close the feature direction rather than adding a parallel fallback. Do we have a high-confidence way to reproduce the issue? Yes — the described collision can be deterministically seeded with two session UUIDs sharing the referenced prefix, and the proposed regression tests encode the direct, stale-slug, duplicate-slug, and truncated-search paths. The supplied browser evidence reports the same scenarios against an isolated gateway. Is this the best way to solve the issue? Technically yes: retaining the slug as a subordinate hint and applying it only to a complete ambiguous candidate set is the narrowest implementation path. Whether that behavior is the best product contract remains an explicit owner decision because it changes what existing ambiguous links do. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d16c2dedd2b1. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Two sessions can share the first block of their uuid, which sent an otherwise exact link to the disambiguation view even though the slug in that link already said which session was meant. Capture the slug on short references and use it to break the tie. It can only narrow: a slug matching none or several of the tied sessions leaves the chooser alone, and a reference that already resolves uniquely is untouched. Generated links stay at their normal length instead of growing a full uuid.
A truncated candidate set is an unfinished search, not a tie: an unexamined page could hold the same short-id prefix under the same slug. Settling there would be the guess the bounded search exists to avoid, so keep the chooser.
a31207f to
2fe1b02
Compare
|
Merged via squash.
|
…#114486) * feat(ui): let a link's slug settle a shared short-id prefix Two sessions can share the first block of their uuid, which sent an otherwise exact link to the disambiguation view even though the slug in that link already said which session was meant. Capture the slug on short references and use it to break the tie. It can only narrow: a slug matching none or several of the tied sessions leaves the chooser alone, and a reference that already resolves uniquely is untouched. Generated links stay at their normal length instead of growing a full uuid. * fix(ui): never settle a slug tie from an incomplete search A truncated candidate set is an unfinished search, not a tie: an unexamined page could hold the same short-id prefix under the same slug. Settling there would be the guess the bounded search exists to avoid, so keep the chooser.
What Problem This Solves
Session links carry both a display-name slug and a short id, but only the id was
used to resolve them. When two sessions happen to share the first block of their
uuid, every generated link to either one — the sidebar, Sessions, Tasks, the
canonical URL a slug resolves to — landed on the disambiguation view instead of
the session, even though the slug in the link already said which one was meant.
Follow-up to #114422, which noted this as the remaining durability gap.
Why This Change Was Made
The obvious fix is to make generated references longer on collision, but that
needs an extra
sessions.listround-trip to discover the collision set, and itlengthens the URLs this work exists to keep short.
The information is already in the link. A short reference is written
<slug>-<shortId>, and the tied rows are already in hand from the lookup thatfound the tie, so the slug can settle it for free — no extra query, no longer URL.
The slug stays subordinate to the id. It can only narrow an already-ambiguous
result, never widen one or override a unique match, so a stale or hand-edited
name cannot point a link at the wrong session or 404 it. If the slug matches none
of the tied sessions, or several, the chooser appears exactly as before.
It also refuses to act on a truncated candidate set. Once the bounded five-page
search stops early the result is an unfinished search rather than a tie, and an
unexamined page could hold the same prefix under the same slug — settling there
would be exactly the guess that path exists to avoid.
User Impact
A short link to a session whose id prefix collides with another now opens that
session directly. Links are unchanged in shape and length. Genuine ties — same
prefix and same display name — still show the chooser with longer prefixes.
Evidence
Verified in a browser against a full
pnpm build, served by an isolated gateway(own
OPENCLAW_STATE_DIR, free port) seeded with two pairs of sessions built tocollide:
abcd1234-0aaa…/abcd1234-0bbb…with distinct names, andbeef5678-0aaa…/beef5678-0bbb…both named "Release notes"./chat/main/deploy-monitor-abcd1234/chat/main/billing-sync-abcd1234/chat/main/abcd1234/chat/main/release-notes-beef5678/chat/main/some-old-renamed-thing-abcd1234/chat/main/totally-wrong-slug-abcd12340aUnit coverage pins the positive case, both non-firing cases, and the truncated
search; the positive test
was confirmed to fail without the change. Gates: tsgo ui/core/test-ui/test-packages,
pnpm build, oxlint, oxfmt, docs map, and the full UI + contract suites (5959 passed).One pre-existing flake surfaced under parallel load,
router-outlet.test.ts > waits out a restarting gateway before falling back to revalidation. It passes in isolation with and without this change (3 runs each)and on a stashed tree, and it touches no code this PR modifies.