Skip to content

feat(ui): let a link's slug settle a shared short-id prefix - #114486

Merged
steipete merged 2 commits into
mainfrom
steipete/session-slug-tiebreak
Jul 27, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/session-slug-tiebreak

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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.list round-trip to discover the collision set, and it
lengthens 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 that
found 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 to
collide: abcd1234-0aaa…/abcd1234-0bbb… with distinct names, and
beef5678-0aaa…/beef5678-0bbb… both named "Release notes".

Case Input Result
Tie, slug identifies one /chat/main/deploy-monitor-abcd1234 opens Deploy monitor
Tie, slug identifies the sibling /chat/main/billing-sync-abcd1234 opens Billing sync
Tie, no slug /chat/main/abcd1234 chooser
Tie, slug shared by both /chat/main/release-notes-beef5678 chooser, longer prefixes offered
Tie, slug matches neither /chat/main/some-old-renamed-thing-abcd1234 chooser
Already unique, wrong slug /chat/main/totally-wrong-slug-abcd12340a opens Deploy monitor, URL self-corrects

Unit 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.

@steipete
steipete marked this pull request as ready for review July 27, 2026 09:37
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Jul 27, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 6:01 AM ET / 10:01 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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
Reviewed head: 2fe1b02304dad73d36fd5279fe03a5bc906e2e9e
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused implementation, regression coverage, documentation, and concrete browser evidence make this a good-quality PR; the remaining blocker is intentional compatibility acceptance, not a patch defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body provides an after-fix isolated-gateway browser scenario with concrete before/after collision outcomes, including negative and incomplete-search cases; no additional contributor proof is needed.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides an after-fix isolated-gateway browser scenario with concrete before/after collision outcomes, including negative and incomplete-search cases; no additional contributor proof is needed.
Evidence reviewed 5 items Short-link parsing retains only a hint: The proposed parser extracts the prefix before a valid short ID as slugHint while preserving the short ID as the authoritative reference.
Tie-break is deliberately fail-safe: The proposed route loader only narrows an ambiguous, non-truncated result, and returns the original candidates when the hint matches zero or multiple sessions.
Focused regression coverage: The PR adds coverage for a unique slug within a collision, zero-or-multiple slug matches, and incomplete paginated search behavior.
Findings None None.
Security None None.

How this fits together

Control 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]
Loading

Decision needed

Question Recommendation
Should a short session URL's current display-name slug be allowed to resolve a complete UUID-prefix collision when it uniquely identifies one candidate, instead of always showing the chooser? Accept bounded tie-break: Merge the rule that a slug selects exactly one candidate only after a complete ambiguous short-ID lookup, preserving the chooser for stale, duplicate, and incomplete cases.

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

  • Resolve merge risk (P1) - This intentionally changes the documented short-link contract for a narrow existing-user case: an ambiguous UUID prefix with exactly one current slug match bypasses the chooser, so an owner should explicitly accept that compatibility behavior before merge.
  • Complete next step (P2) - No mechanical repair is indicated; the remaining action is owner acceptance of the intentional short-URL compatibility contract.
Agent review details

Security

None.

PR surface

Source +35, Tests +67, Docs +6. Total +108 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 43 8 +35
Tests 2 67 0 +67
Docs 1 13 7 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 123 15 +108

Review metrics

Metric Value Why it matters
Short-link resolution rule 1 ambiguity rule changed A uniquely matching slug now settles a complete short-ID collision, changing an existing user-visible URL outcome without changing URL shape.

Stored data model

Persistent data-model change detected: serialized state: packages/session-url-contract/src/parse.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm the URL contract, then merge (recommended)
    Have the responsible owner explicitly accept the documented chooser-to-direct-resolution change for uniquely slugged complete collisions.
  2. Keep chooser-only collisions
    Decline the behavior change if URL ambiguity should remain visible even when the current slug identifies one tied session.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a limited-scope Control UI URL-resolution improvement affecting rare short-ID prefix collisions rather than an urgent runtime failure.
  • merge-risk: 🚨 compatibility: Existing ambiguous short links with one current slug match will open a session directly instead of showing the prior chooser.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides an after-fix isolated-gateway browser scenario with concrete before/after collision outcomes, including negative and incomplete-search cases; no additional contributor proof is needed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix isolated-gateway browser scenario with concrete before/after collision outcomes, including negative and incomplete-search cases; no additional contributor proof is needed.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the merged gateway-backed session URL resolution work and this narrowly scoped follow-up, giving them the strongest visible history on the current URL-resolution behavior. (role: feature owner; confidence: high; commits: af552d4bc675, 5366385753b9, 2fe1b02304da; files: packages/session-url-contract/src/parse.ts, ui/src/pages/chat/route-loader.ts, ui/src/pages/chat/route-resolution.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain explicit owner acceptance of the documented short-link compatibility change before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-27T09:42:38.912Z sha a31207f72b948faae5fd9082abd5f85a7e98e488 :: needs maintainer review before merge. :: none

steipete added 2 commits July 27, 2026 02:55
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.
@steipete
steipete force-pushed the steipete/session-slug-tiebreak branch from a31207f to 2fe1b02 Compare July 27, 2026 09:56
@steipete
steipete merged commit b8e7f27 into main Jul 27, 2026
101 checks passed
@steipete
steipete deleted the steipete/session-slug-tiebreak branch July 27, 2026 10:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 28, 2026
…#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant