Skip to content

feat: reference threads across authorized client connections - #543

Open
lastobelus wants to merge 19 commits into
lastcode/mainfrom
lastcode/universal-thread-mentions
Open

lastobelus wants to merge 19 commits into
lastcode/mainfrom
lastcode/universal-thread-mentions

Conversation

@lastobelus

@lastobelus lastobelus commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Thread references were limited to the execution environment and its machine peer links, even when the client could read threads elsewhere. This adds live, read-only @ references across projects and connected environments where the client is authorized to read history. Discovery includes archived threads, older settled threads, and completed subagent threads.

References explicitly capture the client's read authority and preserve the source environment and thread identity through pagination. That authority is separate from existing machine peer reads; machine-directed operations keep their peer routing. Picker selection, paste/drop, restored drafts, queued edits, Auto routing, and mobile outbox delivery preserve scoped references. When access is unavailable, the app reports it without automatically falling back to transcript exports or dropping drafts.

Validation at head d1d0f82608005cd73863b00390147a4a1c738fb0, based on canonical b31e26f7b2357bf2def72524d257b784d88fd1a0:

  • Changed-file validation passes: 1,154 tests across 61 files, 30 React compiler checks, 35 affected-package typechecks, formatting, lint, both unused-code checks and GraphQL. Quick CI passed this exact clean head/base in run 61903e10-ab17-4980-896c-56fe83f4ebdd.
  • Astra High's current-base integration review is clean. Rebase resolutions preserve upstream mobile model selection, caller validation before cross-environment reads, and sidebar-independent mention eligibility. Two test fixtures were updated for current upstream APIs and search triggers; the deliberately malformed-history cases pass 48 focused tests.
  • A real isolated web/client/server test selects a completed subagent without a cached sidebar shell, retains its exact identity/title/text after closing the picker and reloading, then reads it through a real Luna turn on a different environment. The recorded call uses the exact source IDs and via: "client"; both test servers have zero peer links and the observed Linked environments Labs setting is off. The source history is a schema-validated projection fixture, not evidence of delegation creation.
  • Bounded web coverage also includes archived/cross-project discovery, paste/drop, restored drafts, history pagination/item routes, source revocation with draft retention and send blocking, question answers, queued edits, scratch sends and two-model Replay fan-out into distinct worktrees with identical references. Replay fan-out proves context preservation, not agent history reads. Earlier runtime results and screenshots.
  • Focused runtime tests cover scoped authority through live/resumed answers, queue edits, direct steering, promotion and delegation cutoffs. Indexed authorization-reuse checks avoid hydrating user bodies, preserve thread/user-role boundaries and the post-await first-binding check, and tolerate malformed history without granting fresh authority. Mobile rechecks access after asynchronous preparation immediately before delivery. Prior focused Astra High reviews are clean.
  • All changed feature copy and agent guidance received the requested Astra Medium writing and Opus prose passes. Accepted wording findings were applied and verified. No second clean Opus verdict is claimed; the maintainer accepted context growth through agent-context-increase.
  • Native subscription evaluations work without API keys. Historical evaluated-source results are retained: 722 graded samples, 647 passes and 75 failures; 16 ungraded errors and 430 quota-blocked samples. Mention-specific cases passed all 15 model/case groups by majority, 30 of 31 samples. A shared instruction changed in the new checkpoint, so full current-source runs are active for all 116 cases on each of Luna, Sol and Astra. Claude Sonnet and Opus reached genuine weekly subscription quota. These native CLI runs serialize prior turns and use a different fake-tool presentation from HTTP replay; errors and broader control failures are retained. No full-suite pass is claimed.
  • Published upstream source through nightly .3977 was inspected. The current base includes .3969, while .3977 remains unincorporated. Its archived-project, session-renewal, reference-projection and composer-control changes have concrete future integration checks in the plan; they do not replace the explicit client/peer authority split. Source review establishes neither binary equivalence nor runtime acceptance.
  • Native acceptance remains incomplete: the iOS helper rejects the available Intel host, and the prior development build is blocked by Clerk's Swift tools 6.2 requirement on the available Xcode. Android SDK is absent. No native app was installed/launched, live LastCode installation changed, or extra checkpoint started.

DO NOT MERGE. Exact-head GitHub CI and Codex review must refresh after publication. Electron/native acceptance, Auto final-destination coverage, the complete live permission/session-renewal/version-skew matrix and full current-source model evaluations remain open.

Incubator retains ownership of this feature: discovery, composer lifecycle, captured-client authority, and provider projection belong together. Broader linked-environment tracking is outside this PR.

Implementation: GPT-6.1 Sol and GPT-6.1 Terra via Codex. Title, description and copy: GPT-6 Astra Medium via Codex. Copy review: Claude Opus 5.5 via Claude Agent.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T15:06:54.491564Z d1d0f82 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

@lastobelus lastobelus changed the title feat(threads): mention threads across projects and environments feat: reference threads across authorized client connections Oct 29, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 694d796189

ℹ️ 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 added the agent-context-increase Intentional agent context growth approved by a maintainer label Oct 29, 2026
@lastobelus
lastobelus force-pushed the lastcode/universal-thread-mentions branch from 694d796 to ab13f7b Compare October 29, 2026 08:15
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@lastobelus
lastobelus force-pushed the lastcode/universal-thread-mentions branch from ab13f7b to 6f60b4e Compare October 29, 2026 09:17
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6f60b4e0b4

ℹ️ 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

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: a75258c047

ℹ️ 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

Copy link
Copy Markdown
Owner Author

Verification on rebased head a3286e3bb61bf940b7ead73c933762ad9353adc9, based on 1c9bae31f2a577ba126f4134f8fc4faf5facfdf6:

  • In an isolated real web client, the picker found threads in two projects on another environment. An archived thread absent from the sidebar remained searchable and selectable.
  • The selected reference survived a reload without being marked missing.
  • A UI-started Luna turn read the archived source history and returned its exact test message. Separate pagination and truncated-item reads preserved environmentId, threadId, and via:"client" on all three calls. No server peer links were configured; the isolated server's linked-environment Labs setting remained at its default off.
  • Disabling the source client connection marked the chip unavailable and blocked sending while preserving the draft and reference. Re-enabling it restored the chip's normal state.
  • 176 focused tests across 16 changed test files passed; affected-package typechecks, formatting, lint, GraphQL and unused-code checks passed. The complete changed-file gate is being refreshed before publishing this rebased head.

UI evidence below shows the picker and the retained draft with an unavailable source. Machine labels were replaced with a generic label for these captures; feature state and content were not changed.

Cross-project picker, including archived history

Retained reference after disconnecting its source

DO NOT MERGE. This is bounded web acceptance, not completion of the full planned client matrix. Electron-specific and native mobile QA, remaining lifecycle scenarios, full per-model evaluations, and Opus wording review remain open. The browser session was manually paired; automatic preview authentication is not verified. The eval runner stopped before model calls because its configured proxy prerequisite is absent; Claude's API-key prerequisite is also absent. No provider configuration, live environment settings, installation or restart was changed.

@lastobelus
lastobelus force-pushed the lastcode/universal-thread-mentions branch from a75258c to 702134d Compare October 29, 2026 19:30
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 702134df44

ℹ️ 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".

Comment thread apps/web/src/pendingUserInput.ts Resolved
lastobelus added a commit that referenced this pull request Oct 29, 2026
Capture the answering client for exact references in accepted question answers. Preserve the original run authority for other reads, reject replay after binding loss, and carry scoped access into resumed and delegated runs.

Keep raw references in history and expand their instructions only for provider delivery, so question summaries show readable titles.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
@lastobelus
lastobelus force-pushed the lastcode/universal-thread-mentions branch from 702134d to 69f0b28 Compare October 29, 2026 20:19
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69f0b28c63

ℹ️ 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".

Comment thread apps/server/src/ws.ts Resolved
lastobelus added a commit that referenced this pull request Oct 29, 2026
Bind accepted queued reference edits to the editing client without replacing the run client for other reads. Keep only a server-stamped authorization marker on the message, reuse its referenced context, and reject replay or fallback after access expires.

Broker regression reproduces the original-client routing failure. Changed-file checks pass 573 tests; isolated Replay verification preserves the run/message identity and authorization marker through editing and queue release.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
lastobelus added a commit that referenced this pull request Oct 29, 2026
Use the latest accepted reference grant among messages and question answers in the captured run. Steering captures its sender for those references; promoting edited queued work preserves the editor authorization and records when it joins the target run.

Broker and persisted-runtime regressions cover direct steering, mixed question/message grants and queued promotion. Current-base changed checks pass 583 tests in 45 files and all affected-package checks.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

lastobelus added a commit that referenced this pull request Oct 31, 2026
Capture the answering client for exact references in accepted question answers. Preserve the original run authority for other reads, reject replay after binding loss, and carry scoped access into resumed and delegated runs.

Keep raw references in history and expand their instructions only for provider delivery, so question summaries show readable titles.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
lastobelus added a commit that referenced this pull request Oct 31, 2026
Bind accepted queued reference edits to the editing client without replacing the run client for other reads. Keep only a server-stamped authorization marker on the message, reuse its referenced context, and reject replay or fallback after access expires.

Broker regression reproduces the original-client routing failure. Changed-file checks pass 573 tests; isolated Replay verification preserves the run/message identity and authorization marker through editing and queue release.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
lastobelus added a commit that referenced this pull request Oct 31, 2026
Use the latest accepted reference grant among messages and question answers in the captured run. Steering captures its sender for those references; promoting edited queued work preserves the editor authorization and records when it joins the target run.

Broker and persisted-runtime regressions cover direct steering, mixed question/message grants and queued promotion. Current-base changed checks pass 583 tests in 45 files and all affected-package checks.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
@lastobelus
lastobelus force-pushed the lastcode/universal-thread-mentions branch from 9f962de to bba684f Compare October 31, 2026 07:49
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 497ef5697c

ℹ️ 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".

Comment thread apps/server/src/mcp/ThreadReadBroker.ts Resolved
lastobelus added a commit that referenced this pull request Oct 31, 2026
Normal message submissions now use a thread-scoped indexed existence query across runs, runtime answers and user messages. Preserve missing-thread failure and the first client binding while avoiding full user-history decoding. Broker, projection and MCP checks pass 107 tests; migration and query-plan checks pass 35 tests. Changed-file validation passes all 35 tasks.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol and GPT-6.1 Terra via Codex
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76c68bf124

ℹ️ 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

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: deed5addef

ℹ️ 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".

Thread references now use read-authorized client connections across projects and environments, including archived and completed subagent history. Explicit client reads preserve their authority through pagination while machine-directed operations keep peer routing. Drafts retain references when access is unavailable.

Carry-Group: incubator
Carry-Observation: The picker, persisted reference lifecycle, broker authority split and provider projection form one inseparable feature.
Model-Harness: GPT-6.1 Sol via Codex
Both clients now build a selected reference from the candidate identity and label, so archived and older threads need no cached shell. Candidate search applies the shared matcher across bounded metadata batches before limiting results, preserving cross-field and separated title tokens.

Carry-Group: incubator
Model-Harness: GPT-6.1 Sol via Codex
Lightweight mention candidates now preserve normalized PR numbers, titles and references when replacing cached shells. A broker deadline now aggregates any recorded permission refusal instead of discarding it when another client does not answer; another successful response can still win before the deadline.

Carry-Group: incubator
Model-Harness: GPT-6.1 Sol via Codex
Update the measured instruction and MCP tool-definition sizes after adding explicit client read routing guidance. The existing budget test now matches the actual model context.

Carry-Group: incubator

Model-Harness: GPT-6.1 Sol via Codex
Keep the annotation editor fixture focused on drafts and scoped save actions by mocking its unused Markdown renderer. This prevents its partial thread-state mock from leaking into the thread metadata query module.

Carry-Group: incubator

Model-Harness: GPT-6.1 Sol via Codex
Keep bounded best-match lists while scanning every metadata page so an exact title beyond the first 501 matches remains discoverable. Track ordinary and typo matches separately so a strong match found later disables typo fallback across the complete result set.

Carry-Group: incubator

Model-Harness: GPT-6.1 Sol via Codex
Explain which client the user must keep connected, direct read failures to user recovery, and distinguish incomplete ID discovery from a failed read of a selected source. Align web and mobile messages and remove repeated agent instructions.

The measured provider instructions shrink by 339 bytes and tool definitions by 139 bytes. Runtime routing and reference payloads are unchanged.

Carry-Group: incubator
Model-Harness: GPT-6.1 Sol via Codex; copy by GPT-6 Astra Medium via Codex, reviewed by Claude Opus 5.5 via Claude Agent
Capture the answering client for exact references in accepted question answers. Preserve the original run authority for other reads, reject replay after binding loss, and carry scoped access into resumed and delegated runs.

Keep raw references in history and expand their instructions only for provider delivery, so question summaries show readable titles.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
Bind accepted queued reference edits to the editing client without replacing the run client for other reads. Keep only a server-stamped authorization marker on the message, reuse its referenced context, and reject replay or fallback after access expires.

Broker regression reproduces the original-client routing failure. Changed-file checks pass 573 tests; isolated Replay verification preserves the run/message identity and authorization marker through editing and queue release.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
Provide the broker-requested request, node and message arrays in the project-launch fixture. This fixes the Server 5 failure without weakening production record contracts.

Carry-Group: incubator

Model-Harness: GPT-6.1 Sol via Codex
Use the latest accepted reference grant among messages and question answers in the captured run. Steering captures its sender for those references; promoting edited queued work preserves the editor authorization and records when it joins the target run.

Broker and persisted-runtime regressions cover direct steering, mixed question/message grants and queued promotion. Current-base changed checks pass 583 tests in 45 files and all affected-package checks.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol via Codex
Carry the answering client's server-captured read authorization through synthetic answer dispatch and persist it for queued answers. Promotion keeps that authorization and records when it joins the active run.

Regressions reproduce both the unbound synthetic steering ID and the missing queued marker before the fix. Runtime, broker and intake boundaries pass 143 tests; changed-file checks pass 592 tests and all affected-package checks.

Carry-Group: incubator

Model-Harness: GPT-6.1 Sol via Codex
Native subscription evaluations exposed ambiguous machine routing and inconsistent pagination fixtures. Clarify the two reference kinds, preserve source identity in mock links, and return distinct page and item replies. The fixture dispatch regressions and focused checks pass 434 tests.

Carry-Group: incubator

Model-Harness: GPT-6.1 Sol via Codex; wording by Astra Medium
Name the reference kinds as the agent sees them and explicitly prohibit the client read selector for machine-directed reads. Preserve local routing for the local machine. Opus confirmed the routing facts and supplied this clarification; focused checks pass 434 tests.

Carry-Group: incubator

Model-Harness: GPT-6.1 Sol via Codex; prose reviewed by Claude Opus 5.5
Normal message submissions now use a thread-scoped indexed existence query across runs, runtime answers and user messages. Preserve missing-thread failure and the first client binding while avoiding full user-history decoding. Broker, projection and MCP checks pass 107 tests; migration and query-plan checks pass 35 tests. Changed-file validation passes all 35 tasks.

Carry-Group: incubator

Carry-Fix: #543 (comment)

Model-Harness: GPT-6.1 Sol and GPT-6.1 Terra via Codex
Keep authorization lookups indexed while reserving unreadable histories against new client bindings.

Carry-Group: incubator
Restore queued references when source access changes during attachment or checkout preparation.

Carry-Group: incubator
@lastobelus
lastobelus force-pushed the lastcode/universal-thread-mentions branch from deed5ad to d1d0f82 Compare October 31, 2026 15:03
@lastobelus

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: d1d0f82608

ℹ️ 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-context-increase Intentional agent context growth approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant