Commit Graph
10581 Commits
Author SHA1 Message Date
Jinwoo-H 1ec6db4a4e fix mobile project payload and account fixtures
Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 15:34:50 -04:00
Jinwoo-H bcba08b3e4 test(mobile): pin that a refused tab close still prunes, and drop two leftovers
The refused-body case had no test after the round-5 revert; reintroducing the defect
passed the suite. Also removes the stream types stranded when the terminal subscribe
adapter was deleted, and a truncated field the directory result type no longer declares.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 13:19:31 -04:00
Jinwoo-H 59e5e6e0d4 refactor(mobile): call the transport directly for Retry, and fix three comments
The file explorer's reconnect ternary called the same function on both sides,
and its comment claimed the null branch mattered. Retry now calls
forceReconnect directly, as main did, and `reconnect` leaves the explorer
operations interface, where a UI action did not belong.

Comments corrected: the ratchet's regex doc no longer claims aliasing cannot
hide a subscribe, and names the two shapes it misses; the deliberate-inline
comment says those four are in the routed screens, not the whole remaining
surface; and the chat stop's layout effect names the gate that requires it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:54:38 -04:00
Jinwoo-H 01215438f2 test(mobile): fix the contracts target shape and pin the send option to its call
The project target carried a `slug` field the type does not declare and omitted
owner/repo/host, so repoPayload read them as undefined and the oracle only ever
exercised the prRepo:null path. It now uses the real shape and asserts the row
repository reaches the wire; blanking prRepo fails it.

The connection gate asserts TERMINAL_INPUT_SEND_OPTIONS inside sendInput rather
than anywhere in the counted set; removing it from that call fails the gate.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:53:16 -04:00
Jinwoo-H 888d999b1b fix(mobile): drop the defensive normalizers main did not have
- listRepositories dereferences result.repos, so a repo.list answer without it
  throws into the caller's catch as it did before.
- projectResult requires an explicit ok:true again; a result that omits the
  flag is not a confirmed success.
- readRuntimeSettings returns null for a settings-less answer, so the create
  sheet keeps what it already had instead of committing {}. The task-create
  path keeps its own {} default, which is what it had.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:51:48 -04:00
Jinwoo-H d96f68457c fix(mobile): restore main's guard conditions on the four Project-row actions
Each had gained a non-null target requirement that demanded a number and a
recognised item type where main's guard did not, so a row main would have sent
for now returns silently or reports an error.

File-viewed and the comment reply gate on main's conditions and build the
never-null identity target after them. Metadata update, issue type and comment
add gate on the slug and the number, as main did, through the slug target,
which does not read the item type.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:49:30 -04:00
Jinwoo-H d0994be78e refactor(mobile): delete the seam surface with no production reader
Each was confirmed to have zero non-test readers before and after:

- HostSessionTerminalOperations.subscribe, its adapter body and its test. The
  live stream still calls subscribeMobileTerminalSafely directly, as on main,
  so the method existed only to be tested.
- pasteImages and releaseImages, declared on the native-chat interface and
  never implemented or called.
- explicitQuickCommandScope, exported with no callers.
- The quick-command snapshot's totalCount and repoId, which nothing read, and
  with them the workspaceId argument that existed only to compute repoId. The
  hook takes { operations, enabled } again, as main took { client, enabled }.
- The web-artifact result variant, line and column on the resolve request,
  rename's third parameter and the directory variant's truncated. The
  legacy-list variant's truncated stays: the panel reads it.

Deleting the terminal subscribe also brings the parity oracle's identity
fields to 14, matching main exactly.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:46:42 -04:00
Jinwoo-H 3924105b72 fix(mobile): check the quick-command load envelope outside the cutover retry
main handled `!response.ok` after the retry helper returned. Throwing inside
the try made a refusal replayable, because the cutover predicate matches any
Error whose message is exactly the migration string, so a host refusal carrying
that text was retried five times.

The helper returns the response again and the caller checks it. The new test
fails under the old shape with six attempts instead of one.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:42:12 -04:00
Jinwoo-H df248c4368 refactor(mobile): drop the two create fields with no producer or consumer
sparseCheckout was added to the composer create args and forwarded into the
worktree.create params; its only caller never passes it. warning was added to
WorktreeCreateResult and read off the response; nothing reads it, and the one
screen that shows a create warning is on the unchanged inline path with its own
copy.

worktree-create-retry.ts and source-workspace-create.ts are now byte-identical
to main.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:40:45 -04:00
Jinwoo-H 14e0c474b6 fix(mobile): send Stop on whatever budget is left, and pin the device identity again
Stop routed through the shared chat write, which refuses to start under a 2s
residual budget. The call it replaced tried on anything above zero and could be
accepted, so Stop now has its own send: main's params, main's
{ timeoutMs, budgetSpansConnect: true }, no enter field, the same worker
takeover report on accept and the same unknown/rejected classification.

The parity oracle also follows the two adapters the route's identity fields
moved into, since the visitor only expands bare-identifier calls and could
never reach operations.terminal.sendInput. Identity fields are 15 rather than
main's 14: the seam turned two hook-side deviceToken fields into three
adapter-side client:{id} builders. Dropping the binding in the adapter now
fails the oracle.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:39:18 -04:00
Jinwoo-H 73125e3f3b fix(mobile): prune a closed session tab on ok alone, as main did
main checked only response.ok, pruned the tab, wrote a tombstone and let the
host's republished snapshot restore it if the close was refused. The adapter
had mapped a refusal to an outcome the caller skipped every state commit for,
leaving the tab on screen, and had added a `closed !== true` precondition main
never had, so a host answering ok without that field would strand the tab.

close() returns a boolean again and the caller prunes on it. The test that
pinned the refusal projection is replaced by two that pin main's contract: ok
with an empty result still reports acceptance, a transport refusal does not.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:34:19 -04:00
Jinwoo-H 3220919c87 fix(mobile): delete the Ctrl+U prefix send path this PR added
main had no clearInputFirst. The flag prefixed a clear byte onto the body of a
terminal.send, which is the shape the same file documents as observed broken in
the field: the burst reached the agent as literal control characters with the
draft still parked. No production caller set it.

mobile-native-chat-send.ts now has no diff against main. The assertions that
existed only to prove nobody set the flag are gone; the case that pins verbatim
text stays and fails if a prefix comes back.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 12:33:12 -04:00
Jinwoo-H 753ec1354f test(mobile): bound the Project host oracle to a real method boundary
The adapter sources are concatenated, and the last method in each file closes with a bare
brace, so the previous delimiter search could run into the next file. The slice now ends at
the enclosing method's closing brace and fails outright when none exists.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 11:43:14 -04:00
Jinwoo-H 892c6fc1a9 refactor(mobile): drop the per-namespace default factories nothing imports
Each was a one-line pass-through to its native factory. The five domain-level defaults are the only ones the screens construct.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 03:54:47 -04:00
Jinwoo-H 66e698aca2 refactor(mobile): drop the capability projection its last caller left behind
The tab adapter's capabilities() method was removed as uncalled; this module existed only to serve it.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 03:52:58 -04:00
Jinwoo-H 5cbbadfb2b refactor(mobile): drop the five adapter methods with no live caller
- HostSessionNativeChatOperations sendMessage, respond and attachImage. Every
  shipped send path calls sendMobileNativeChatMessageWithOutcome or
  typeMobileNativeChatCommandWithOutcome directly, as on main.
- HostWorkspaceCreationOperations createBlankWorkspace and
  createWorkspaceFromSource. use-new-workspace-create-submit imports
  createBlankWorkspace from the source module instead.

With those two gone the native creation factory only spread the RPC
operations and RpcWorkspaceCreationOperations only excluded them, so both
collapse. The arg and result types that existed solely for the five methods go
with them, as does the dead SessionTabsResult re-export.

Each name was grepped against non-test, non-adapter callers before and after.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 03:12:13 -04:00
Jinwoo-H b1f1ff78d1 test(mobile): bound the Project host oracle to its own adapter method
The per-call slice was still a fixed 700 characters, so deleting host from
updateComment passed on deleteComment's host sitting inside the window. It now
ends at the enclosing method, matching the prRepo loop, and accepts the
shorthand property form that github.project.listAccessible uses.

Verified: dropping `host: target.host` from updateComment fails the oracle.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 03:09:21 -04:00
Jinwoo-H 0aaa70e5e9 test(mobile): restore the four assertions the extraction weakened
- The Project host oracle no longer accepts a bare `payload` identifier, which
  every call site satisfies by construction. Inline payloads must show a host
  or a slug builder; the four typed-payload reads are named explicitly and
  their payload types are pinned to carry the host.
- `prRepo` is pinned per mutation and bounded to that adapter method, so
  dropping it from one of six fails instead of needing all six.
  `github.addPRReviewComment` is pinned again, with the row repository.
- The smart-source fan-out fake now delegates to the shipped search functions
  over a scripted transport, so the repoId stamping under test is the real one
  rather than the fake's copy.
- The retired-name read's method and `id:` prefix are asserted again, in the
  adapter test, since the hook now takes a callback.
- The session adapters join the route parity family, bringing the runtime
  strings and identity fields that moved out of the hooks back into scope.

Each restored assertion was verified to fail under the mutation it guards.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 02:45:37 -04:00
Jinwoo-H d07fe48b4f fix(mobile): restore the state commit between the two Tasks hydration phases
read.bootstrap() folded status.get and the settings fan-out behind one await,
so the supported commit ran only after all five requests succeeded. A
post-connect timeout on any of the four left tasksSupportState at 'unknown',
which the list surface renders as a bare spinner, and the effect deps do not
change on that failure so it never retried.

The probe is now read.tasksSupported() and the fan-out is read.bootstrap(),
with the caller committing supported and clearing the error between them, as
it did before the seam existed.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 02:41:01 -04:00
Jinwoo-H cac634631b refactor(mobile): drop the resolve request field the wire never carried
resolveTerminalPath took a tabId the native adapter never sent, and main's
wire had none either, so the caller's sourceTabId computation fed nothing.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 01:45:44 -04:00
Jinwoo-H cb10440dca fix(mobile): remove a stream error callback that could never fire
The native chat subscribe declared an onError the adapter never invoked, since
the transport has none: a stream error arrives as an error frame through the
listener, which is where the caller already handles it. The hook's second
callback was unreachable, so it goes with the parameter.

The terminal adapter's acknowledge was a no-op with no caller here or on main.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 01:45:44 -04:00
Jinwoo-H e1b7aa8223 refactor(mobile): drop the browser adapter methods nothing calls
Only back, forward and reload have a consumer; the browser pane still issues
its own RPCs. subscribe, navigate, scroll, click, insertText, keypress and
dialog go, with the event and frame-comparison types that existed only for
them. click's fallback had also lost main's move/down/up sequence and cited a
caller that does not exist here.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 01:45:44 -04:00
Jinwoo-H aefdf2d034 fix(mobile): await each per-repo GitHub count so one failure is a zero
Returning the promise from inside the try let a rejected count escape the
per-repo catch, reject the whole batch and reach the caller, which fires this
without a handler. The inline call it replaced awaited and reported zero.

The new test drives the real batching shape and fails if the await is removed.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 01:45:44 -04:00
Jinwoo-H 1b86a6842b fix(mobile): close the seven defects the adapter review found
- Clear terminal consumes the boolean the adapter returns, so a clear that
  never reached the host no longer toasts success.
- A refused `@`-autocomplete search returns null instead of an empty list, so
  the failure is not cached and the next keystroke retries.
- The Linear workspace picker reloads the host's context on both outcomes, and
  `selectWorkspace` detects a refusal by the id the host echoes back, since it
  answers a refusal with its unchanged status and no `ok` field.
- `read.loadLinearContext` splits into `linearStatus` and `linearTeams`, so the
  screen commits the workspace list and the resolved selection before it asks
  for teams, as it did before the seam existed.
- Resolving a review thread reports the host's message for a transport failure
  and the caller's wording only for a refusal, in both the item and the
  Projects lane.
- The RPC ratchet matches the identifier rather than `sendRequest(`, counts
  client subscriptions, walks every source directory and all of `mobile/app`,
  classifies adapters by path, and pins each remaining site by file. Verified
  against bind, bracket access, a space before the paren, an aliased client, a
  helper in another directory and an adapter-shaped new file.
- Deletes the adapter families nothing constructs (file preview, workspace
  catalog and the workspace group), the dead device wiring, and the three
  methods that shadowed a live call with different behavior.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-09 00:32:31 -04:00
Jinwoo-H 654db50c0e fix(mobile): keep two adapter improvements over the calls they replaced
Two refusals the old inline calls dropped are now reported, because dropping
them is a bug rather than behavior worth preserving:

- linear.selectWorkspace: a refused switch reaches the picker's error instead
  of leaving it showing a workspace the host never selected.
- worktree.listRetiredNames: a refused read fails rather than reading as an
  empty registry, so the create sheet keeps its previous answer instead of
  offering a name that is already spent. This is the policy
  src/shared/worktree/retired-name-cache.ts documents.

Every other adapter still answers exactly as the call it replaced did.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-08 23:15:50 -04:00
Jinwoo-H 538bfd2bdd fix(mobile): match main's observable behavior in the host adapters
An adapter body has to be the inline call it replaced, so each place where a
carried adapter answered differently from main is corrected here:

- Linear: per-method timeouts and error strings as main sent them, no result
  check on selectWorkspace or updateIssue, "Sub-issue not found" and
  "Failed to create sub-issue" restored.
- browser.tabCreate: the host's error message, main's 30s budget, and a
  tolerated missing page id.
- terminal.clearBuffer: an ok:false reply keeps main's success toast.
- Quick commands: only the load retries a logical cutover, and an empty error
  message falls back to main's per-operation copy.
- Project rows: the pull-request mutations no longer require a repository slug;
  a row without one forwards prRepo: null, as main did.
- worktree.listRetiredNames: a refused read reads as an empty registry again.
- repo.hooks: the create sheet keeps its state on a refused read, while task
  create still fails on one.

The paced-Escape route ref moves from render into a layout effect so the
changed-code React Doctor gate passes; a timer cannot observe the ref between
commit and layout, so the guard's timing is unchanged.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-08 23:11:34 -04:00
Jinwoo-H 222134ebea test(mobile): ratchet inline RPC out of screens
Pins the screens this PR routed at zero inline `sendRequest`, pins the four
calls deliberately left inline at their exact count, and caps the total
screen-side call sites so the remaining debt can only shrink.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-08 22:49:55 -04:00
Jinwoo-H 213948061c refactor(mobile): route session, file and account screens through operations
The session hooks take HostSessionOperations, the file explorer takes
HostFileExplorerOperations, and the accounts route takes HostAccountOperations.
Terminal, tab, markdown, file, quick-command, browser and native-chat requests
now live in their native-host-session-* adapters.

Four session RPCs stay inline because no adapter method means the same thing:
terminal close, note creation's two calls, and the buffered terminal submit that
needs the raw response to classify a partial write. Worker-terminal takeover
reporting is re-issued at the call sites the adapter does not report from, so
the send-site ratchet still covers all of them.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-08 22:49:54 -04:00
Jinwoo-H ee61c992fa refactor(mobile): route task screens through HostTaskOperations
The Tasks screens and the new-workspace composer now take an operations
adapter instead of an RpcClient. Every RPC envelope check, response cast and
payload literal that lived in a hook body moved into the matching
native-host-task-* adapter, and the composer's search and create requests moved
into HostWorkspaceCreationOperations.

Behavior is unchanged apart from four adapter-owned differences noted in the PR
body. `worktree.create` from a task item stays inline: the creation adapter
builds the composer's params and adds name-collision retry, which is a
different request, not the same one behind a seam.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-08 22:48:57 -04:00
Jinwoo-H a9401b7766 refactor(mobile): add host operation interfaces and native adapters
Six operations interfaces the mobile screens will be handed instead of an
RpcClient: HostSessionOperations, HostTaskOperations, HostWorkspaceOperations,
HostFileOperations, HostAccountOperations and DeviceOperations. Each host domain
groups its per-concern contracts as namespaces so a screen takes one prop while
every sub-adapter keeps its own file, and each has one native factory built over
the socket RpcClient.

No screen is wired yet, so this carries no behavior change.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
2026-09-08 22:16:35 -04:00
Brennan BensonandMerge Sim e80fae0c4d Summarize turn file changes and preserve resolved prompt receipts (#19229)
* feat(chat): summarize turn changes and retain resolution receipts

* fix(chat): defer turn diff details and localize resolution times

* fix: complete approval projection test fixture

* Align turn diff disclosure chevron and indent details

---------

Co-authored-by: Merge Sim <sim@local>
2026-09-08 17:50:51 -07:00
Brennan BensonandMerge Sim d196942220 fix(renderer): align native chat pane layering (#19626)
Co-authored-by: Merge Sim <sim@local>
2026-09-08 16:40:31 -07:00
Brennan BensonandMerge Sim 94a64cf40f fix(browser): load newly opened background tabs (#19633)
* fix(browser): admit newly opened background pages

* fix(browser): scope background page mount admission

---------

Co-authored-by: Merge Sim <sim@local>
2026-09-08 16:25:14 -07:00
Brennan BensonandMerge Sim 12f2c6b991 Unify native chat and workspace tab command dispatch (#19621)
* fix(tabs): unify native chat command dispatch

* test(tabs): update browser close census

---------

Co-authored-by: Merge Sim <sim@local>
2026-09-08 14:15:01 -07:00
Brennan BensonandMerge Sim 6b60c23e07 fix(native-chat): reveal message chrome on keyboard focus, not any focus (#19426)
* fix(native-chat): reveal message chrome on keyboard focus, not any focus

`:focus-within` cannot tell a mouse click from a keyboard tab, so clicking any
control inside a message row — a tool run's disclosure, most visibly — parked
focus there and left the row's copy, scroll, and timestamp chrome showing after
the pointer had moved away. The row read as permanently hovered.

`:focus-visible` is the distinction the browser already computes, and it is the
keyboard focus this reveal was written for in #19218. Measured in the running
app: after a real click on a run header, `document.activeElement` is that button
and `:focus-visible` is false, while `:focus-within` is true.

* refactor(native-chat): spell the keyboard-focus reveal with the first-class has variant

Swaps the hand-rolled arbitrary variant `group-[&:has(:focus-visible)]:` for
Tailwind's `group-has-[:focus-visible]:`. Every other `has-` variant in the
renderer is already spelled in the bracket form, including the same
hover-plus-keyboard-focus reveal on the project header actions.

Measured in the running app: both spellings compile to an equivalent selector
and are identical in every state (idle, mouse click on a control inside the
row with the pointer moved away, and each keyboard tab stop).

Also asserts the pointer-events half of both reveals, which governs whether
the copy button is clickable and had no coverage.

* fix(native-chat): preserve message controls on touch devices

---------

Co-authored-by: Merge Sim <sim@local>
2026-09-08 14:01:45 -07:00
Brennan BensonandMerge Sim d7d21b2c55 Show picker-selected native chat skills as pills (#19616)
* Render picker-selected native chat skills as inline pills

* Use cube icon for native chat skill pills

* Update skill pill label assertion

* Use cube icon for every native chat skill pill

* Use neutral cube icon for native chat skill pills

* Match native chat skill icon to selector

---------

Co-authored-by: Merge Sim <sim@local>
2026-09-08 14:00:58 -07:00
Brennan BensonandMerge Sim 4f0e3806a9 fix(native-chat): place effort after model picker (#19617)
Co-authored-by: Merge Sim <sim@local>
2026-09-08 12:39:58 -07:00
Jinwoo Hong 8f78c28248 fix(orchestration): fence worker release on mobile keystrokes (#19337)
* fix(orchestration): fence worker release on mobile keystrokes

A settled worker's terminal stayed ownership_state='owned' unless a takeover was
recorded, and the only recorder was orchestration.workerTerminalUserInput, which
only the desktop/web xterm input signal and the native-chat composer call. Mobile
input arrives as terminal.send / stream input frames instead of a report, so a
phone user typing in a settled worker's pane never fenced anything: worker-list
kept recommending release and worker-release closed the PTY under them.

Give the host one definition of "a human typed into this terminal" and route every
lane through it. The mobile input floor claim is that definition and already exists
on both byte lanes: it is taken only for deliberate phone input, never for the
emulator's own query replies, and never for an agent's `orca terminal send`, which
names itself a desktop client and so is indistinguishable from a keystroke at this
layer. Settling that claim after an accepted write now records the takeover through
the same code the RPC reporter uses, throttled to one write per pane per 30s so a
keystroke does not pay for an immediate transaction. The record lands on the runtime
that owns both the terminal and the orchestration database, so SSH-hosted and remote
workers behave exactly like local ones.

No mobile change: mobile already sends client.type (mobile/src/terminal/terminal-send-request.ts:24).

* fix(orchestration): ask the database, do not remember, whether a pane is fenced

The keystroke throttle armed on the attempt rather than on the outcome, so a
zero-row or thrown record poisoned the pane for 30s. A phone keystroke during
the worker-start readiness wait lands before prepareStartingWorkerAuthority
creates the owned resource; a real keystroke seconds later was then suppressed,
the worker settled, and workerRelease closed the terminal under the phone user.
A SQLITE_BUSY on the first write did the same, with no retry.

The cache was the defect, not its arming condition. Its precondition is the set
of owned resources on the pane, which changes underneath it, and any cache keyed
on ownership identity would have to read the database to learn that identity --
which is the whole question. So the input lane now asks: a read using the same
predicate the write uses answers "is anything still fenceable here?" without
taking BEGIN IMMEDIATE, and only then is the write attempted. Ordinary typing
costs a lookup instead of a write lock, a failed write is retried by the next
keystroke, and a takeover writes once per ownership epoch rather than once per
window, because the flip to user_owned removes the pane from the candidate set.
Sharing the predicate keeps the probe from drifting from the writer.

Adds the two escape cases as permanent regressions, drives the mocked send
through the real RuntimeTerminalWriter, and asserts a mobile takeover lifts the
settled-worker resume fence, which no test covered.

* refactor(orchestration): let the database dedupe the takeover, drop the read probe

The probe was meant to keep keystrokes off BEGIN IMMEDIATE, so it had to earn
that with a number. Measured against a real WAL database it costs more than the
write it avoids: at 25 live workers the probe is 0.19ms and the no-op write is
0.10ms, because the probe runs the same candidate selection with each statement
taking its own read snapshot instead of sharing the transaction's. It is a
compensating mechanism with negative value, so it goes, along with the database
method and the predicate extraction it needed.

owned -> user_owned is one-way and scoped to a resource, so the database is
already the dedupe: every deliberate human write attempts the transition, the
second attempt matches no row, and the fence sweep runs only on changed > 0.
Nothing is remembered between keystrokes, so no state can outlive the ownership
it described -- a keystroke before the worker's authority attaches, a write the
database refuses, and a re-dispatch onto the same pane all resolve against the
rows as they are at that instant. An attempt costs about 0.1ms at typical fleet
size and 0.34ms at 100 live workers, on mobile writes only.

Replaces the write-count test, which asserted the old mechanism, with the
invariant: many keystrokes settle into one takeover and one fence sweep. Adds
the re-dispatch case, where a pane's next worker is fenced on its own merits.

* refactor(terminal): name the provenance rule the takeover fence hangs off

The fence rode the mobile input floor claim, with only a comment tying the two
together. The floor is arbitration -- who may write next -- while the fence needs
provenance -- who produced the bytes. They agree today, so anyone reweighing the
floor would have moved the fence without noticing.

isDeliberateHumanInput states the provenance rule on its own terms, and both byte
lanes decide with it when they open a write: the claim carries the verdict beside
the handle, and settlement records the takeover only when a human produced the
bytes. No behavior change -- afterWrite is wired only where the predicate already
answers true -- and the rule is now pinned by its own cases, so a future
arbitration change has to answer this question again rather than inherit it.

* test(orchestration): prove the unary lane classifies a metadata-less phone

A phone build older than client.type is recognised only by its pane's mobile
driver, which the unary lane passes as the provenance evidence. Nothing proved
it did: replacing that argument with false left all 17 tests green while a
shipped phone silently stopped fencing worker release. The new case drives a
clientless send on a mobile-driven pane and fails under that mutation.

The stream lane now passes false outright. Its isMobile is read off the same
client object it carries, so the metadata-less phone cannot reach it, and
passing the flag suggested a legacy path that does not exist there.

Also states what the per-keystroke cost scales with. A pane owning no resource
misses the pane_key index and falls through to a scan of owned resources, so the
figure is tens of microseconds at realistic worker counts rather than a flat
0.1ms, and it grows with rows that are never released.

* fix(terminal): let provenance alone decide the takeover, on every accepted write

A phone older than client.type sends no client metadata, and both stream
initializers derive isMobile from that metadata alone, so such a subscription
reported false and took the stream lane's uninstrumented branch: provenance was
computed and then never consumed. Bytes from a real person landed through both
frame adapters and the resource stayed owned, so workerRelease closed the PTY
under them. The unary lane already fenced that population off the pane's mobile
driver, which is the host's standing reading of clientless input, so the two byte
lanes disagreed at the destructive boundary.

The predicate was still subordinate to floor plumbing: it could only be consulted
where a floor client id existed. Now the accepted-write callback attaches on both
lanes regardless of whether a floor was reserved, and humanInput alone decides
recording; a write holding no claim commits nothing. Arbitration keeps its own
condition around reserveWrite, where it belongs, and the unary lane's duplicate
outer provenance filter is gone. The stream lane reads clientless provenance from
the pane's driver, the same policy the unary lane uses.

The claim holder is now TerminalInputWrite, carrying the verdict beside an
optional floorClaim, so the structure says what the doc said: a write may fence
without holding the floor.

Regressions drive both real frame adapters, clientless direct delivery, and the
paired-web desktop negative. Metadata-only provenance fails 3 on the stream lane
and 1 on the unary lane; gating the callback on a reservation fails the same 3.

* fix(runtime): resolve retained handles before mobile input provenance

A renderer reload clears transient handles while retaining runtime-owned
PTY identities. Legacy mobile provenance saw no leaf, then sendTerminal
restored the same handle and delivered an unfenced key. Normalize through
getLivePtyForHandle at the shared live-leaf resolver entry so classification
and writes agree, preserving existing leaf generation/incarnation checks.

Caller audit:
- terminal-send-method: driver, query-reply authority, lock and floor checks
  now resolve the retained PTY before sending.
- terminal-input-delivery: legacy mobile classification and exact-PTY
  binding now see the same target as the writer; equality checks remain.
- terminal-multiplex-subscribe-resolution: retained PTYs resolve directly
  without a spurious missing-terminal wait.
- terminal-lifecycle-methods resize and terminal-viewport-methods display
  mode, restore-fit and updateViewport retain their original PTY target.
- inspectTerminalProcess: avoids false terminal_gone after reload while
  preserving provider inspection and incarnation fences.
- getLivePaneKeyForTerminalHandle and getOrchestrationDispatchAuthority:
  unaffected because both already call getLivePtyForHandle first.
No wire/schema changes, host fallback, process-death inference, or Git
workspace assumptions; SSH providers keep ownership of execution evidence.

Validation:
- Unmodified round-3 reviewer probe: reproduced 2/2 failures, then 2/2 pass.
- Unmodified round-2 reviewer probes: 13/13 pass.
- Checked-in takeover suites: 24/24 pass. Removing only the resolver call
  fails both new reload cases; source restored afterward.
- RPC orchestration + terminal, aggregate runtime handle registry,
  handle incarnation, mobile tab mount, stale geometry, and reload probe:
  2027 passed, 1 skipped (89 files).
- tc:node and check:code-quality:changed pass; background launch enabled.

* test(rpc): require unconditional terminal afterWrite callbacks

Update exact sendTerminal expectations for the round-2 accepted-write
contract. Preserve beforeWrite expectations, absence of reserveWrite,
byte payloads and call-count checks; require afterWrite to be a function.

Reproduced the requested two-file run: 5 failed, 31 passed. The full RPC
suite exposed the same stale shape in ACK budget/overflow, desktop resize
(including its later retry), and agent-prompt fallback assertions. Update
those too, for 11 assertions across six test files. No production changes.

Validation: ORCA_BACKGROUND_LAUNCH=1 full src/main/runtime/rpc suite:
264 files passed; 2292 tests passed, 1 skipped. Changed-code quality and
staged oxlint/React Doctor/oxfmt checks passed. Ran lint-staged --no-stash
manually to honor checkout safety rather than its default backup hook.

* fix(mobile): report worker takeover outside terminal byte delivery

New phones announce accepted real user input through the existing worker
report RPC, addressed by terminal handle. Share a per-client/per-handle
30-second gate with one bounded retry; report through the same RPC client
as the input. Cover live commits and dictation via their shared sender,
accessory keys, gestures, buffered submit, paste and accepted native chat.
Query replies, attachment heals, triage and diff-review sends do not report.
Phones predating this build do not fence release.

Remove byte provenance and takeover callbacks from host delivery. Restore
both lanes' pre-PR floor-claim plumbing and the original options assertions.
Keep the host recorder uncached with its conditional resume-fence sweep.
No DB schema or stream change; terminal is an optional report address.

Retain the shared resolver recovery independently of takeover: the new
SSH inspection test fails without it during renderer reload. Other callers
still benefit for subscription, resize, viewport and exact-PTY binding;
unary driver/lock checks see the retained PTY. Pane routing and dispatch
authority already recover through getLivePtyForHandle and are unaffected.
Existing leaf generation checks and first-PTY adoption remain unchanged.
No other input-plumbing hunk is retained relative to the PR base.

Replace byte-takeover tests with handle-addressed local/SSH report and
unknown-handle tests, plus real unary/stream writes asserting zero SQL
prepare/exec calls. Mobile send-site integration covers reports, exclusions,
rejected writes and gate counts. Desktop report tests are unchanged.
Register replacement coverage in the settled-worker release manifest.

Validation (all background): host/RPC/runtime 3541 passed, 2 skipped;
mobile session/terminal 2045 passed; node and mobile typechecks, changed
quality, mobile oxlint, reliability manifest and max-lines ratchet passed.
All five requested mutations fail assertions; resolver revert also fails
independent inspection. Staged checks run manually with --no-stash.
Final src diff against PR base: 5 files, +165/-13 (previously +839/-85).

* fix(runtime): allow the takeover report from mobile-scoped tokens

The mobile RPC allow-list gates every phone request before dispatch and the
reporter swallows a refusal, so without this entry every phone shipped
unfenced. Pin it beside the report tests, and pin the once-per-takeover
fence sweep the replaced byte-lane suite used to assert.

* fix(mobile): a no-op takeover report does not arm the gate; Stop reports too

A key during worker startup reports before the resource is owned; caching
that zero-change reply for 30 s suppressed the report that would have fenced
the worker once it attached. Native-chat Stop is deliberate input and now
reports on an accepted Escape.

* fix(mobile): takeover gate ignores the host answer, like desktop

Reopening the gate on a zero-change reply made every accepted key on an
ordinary terminal an RPC plus a host write transaction (round 6: 100 for
100). The startup window it closed is unreachable: the agent has no prompt
to accept input until after its resource row exists. Plain terminals now
pay one report per 30 s window; the native-chat Stop report stays.

Send-site fixture answers the report RPC with a changed count; the draft
test filters to terminal.send calls.

* docs(runtime): say why resolveLiveLeafForHandle re-links before lookup

* chore(i18n): regenerate the runtime-required catalog for the contrast floor strings

* test(orchestration): give the stopping-worker guard fixtures a Run

* test(orchestration): drop fence-sweep assertions retired by the settled-worker policy

* test(orchestration): pin the mid-boot phone takeover that #19608 makes possible

A handle-addressed report during the worker's tui-idle wait now finds the
custody row written at terminal creation, so it flips the pane to user_owned
and worker-release retains it instead of closing it under the user.
2026-09-08 14:48:57 -04:00
Jinwoo Hong 2ba2c90cb6 fix(orchestration): own a worker terminal from creation, not after the boot wait (#19608)
* fix(orchestration): own a worker terminal from creation, not after the boot wait

A worker pane is visible on desktop and phone the moment it is created, but the
worker_terminal_resources row saying orchestration owns it was written only after
the agent TUI went idle (up to 60s). A keystroke into the booting pane found no
owned row, markWorkerTerminalUserOwned returned 0, and the takeover was dropped -
so a later worker-release closed the pane under the user.

Record custody on the branches that create a terminal, right after creation and
before the tui-idle wait. The Dispatch capability still waits for the agent to
come up. An explicit --terminal reuse is untouched: it transfers at authority.

With the row present from creation, the failed-start adoption is dead. What a
failed start still needs is the Dispatch-context pane identity release re-proves
through, which is now copied from the custody row.

* chore(i18n): drop the orphan minimumContrast entries #19544 re-added to the runtime catalog
2026-09-08 14:32:01 -04:00
github-actions[bot] e829bb523a Update README downloads badge 2026-09-08 18:31:49 +00:00
Jinjing 6108ce617c Organize activity menu into filter and view sections (#19547)
* refactor: organize activity menu into sections and change toggle callbac

Restructure the activity thread options menu to use explicit boolean callbacks instead of toggle functions (rename onToggleUnread to onUnreadOnlyChange) and organize options into logical "Filters" and "View" sections. Remove descriptive tooltips for compact mode and unread filter. Rename ActivityScopeFilterMenuSections to ActivityScopeFilterMenuItems and shift layout responsibility to parent component.

* i18n

* fix issues

* i18n

* Hide empty Filters section in activity options menu

- Extract visibility logic into reusable hook `useActivityScopeFilterMenuItemsVisible` to avoid duplication
- Only render Filters label and items when filters are available, preventing empty section in dropdown
- Improves UX by not showing unused menu sections
2026-09-08 10:53:26 -07:00
Neil bba68b1bdd fix(pi): finish the dialog-wait signal on every surface (#19533)
* fix(pi): carry modal waits to mobile and stop losing the dialog close

Follow-ups to #18836, from its readiness review.

- Paint pi's `!` needs-input state marker while a dialog is open, so the
  80ms spinner frame stops repainting a working title over a mid-turn
  wait. Mobile and the CLI read the title, so they saw `working` where
  the desktop already showed `waiting`.
- Keep the assistant reply that lands while a dialog is open. The modal
  guard cleared tool fields and the `message_end` capture with them, so
  a turn ending under a dialog left the preview on the previous message.
- Report `ui_prompt_end` even when `ctx.isIdle()` throws on a runner the
  modal itself invalidated; the lost post stranded the pane on `waiting`.
- Declare the `esbuild` the runtime smoke tool imports.

* fix(pi): hold the needs-input marker until the dialog actually closes

From review of the previous commit.

- Settling under an open dialog no longer retires the marker. stopAnimation
  painted the plain title unconditionally, so agent_settled, a resolved
  agent_end, or an idle auto_compaction_end erased it mid-dialog — and
  because that also cleared the timer, the close then painted the plain
  title again and the wait was lost for good.
- Track the dialog as a boolean, not a depth counter. Pi does its own
  nesting accounting and emits one pair per stack, which is what the status
  extension already assumes; two files disagreeing on that would have let an
  inner close release the outer wait.
- Reset the flag on agent_start in both extensions. A turn cannot begin under
  a dialog holding input focus, so it is the one boundary that can recover a
  close that never arrived instead of pinning the pane forever.
- Leave OMP to its approval events: it reports waits through those already,
  and painting the marker there too would put title and hook in disagreement.

* fix(pi): do not ring the completion bell for a dialog that lost its close

From review of the previous commit.

- Report working, not done, when ui_prompt_end's isIdle() throws. done is
  not cosmetic: it reaches dispatchCompletion and fires the pane's finished
  notification, so a turn that is still running would announce itself. The
  real done still arrives from agent_end/agent_settled.
- Keep the idle-maintenance frame cap accruing while a dialog holds the
  title, so a dialog left open cannot suspend the guard that stops a
  compaction spinner whose end event never came.
- Guard the dialog handlers against a ctx without ui. The source is
  generated and untypechecked, and pi does not document the ctx it passes
  these two events; a TypeError there would surface on every dialog.

* fix(pi): let a turn still complete after a dialog loses its runner

From review of the previous commit.

- Re-arm the completion report when ui_prompt_end's isIdle() throws. The
  fallback posts working, but the finished turn had already reported its
  end, so nothing further would ever fire and an idle pane sat spinning.
- Count dialog depth in both extensions instead of trusting pi to emit one
  pair per stack. The guarantee is undocumented, and if it ever does emit a
  pair per dialog, an inner close would release the wait the outer dialog
  still holds. A counter costs nothing and drops the dependency.

* fix(pi): decide a dialog close from turn state, not from a guess

From review of the previous commit.

- Fall back to agentEndReported when ctx.isIdle is unavailable or throws.
  The previous guess of working stranded the common case — a dialog opened
  at idle — because no later event was coming to correct it, and the
  agentEndReported re-arm it relied on could not fire either. A turn that
  already reported its end is not still running, and that is knowledge this
  process holds without needing ctx at all.
- Only suppress spinner frames once the marker is actually painted. Pi may
  pass a ctx with no ui, and freezing the title on its last working frame
  is the opposite of what the marker is for.
- Gate the titlebar dialog handlers on the OMP runtime too, not just the
  installed kind: a bare-shell OMP launch runs inside a pi-kind pane, and
  the status extension already defers there. Extracted that check so both
  extensions share it rather than carrying two copies.

* fix(pi): treat a pane that never ran a turn as idle, not busy

From review of the previous commit.

- Track turn-in-flight separately from agentEndReported. That flag also
  dedupes the completion post, so it starts false on a pane that has not
  run a turn — which read as still-running and left a dialog opened before
  the first prompt spinning forever.
- Retry the marker paint on each dialog open instead of only the outermost,
  so an outer ctx without ui cannot decide the whole nested stack goes
  unmarked.
- Fall back to the opening ctx when the close carries no ui. Nothing else
  clears the needs-input marker, so the pane would have kept asking for
  attention until the next turn.

* fix(pi): keep a dying dialog ctx from stranding the needs-input marker

The close path paints through the ctx captured at open time, which is the
one a session-switching modal is most likely to have invalidated. Guard
both paint sites so a throw cannot reject the handler and leave the title
on the needs-input marker, and make local turn state the floor for the
status extension's idleness verdict instead of a fallback.

* fix(pi): hold the dialog wait against pi's own title writes and lost closes

Reviewed against real Pi 0.85.1 source rather than inference:

- ctx.ui is a getter that calls assertActive() and throws once a session-
  replacing dialog invalidates the runner, so optional chaining never
  screened it out and the probe sat outside the try. A throw landed after
  the depth decrement but before markerPainted cleared, stranding the
  needs-input marker until the next turn.
- Pi writes the same terminal title from its own writers with no event we
  observe, so the marker is now re-asserted rather than merely not
  overwritten, on a slow timer that outlives the spinner and its cap.
- resetExtensionUI drops an open dialog without resolving its promise, so
  a replaced or reloaded session never emits the matching ui_prompt_end.
  Both extensions now release the wait on session_start and shutdown.

* fix(pi): build the title inside the guard, not as an argument to it

paintTitle caught the setTitle throw but not the two calls one argument to
its left: pi.getSessionName() asserts runner liveness the same way ctx.ui
does, and process.cwd() throws ENOENT once the worktree is unlinked under a
live pane. Four of the six call sites are timer callbacks, where an escape
is an uncaught exception and pi exits(1) through its own handler — so the
cwd route was reachable today. paintTitle now takes a builder and runs it
inside the existing try.

* fix(pi): let only the pane-owning process assert the needs-input marker

The spinner is harmlessly per-process, but the marker is status the pane
reports, and child agents inherit ORCA_PANE_KEY. Gate the two dialog
handlers on a PID claim, mirroring ORCA_PI_STATUS_OWNED in the status hook.
2026-09-08 03:06:54 -07:00
Jinwoo Hong 12f53da542 Remove settled-worker automatic resume and hibernation fences (#19544)
* Remove settled-worker automatic resume and hibernation fences

* test: retirement rollback case follows the no-fence policy

Case 4 seeded and asserted automaticResumeBlockedBy, which this branch
deletes. A rolled-back settled worker is now an ordinary done record that
wake clears as passive evidence, same as any finished agent pane.

* chore(i18n): regenerate the runtime-required catalog for the contrast floor strings

* test(orchestration): give the stopping-worker guard fixtures a Run
2026-09-08 05:14:59 -04:00
github-actions[bot] d058da4786 Update README downloads badge 2026-09-08 08:54:09 +00:00
Neil ea102a9eb8 fix(i18n): drop orphan TerminalPane.minimumContrast entries that broke main static analysis
The 7 auto.components.settings.TerminalPane.minimumContrast.* entries added by #18126 have zero call sites; the shipped component reads settings.contrast.*. Because the runtime-required catalog classifies any key with no literal-default call site as required, the orphans broke 'Verify runtime-required localization catalog' on main and red-lit every PR in the repo.

Deleting them is the root-cause fix: regenerating would instead add dead strings to the boot bundle. On main+delete, --fix regenerates a byte-identical catalog and the CI step exits 0.

Merged with 'test / tests node 24 3/8' red: that failure is an unrelated main break from the #19542/#19551 collision, not from this change.
2026-09-08 01:45:52 -07:00
Jinwoo Hong d346d6f447 fix(orchestration): refuse Task re-open under a live worker; allow stop re-issue on a stranded row (#19551) 2026-09-08 04:03:23 -04:00
Jinwoo Hong 98fdbc4ade fix(orchestration): file federated worker mail under the coordinator Run (#19542) 2026-09-08 04:03:07 -04:00
53852c9ca4 feat(terminal): make the contrast floor user-configurable (#10754) (#18126)
* feat(terminal): make the contrast floor user-configurable (#10754)

The xterm minimumContrastRatio floor was hardcoded (3 on dark backgrounds,
4.5 on light) and applied to every pane with no way out, so TUIs that use
deliberately low contrast were rewritten: Powerline separators drawn in the
neighbouring segment's background became visible seams, and dimmed secondary
text lost its hierarchy.

Adds an optional `terminalMinimumContrastRatio` setting under Settings ->
Terminal -> Rendering. Blank keeps today's automatic, background-luminance
gated floor; 1 disables correction entirely (matching VS Code's documented
`terminal.integrated.minimumContrastRatio` and iTerm2's off-by-default
Minimum Contrast); values are clamped to xterm's 1-21 range.

The floor is resolved in one place, so live panes, the Appearance preview
and the dashboard terminal preview all follow it, and the existing
value-gated write still avoids clearing xterm's contrast cache on no-op
re-applies. The clamp also lives at the persistence boundary that every
writer crosses, so a hand-edited profile or CLI write can never hand xterm
a non-finite option. Mobile mirrors the desktop gate, so the resolved floor
travels with the terminal theme payload as a new optional field; hosts that
omit it leave older and newer clients on the luminance gate.

Fixes #10754.

Co-authored-by: Nyanako <44753291+Nanako0129@users.noreply.github.com>

* fix(terminal): refresh mobile payload fixture and clarify contrast target

* feat(terminal): make contrast controls intent-based with custom tuning

---------

Co-authored-by: Nyanako <44753291+Nanako0129@users.noreply.github.com>
Co-authored-by: m4air <m4air@m4airs-MacBook-Air.local>
2026-09-08 00:39:33 -07:00
Neilandylcn91 2e19342c12 fix(terminal): remove host-retired ghost panes in paired remote splits (#19365)
Adds the missing removal path to the host-authoritative layout reconciler, so a pane the host has retired is unmounted once its PTY has cleared. Fixes #17770.

The removal planner, its retired-set gate, the null-PTY guard, the never-last-pane guard and their unit tests originate from #18387 by @ylcn91. This PR adds the recovery-state dependency that makes the deferred removal actually re-run, an e2e regression spec, and a hook-parity repin.

Co-authored-by: ylcn91 <7249450+ylcn91@users.noreply.github.com>
2026-09-08 00:37:21 -07:00
53233be289 perf: count GitLab diff line prefixes without splitting all lines (#19505)
* perf: count GitLab diff line prefixes without splitting all lines

* test(gitlab): pin diff-count parity for CRLF, lone CR and non-ASCII lines

---------

Co-authored-by: m4air <m4air@m4airs-MacBook-Air.local>
Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
2026-09-08 00:10:38 -07:00