Skip to content

feat(bridge): opt-in appControl session discovery (read-only) - #15

Merged
dpolishuk merged 2 commits into
mainfrom
feat/app-control
Nov 22, 2026
Merged

dpolishuk merged 2 commits into
mainfrom
feat/app-control

Conversation

@dpolishuk

Copy link
Copy Markdown
Owner

Stage 12 of the November upstream plan — the decision that was parked

Decision taken: ship the read-only subset behind an off-by-default
setting
(appControlEnabled), same posture as automations and dynamic
workflows. Mutating actions are rejected, cross-thread read access is
documented in the setting description.

Change

With the setting on, the runtime-preferences flag makes CLI ≥ 3.18 register
the native App-control tools; the bridge answers the twelve closed
appControl/* reverse-RPC intents (wire shapes from upstream
@zcode/session-control contracts at fec9759):

Action Answer
listProjects empty host-scoped catalog (bb has no project surface; listSessions needs no filter)
listSessions this worker's live ZCode sessions — {kind: app, sessionId, workspacePath} summaries, title = bb thread id, running/idle from the live timeline, availableActions: [readSession]
readSession (summary) the same session summary
readSession (messages) native session/messages lane (read-only, 5 s bound) mapped onto {id, role, text}; afterMessageId/limit forwarded
appControl/cancel {cancelled: false}
create / fork / send / wait / interrupt / rename / open / archive / pin {ok: false, error: {code: "unavailable", …}}

The caller binding (callerSessionId) must match the live connection the
reverse request arrived on. With the setting off, the methods fall through
to the typed not-implemented reply and the CLI never registers the tools.

Verification

  • 3 focused regressions: setting off → typed disabled error; on →
    list/summary/messages round-trip (fake session/messages fixture); on →
    mutation + foreign-binding denials.
  • Full suite 301 green, typecheck, format:check clean.
  • Live CLI verification pending — the local Desktop 3.17.2 bundle predates
    the appControl surface (recorded in knowledge).

Docs: roadmap stage 12 closed with the decision rationale, CHANGELOG,
docs/configuration.md (security posture), knowledge/log.md.

Stack: based on #14 ← #13; merge in that order.

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 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-22T17:07:06.496782Z 78af42f 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.

@dpolishuk

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 27b31e5c6c

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

Roadmap stage 12. The new appControlEnabled setting (default off) flows
into the runtime-preferences flag, so CLI >= 3.18 registers its native
App-control tools for sessions started with it on. The bridge answers the
twelve closed appControl/* reverse RPC intents:

- listProjects: an empty host-scoped catalog (bb has no project surface
  for the tools; listSessions works without a project filter);
- listSessions: this worker's live ZCode sessions as app-scoped session
  summaries ({kind: app, sessionId, workspacePath}, title = the bb thread
  id, running/idle from the live timeline);
- readSession: summary view, or a messages view mapped from the native
  session/messages lane (read-only, 5 s bound) onto the {id, role, text}
  wire - afterMessageId and limit are forwarded;
- appControl/cancel answers {cancelled: false};

every mutating or UI action (create, fork, send, wait, interrupt, rename,
open, archive, pin) is rejected with the stable unavailable error code,
and the caller binding must match the live connection the reverse request
arrived on. The setting description records the security posture: any
session started with it on can read the other live ZCode threads of this
bb.

With the setting off the methods fall through to the typed
not-implemented reply and the CLI never registers the tools. Wire shapes
extracted from upstream @zcode/session-control contracts at fec9759;
live CLI verification is pending (the local Desktop 3.17.2 bundle predates
the surface).
@dpolishuk

Copy link
Copy Markdown
Owner Author

No findings were raised on this PR (Codex: clean on 27b31e5); rebased onto the refreshed stack as 7c6768f, suite 301 green.

@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: 7c6768ff63

ℹ️ 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 src/usage.ts Outdated
Comment on lines +199 to +202
used = count(p.contextUsed) ?? snapshot?.usedTokens,
size =
count(windowOverride ?? p.contextWindow) ??
snapshot?.contextWindowTokens;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the context meter aligned with its attached snapshot

When the projection's contextUsed differs from the composition's providerContextTokens, this emits two different usage totals in the same delta: used comes from the projection, while snapshot.usedTokens and its free category come from the composition. These are separate measurements fetched sequentially in finishTurn, so they need not agree. For example, a projection reporting 1,234 tokens and a composition reporting 1,000 produces a meter and breakdown with contradictory totals. When attaching a snapshot, use its usage and window consistently for the enclosing meter; retain the projection values for the snapshot-less fallback.

Useful? React with 👍 / 👎.

@dpolishuk
dpolishuk force-pushed the feat/context-snapshot-stage11 branch from caf1559 to 6ddd27e Compare November 22, 2026 14:56
Review finding: the projection read and the composition query are two
sequential fetches whose totals need not agree, so a delta that took
 from the projection while its snapshot carried the composition's
providerContextTokens reported contradictory usage in one place. When a
snapshot is attached it now supplies the meter's usage and window; the
projection values remain authoritative only for the snapshot-less
fallback.
@dpolishuk

Copy link
Copy Markdown
Owner Author

P2 fixed in 78af42f: when a snapshot is attached it now supplies the meter's used/size (the projection read and the composition query are sequential fetches that need not agree; the projection stays authoritative only for the snapshot-less fallback). Suite 301 green. No other findings were raised on this round; #13/#14 have no new comments post-rebase.

@dpolishuk

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 78af42fa5c

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

@dpolishuk
dpolishuk changed the base branch from feat/context-snapshot-stage11 to main November 22, 2026 17:50
@dpolishuk
dpolishuk merged commit 9fd80e6 into main Nov 22, 2026
2 of 3 checks passed
@dpolishuk
dpolishuk deleted the feat/app-control branch November 22, 2026 17:51
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