Repository navigation
feat(app): list sessions started from a session under it - #7450
Open
reachjalil wants to merge 1 commit into
Open
reachjalil wants to merge 1 commit into
reachjalil wants to merge 1 commit into
Conversation
A session can start other sessions: a side chat the person opens beside it,
or sessions its agent starts with session.create. Nothing recorded where they
came from. A side chat was a local split-pane pairing, hidden from the list
while attached, and a session the agent started was one more unrelated row
the agent had to poll with session.read.
Behind `sessionTree` (cloud and self-hosted, off):
- A session started from another records `openworkSessionLink`
({ kind: side | sub, parentID }) in the OpenCode session's metadata when it
is created, so every window agrees. The engine copies metadata to sub-agent
sessions and forks, so the app honors the key only on a top-level session.
v2 engine only, same workspace, two levels deep.
- The sidebar lists those sessions under their parent with a rail, in the
Workspaces view, Pinned and the Feed. The Feed keeps a parent and its
sessions together as rows of its own virtual list. A nested session's
header leads back to its parent.
- The server cannot read features, so before creating sessions it asks the
app's `session.tree` query whether the calling session can be a parent. The
app registers the query only while the feature is on. A linked result says
so and tells the agent a report will come.
- When a session an agent started finishes a turn, the app adds a note to
its parent in the engine's own shape for a finished background sub-agent.
The note's id comes from the engine's record of when the run ended, so two
windows add one note. It starts the parent's next turn only for a turn the
parent's agent asked for, once no other session it started is running, at
most 12 times an hour.
- Selecting text in a reply offers "Start a side chat", which opens a side
chat draft with the text quoted.
A prompt an agent sends with session.create or session.send on v2 now
records the sending session in the message's metadata, whether or not the
feature is on. Nothing shows it; reports use it to tell a turn the parent
asked for from one the person typed.
Turning the feature off flattens the sidebar again. Every session keeps a
row and nothing is deleted.
Signed-off-by: Jalil <reachjalil@gmail.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
Side chats and sessions the agent starts are now listed under the session they came from, and a session the agent started reports back when it finishes.
What problem does it solve?
Work started from a session lost its connection to it. You could not see which sessions belonged together, and an agent that started sessions had to keep checking on them.
What was the situation before?
A side chat was hidden from the sidebar while attached and became an unrelated row once detached. Sessions an agent started appeared as separate top-level rows, and the agent polled them with
session.read.How is this implemented?
sessionTree(cloud and self-hosted, off). Safe to kill: the sidebar goes flat again and every session keeps its row. Doc:docs/features/session-tree/README.md.openworkSessionLinkin the OpenCode session's metadata (packages/types/src/session-link.ts).sidebar/session-tree.tsbuilds the tree for the list, Pinned and the Feed.session.createasks the app's newsession.treequery before linking.links/session-report-bridge.tsxadds a note to the parent, in the engine's sub-agent format, when a started session finishes a turn.links/selection-side-chat.tsx: selected reply text offers "Start a side chat".What else changed?
session.createorsession.sendon v2 records the sending session in the message's metadata, with or without the feature. Nothing displays it.Release note
none
Evidence
No E2E; unit tests, typecheck and server bundle only:
apps/app/tests/session-tree*.test.ts[x]andapps/server/test/host-response.test.ts. Not yet run in the desktop app, so there is no screenshot.Design: P5, P11, S5, S7, C1, C3, V5