Repository navigation
Conversation
vastsa
left a comment
There was a problem hiding this comment.
Confirmed the original attach identity defect independently with the production createHostSessionPort: for a path-only session.get record and matching projects.list row, baseline returns projectId: undefined, while this head returns "7". The new renderer tests plus adjacent remote session/project tests pass 24/24; host-ports tests pass 8/8. Diff whitespace check passes, and this head contains current origin/main fad88dd.
One identity-consistency case still needs fixing in withProjectIds before landing:
- Input records:
[{id: "existing", projectId: "authoritative-id", projectPath: "/work/project"}, {id: "legacy", projectPath: "/work/project"}]. projects.listreturns[{id: 7, path: "/work/project"}].- Executing the actual candidate helper returns projectId
"7"for BOTH records. The existing authoritative ID is overwritten because the second record triggers the batch lookup and the final map unconditionally replaces any matching path. - Calling
createHostSessionPort.getfor the first record alone preserves"authoritative-id"(no lookup). Thus list and attach can still disagree for the same supported record shape, exactly the invariant this fix is intended to establish. This contradicts the documented rule that an already-reported ID is authoritative.
Please resolve the ID per record as record.projectId ?? pathLookup (using the same presence semantics as needsLookup), retaining the existing ID even when another record requires lookup. Add a mixed-batch regression that checks both the preserved explicit ID and the filled legacy ID, and list/get consistency. No persistence or protocol change is needed.
Live E2E-231 remains NOT RUN; I have not treated these unit/render checks as live paired-host or Electron acceptance. After the identity case is fixed, the matching-revision integration candidate still needs the relevant process/UI acceptance required by AGENTS.md §16. No remote CI checks were reported on this head at review time.
vastsa
left a comment
There was a problem hiding this comment.
Rechecked head 4f732f9703cbdf8933f83ccc28ed74f9ea7ae71b by executing the actual updated withProjectIds and createHostSessionPort.get. The previous blocker still reproduces unchanged: the mixed batch containing an explicit authoritative-id record plus a path-only record for /work/project returns 7 for both, while get of the explicit record returns authoritative-id. The helper still unconditionally replaces the ID from the path map. Please preserve each record’s existing ID before falling back to the path lookup and add the mixed-batch/list-get regression requested in the previous review.
The new remote model catalog/usage functionality and manual paired-host evidence do not resolve this identity mismatch. Please split the model/usage protocol feature into a separate PR so the project-group identity fix can be validated and landed independently with the smallest coherent scope. No approval or merge on this head; broader landing checks were stopped at the independently reproduced root-cause blocker.
host-core keys a session by its project path, while RACP exposes the project id. `session/list` decorates its rows from the projects table, but `session/attach` resolves the same session through `createHostSessionPort`, which returned the raw record. The attach snapshot therefore carried no `projectId`, the renderer replaces its cached summary with that snapshot when a conversation opens, and the session leaves its host project group for the top-level session list. Move the decoration into `withProjectIds` in host-runtime so both the session catalog and the Agent Host port resolve project identity the same way, and cover it with the attach path in the host-port tests.
A remote project group had no disclosure affordance and no group body wrapper, so its rows could not be collapsed and every row sat flush with the header. The session row's source tag had no CSS rule at all, which left it as a bare shrinking flex item: in a narrow sidebar the two glyphs folded into a vertical stack instead of reading as a horizontal badge. Rebuild the host group on the same section/header/body/clip/list structure as a local project group, reuse the shared `projectCollapsed` state so the fold survives a restart and never leaks a catalog key into `openProjectPaths`, and give `.thread-item-source` the fixed, single-line treatment its neighbours already have.
The decoration added for attach snapshots asked the projects table on every `session.get`, even when the record already carried the RPC field. That put an extra host round-trip on the session-open path and broke hosts whose RPC surface answers sessions but not projects — the desktop production harness is one, and it started failing on an unexpected `projects.list`. Only records that carry a path without an id need the lookup now. Nothing changes for the remote host that motivated the fix: its records report the path alone, so it still resolves an id, and a reported id stays authoritative instead of being overwritten by a table read.
The host project group is the one sidebar surface keyed by `[hostKey, projectId]` instead of a path, so the local group's checks never reached it. Render the real component through the store and locale and assert the parts that went missing: a header toggle that owns `aria-expanded`/`aria-controls`, the body/clip/list wrapper the fold needs, `inert` plus `aria-hidden` while collapsed, and the new-task action still reachable on a folded group. Against the previous component three of the four cases fail, so the suite holds the shape rather than describing it.
Host-owned groups trailed the local project list with no heading, so a host project read as a retained local one, and each of its conversations repeated a "Remote" chip the heading now carries. The group header also used the generic button primitive, whose padding and centering pulled the chevron and folder off the rail every local group shares. Groups now sort through the same project order the local list uses instead of following whichever host session row arrived first, so opening a conversation in one host project no longer moves that group above another.
`withProjectIds` filled every row from the project-path lookup, so one legacy row on the same page rewrote the id another row had already reported: the batch returned `7` for a record whose single `get` returned its own id, and `session/list` could disagree with `session/attach` about which project a session belongs to. The lookup is a fallback now, decided with the same presence rule that decides whether a lookup is needed at all, so a mixed page and a single read always resolve the same id for the same record.
4f732f9 to
0932f9f
Compare
|
Both points are addressed. 1. The mixed-batch id override is fixed in
I ran both against the previous head first and they failed with your exact 2. The model/usage protocol feature is split out into #2379. This pull request is now the project-group scope only: the attach identity fix On E2E-231: I have not claimed it as run on this head. A manual paired-host run |
|
Rechecked 0932f9f with current main e17e5e7 in an isolated integration worktree. The mixed-batch/list-get identity blocker is resolved: production host-port tests pass 10/10, including authoritative ID preservation. Renderer/grouping tests pass 16/16 after building the candidate locale package. The model/usage feature has been split out as requested. Desktop build and diff check pass. The adjacent Electron remote-mvp-ui acceptance fails at “Backdrop click did not close the dialog”; I ran the same suite on main and reproduced the identical failure, so this is not evidence of a regression in this PR. This suite also does not prove the matching-revision paired-host list → attach → group retention and restart/collapse acceptance required for E2E-231. That process/UI acceptance remains NOT RUN, and there are no remote CI checks on this head. Please provide a runnable matching-revision E2E covering that path (including persisted collapse and stable project ordering) so the now-correct identity fix can be landed with integration evidence. No new source defect is asserted by this comment. |
|
Closing in favour of #2394, because #2370 was fixed on That merge (27ec1a4) already carries the identity rule this branch implemented — What was still missing after #2382 is the sidebar presentation the report also On the E2E request in your last comment: #2394 runs the paired-host journey at Thanks for the independent reproduction of the mixed-batch defect; that case is The remote model catalog and usage report stay in #2379, which is on current |
Fixes #2370
Summary
Three defects in the sidebar's host project groups — the project surface
keyed by
[hostKey, projectId]instead of a filesystem path — plus thepresentation gaps that made a host group read as a local one:
could not be folded, and its rows sat flush with the header.
.thread-item-sourcehad no CSS rule at all, so the remote source tag was abare flex item with no
nowrap: in a narrow sidebar it shrank until its twoglyph clusters stacked vertically.
had been opened, the group itself disappeared from the sidebar.
order, and their header used the generic button primitive, whose padding and
centering pulled the chevron off the rail every local group shares.
This pull request is the project-group scope only. The remote model catalog and
context-usage protocol feature was split into #2379 at review request, so this
diff stays landable on its own.
Root cause
host-core stores a session's
project_path; RACP exposes aprojectId.apps/pi-host/src/host-operations.tsdecoratedsession/listrows from theprojectstable, but the Agent Host resolves the very same session throughcreateHostSessionPort(packages/host-runtime/src/host-ports.ts) forsession/attach, prompts, and configuration, and that port returned the rawrecord.
attach.snapshot.sessiontherefore carried noprojectId, and Electronmain replaces its cached summary with that snapshot when a conversation opens
(
remote-history.read->racpSessionToSummary).remoteProjectIdbecameundefined, so the row could no longer be matched to its host project, and thegroup vanished once it had no rows left.
Group order had a second, independent cause:
groupRemoteProjectSessionsreturned the host's session-array order, so the project that was just opened
moved to the top while the retained local list stayed put.
Same
session.getrecord, old code vs this branch:Fix
packages/host-runtime/src/host-ports.ts— exportwithProjectIdsanduse it in
createHostSessionPort.get, so every consumer of the same sessionreports the same project identity. A record that already carries the RPC field
is authoritative and costs no lookup, so a host that reports ids pays nothing
while a path-only host still resolves one. The path lookup is a per-record
fallback, never a batch-wide override: a mixed page keeps each row's own id,
and
session/listcannot disagree with a singlegetof the same row.apps/pi-host/src/host-operations.ts— drop the private copy of thedecoration and reuse the shared helper; its
hostErrormapping stays.apps/desktop/src/components/remote/RemoteProjectGroups.tsx— rebuild thegroup on the same section/header/body/clip/list structure as a local project
group, with a chevron,
aria-expanded/aria-controls,inertplusaria-hiddenwhile folded, and the sharedprojectCollapsedstate so thefold survives a restart. The catalog key never reaches
openProjectPaths, soit cannot resurrect a group after the project is gone. The
+action stillcreates a session and is not part of the toggle. The header now uses
TooltipButtonwith the sidebar's ownsidebar-session-group-title/sidebar-session-group-addclasses, so the chevron and folder land on thesame rail as a local group.
apps/desktop/src/lib/project-order.ts(new) — the project sort moved outof
Sidebar.tsxinto one helper used by both the local list and the hostgroups, so a host group's position follows the sidebar sort (
recent,created,oldest,name) instead of session arrival order.apps/desktop/src/components/Sidebar.tsx— host groups are emitted undertheir own
Remoteheading (data-sidebar-section="remote"), rendered onlywhile at least one host group is visible, and rows inside that section no
longer repeat a per-row
Remotebadge.apps/desktop/src/styles/sessions.css— give.thread-item-sourcethefixed, single-line, muted badge treatment its neighbours already have, and add
.sidebar-list-subheaderfor the second section heading.03-runtime/19-remote-agent-control-protocol.mdsection 5.1states the id is stable across
session/list,session/get, and the attachsnapshot;
04-ux/01-ui-ia.mdstates host groups share the localheader/disclosure/inset treatment, sit under their own
Remoteheading, andfollow the project sort;
06-delivery/e2e/live-and-remote.mdE2E-231 expectsthe kept group and the fold.
Tests
pnpm --filter @pi-desktop/host-runtime testnode --teston the 4 touched desktop test filespnpm --filter @pi-desktop/desktop typecheckpnpm check:pr-baseorigin/main(29043af)New coverage:
packages/host-runtime/src/host-ports.test.ts—get()keeps the project idfor the attach path (
session.get+projects.list), leaves a session whoseproject row is gone undecorated, skips the lookup when the record already
reports an id, keeps each record's own id when the same batch also needs a
lookup, and reports the same id from a single
getand a mixed batch.apps/desktop/test/remote-project-groups.test.mjs— renders the realcomponent through the store and locale: header toggle with
aria-expanded/aria-controls, the body/clip/list wrapper,inert+aria-hiddenwhile folded, the+action still reachable on a folded group,the fold stored in shared project state without touching
openProjectPaths, theRemoteheading and its single-rail inset, theper-row badge being gone inside that section, and every locale naming it.
apps/desktop/test/remote-project-session.test.mjs— group order comes fromthe sort mode, so the same two host projects produce the same order whether
the host lists the opened session first or last.
Not run
live-and-remote.md) is not re-run as an automated suite on thishead. Desktop and host versions must match exactly (
HOST_VERSION_MISMATCHotherwise). A manual paired-host run on a macOS arm64 host built from the
pre-split head covered the sidebar behaviour this pull request changes
(fold, shared rail,
Remotesection, stable group order, existing sessionsuntouched); the only difference on this head is the mixed-batch id rule,
which real host-core records never exercise because they carry a path and no
projectId.pnpm -r --if-present test: thepi-hostsuite fails on this Windows host atboth revisions —
config.test.tsexpects/data,admin-socket.test.tsneeds a Unix domain socket (
ADMIN_UNAVAILABLE), andhost-operations.test.tsasserts POSIX paths (17 failures, unchanged by thisbranch).
failures, not this change: a baseline worktree at
2b279cfran the same 29failing test files and produced exactly the same failure set (set
difference 0): macOS notarization/signing, POSIX
shand SSH/sockettransports,
D:\path assertions, Electron window fixtures that time out onthis host, and one non-ASCII-path module-hook crash.
Scope
host-ports.ts+ its tests,apps/pi-host/src/host-operations.ts,RemoteProjectGroups.tsx,Sidebar.tsx,project-order.ts,sessions.css,three spec/UX paragraphs. No protocol, persistence, or database change.