Skip to content

fix(workspace): unshared agent link with no chats shows no access (#4517) - #4544

Merged
vybe merged 3 commits into
Abilityai:devfrom
pcbeingused333:fix/4517-unshared-agent-no-chats
Nov 19, 2026
Merged

vybe merged 3 commits into
Abilityai:devfrom
pcbeingused333:fix/4517-unshared-agent-no-chats

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #4517

Description

A link to an agent that is not shared (/workspace/a/<name>, including a name that does not exist) is supposed to show "You don't have access to <name>" and no composer. That already happens once the person has at least one chat. With no chats yet, the same link kept the other agent's name in the URL and opened the person's first own agent, composer included ("Start a conversation below.").

The watcher that decides this reads [activeAgentPageName, threads.length] and returns while rosterLoaded is still false, so it does not mark a shared agent unreachable before the roster arrives. It only runs again when the route name or the thread count changes. A person with no chats keeps that count at 0 after the list comes back empty, so the watcher never ran again. unreachableAgent stayed unset, and activeAgent fell back to agents[0].

The watcher now also runs when the roster verdict arrives. The "no access" branch still needs only the roster. Landing on a chat still waits until the thread list has been read: waking on the roster alone, before that read, would open a new chat against an empty list, and the later count change would treat that landing as already done.

Related Issue

Fixes #4517

Journey Impact

Journey Impact: none: the existing no-access stage now shows for a person with no chats; no journey promise changes

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Testing

  • I have tested this locally
  • New tests added (if applicable)
  • All existing tests pass
  • Every new test executes the changed path

#4517 in tests/unit/portalUnavailableTargets.mount.spec.js mounts the workspace shell on /workspace/a/stranger with the route already set, then lets the roster load and the thread list come back empty (length stays 0). It expects the no-access stage for stranger, the same URL, no conversation, and the back control. The same file's #3140 cases still cover a person who already has a chat, and an agent that is on the roster.

Before this change that test failed: the shell text did not contain "You don't have access to". After it, the filtered run passes (1 passed, 12 skipped) and the whole file passes (13). Neighboring landing mounts also pass: portalAgentLandingStage.mount.spec.js, portalAgentLandingRemount.mount.spec.js, portalDraftLanding.mount.spec.js, workspaceKeymap.mount.spec.js (77).

The stage is the existing #3140 block. Its classes already include the light and dark tokens; this change does not branch on theme.

Mutation: with rosterLoaded removed from the watch sources, the #4517 test fails on the access copy. Restored, it passes.

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation (if applicable)
  • I have not committed any sensitive data (API keys, credentials, etc.)
  • I have added appropriate logging for new functionality

Prepared with AI assistance.

The /workspace/a/:name watcher returned while the roster was still
loading and only ran again when the route name or the thread count
changed. With no chats the count stays 0, so the watcher never ran
again and the stage fell back to the first own agent.

Fixes Abilityai#4517
@vybe

vybe commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-11-17): not on this train — one finding to fix. Validated at bad49616e.

The intended fix works: a person with no chats who opens an unshared agent link now sees the no-access stage, and reverting Portal.vue turns the new test red.

Finding — the new threadsLoaded guard (src/frontend/src/views/Portal.vue:3154) stops agent-page landing whenever the thread list did not load cleanly. threadsLoaded only latches on a clean sessions read (:2398) and is not a watch source (:3140). While store.sessionsFailed is true, clicking an agent in the sidebar moves the URL but the stage does not follow.

Reproduced in this PR's own harness: arm({ sessionsFail: true }), boot on /workspace/c/t1, emit open-agent 'sage' from PortalSidebar.

Portal.vue URL after click Conversation on stage
dev /workspace/a/sage sage, newChat: true
this PR /workspace/a/sage scout, newChat: false

So a live composer for one agent sits under another agent's URL, and it only recovers if a later clean read changes threads.length — a person with zero chats never recovers. dev handles this path correctly today.

The guard itself is needed (removing it turns portalDraftLanding.mount.spec.js red), so this needs your call on what "thread read settled" means when the list failed — land as dev does, or show a failed state — plus a test for the failed-list side.

Optional, same area: a cold link to a reachable, non-first agent with zero chats (/workspace/a/sage) still shows the first agent, on dev and here alike. Adding threadsLoaded as a fourth watch source fixes that (the five neighbouring specs stay green) but does not fix the finding above.

Rides the next train once fixed. status-needs-fix is set; on a fork PR it does not clear on push, so a maintainer removes it on re-review.

@vybe vybe added the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Nov 17, 2026
A failed sessions read never latches threadsLoaded, so the new guard kept the
previous conversation on stage under the clicked agent's URL. Treat a failed
list as settled and re-run the watcher when sessionsFailed changes.
@vybe vybe removed the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Nov 19, 2026
…es empty (Abilityai#4517)

threadsLoaded gated the landing watcher without being one of its sources,
so a click on an agent while the first thread read was in flight never
landed for a person with no chats. It is now a watch source. Tests cover
that case and pin the sessionsFailed source on a cold agent link.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vybe

vybe commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-11-19): validated at 92433054b. The 11-17 finding is closed: with a failed thread list, clicking an agent now lands on it, and flipping sessionsFailed on a landed page neither mints a second chat nor resets the composer.

One narrower case was left, and I pushed the fix for it to this branch (9255e1db3) so the PR can ride today:

  • What was wrong: threadsLoaded gates the landing watcher but was not one of its sources. A person with no chats who clicks a non-first agent while the first thread read is still in flight never lands, because the read settles empty and threads.length stays 0. The stage kept the first agent under the clicked agent's URL.
  • What changed: threadsLoaded is now a watch source (Portal.vue, one line plus a comment). This also fixes the cold link to a reachable non-first agent with no chats, which was the optional note from 11-17.
  • Tests added to portalUnavailableTargets.mount.spec.js: the in-flight click (red before the change), and a cold /workspace/a/sage load with a failed list, which pins the sessionsFailed source you added (it goes red if that source is removed).

The ten neighbouring Portal mount specs and the three ratchets pass, 183 tests. @pcbeingused333 please pull before pushing anything further. One thing left as is, for a follow-up if it matters: a cold link that lands a new chat during a failed read stays on it when a clean list arrives later.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge-train (2026-11-19): validated at 9255e1d; batch green on #4667.

@vybe
vybe merged commit afadff7 into Abilityai:dev Nov 19, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants