Skip to content

feat(threads): mark agent-created group threads - #752

Merged
lastobelus merged 5 commits into
lastcode/mainfrom
lastcode/group-thread-marker
Nov 19, 2026
Merged

lastobelus merged 5 commits into
lastcode/mainfrom
lastcode/group-thread-marker

Conversation

@lastobelus

@lastobelus lastobelus commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Part of #751

Problem

An agent can create a thread only to hold other threads. Nothing records that role, so clients can't tell a group container from another empty thread.

Change

New optional groupThread: true on the persisted AppThread JSON. It is absent for ordinary threads. It appears in the shell and in t3_thread_list and t3_thread_read.

The server sets it for t3_thread_launch with no message or attachments and for create_threads with no prompt. Delegated task preparations, native imports, and user-created threads receive ordinary thread records.

The first accepted run or standalone conversation message clears the flag. It stays cleared if the run later stops or fails. The server emits the cleared thread in an ordinary metadata event in the same transaction, after the command’s other metadata updates. The first-use rule lives in the fork-owned planGroupThreadUse.ts.

The historical backfill writes a durable event at startup. It requires an agent-created MCP thread that is non-deleted, has ordinary lineage, and has no runs, messages, delegation, imported history, or active provider thread. It also requires at least one currently placed, non-deleted child in the same project. The marker gives follow-up work a way to find the group while existing placement and archive behavior continue to follow their current rules.

The LastCode web and desktop sidebar shows the existing agent bot icon before an italic title. This PR limits the visual treatment to that sidebar. The Inbox and mobile clients receive the compatible contract. The feature is provider-independent and uses the existing projections for connected clients. It adds no translated strings.

Verification

  • 61 focused tests and a launch lifecycle test, 27 sidebar browser tests, and two React compiler checks passed.
  • The backfill marked one of 188 threads in a seeded copy of the real database. The marked thread had one placed child, zero runs, and zero messages. A second pass marked zero rows.
  • In the isolated app, both MCP list and read returned the marker on an empty launch. The sidebar displayed an italic title with a leading bot icon. The first Replay run removed the marker from MCP read.
  • Local Quick CI was deferred to GitHub because local capacity was busy.

Implemented with GPT-6.2 Sol in the Codex harness.

Local review: 3 rounds with GPT-6.1 Terra (xhigh), approved. The third round reviewed the command-based lifecycle revision.

Upstream-owned files

Files present in origin/main. Counts are relative to the PR base.

File Added Removed
apps/server/src/mcp/OrchestratorMcpService.ts 5 1
apps/server/src/mcp/toolkits/project/handlers.test.ts 2 0
apps/server/src/mcp/toolkits/project/handlers.ts 3 1
apps/server/src/orchestration-v2/Orchestrator.ts 23 2
apps/server/src/orchestration-v2/ProjectionMaintenance.ts 1 0
apps/server/src/orchestration-v2/ProjectionStore.ts 10 0
apps/server/src/orchestration-v2/ThreadLaunchService.test.ts 25 0
apps/server/src/orchestration-v2/ThreadLaunchService.ts 2 0
apps/server/src/orchestration-v2/ThreadManagementService.ts 1 0
apps/server/src/relay/AgentAwarenessRelay.ts 1 0
apps/server/src/serverRuntimeStartup.ts 13 0
packages/client-runtime/src/state/models.ts 2 0
packages/client-runtime/src/state/orchestrationV2Projection.ts 2 0
packages/contracts/src/orchestrationV2.ts 15 0
packages/contracts/src/orchestratorMcp.ts 2 0
Total 107 4

Sidebar captures

Before

An empty agent-created thread shown with a plain title and a trailing bot icon

After

The same empty thread shown with a leading bot icon and an italic title

Empty agent-launched threads have no stored role. Record their group marker, clear it on first use, and mark historical parents with current placement evidence.

Carry-Group: incubator
Carry-Fix: #751
Implemented-by: GPT-6.2 Sol in the Codex harness.
@lastobelus lastobelus changed the title Mark empty group threads in the LastCode sidebar feat(threads): mark agent-created group threads Nov 19, 2026
@lastobelus
lastobelus marked this pull request as ready for review November 19, 2026 22:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T22:45:01.043575Z 7ead5df Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 6c8f2e52a9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Show the agent icon before the title and italicize the name so users can identify group threads in the LastCode sidebar.

Carry-Group: incubator
Carry-Fix: #751
Carry-Observation: This uses the agent icon and translated badge behavior already replayed in Incubator.
Implemented-by: GPT-6.2 Sol in the Codex harness.
Group creator warnings could interrupt the title prefix. Put warnings in trailing metadata and keep the bot icon with the title.

Carry-Group: incubator
Carry-Fix: #751
Carry-Observation: This uses the agent icon and translated badge behavior already replayed in Incubator.
Implemented-by: GPT-6.2 Sol in the Codex harness.
Completing the original fixture run can start the queue before the fixture marks the admitted Pause complete. Write both completion events under the thread lock so the replay test reaches its admission assertions.

Carry-Group: incubator
Carry-Fix: #751
Implemented-by: GPT-6.2 Sol in the Codex harness.
@lastobelus
lastobelus force-pushed the lastcode/group-thread-marker branch from 6c8f2e5 to 25d08f8 Compare November 19, 2026 22:15
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 25d08f897c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Emit the cleared thread snapshot after the first accepted use and after all other command metadata is planned. Server and client reducers can apply the existing metadata event.

Carry-Group: incubator
Carry-Fix: #751
Implemented-by: GPT-6.2 Sol in the Codex harness.
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 7ead5dfbe6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lastobelus
lastobelus merged commit 214b53f into lastcode/main Nov 19, 2026
32 checks passed
@lastobelus
lastobelus deleted the lastcode/group-thread-marker branch November 19, 2026 23:11
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.

1 participant