Commit Graph
790 Commits
Author SHA1 Message Date
Haoyuan WangandGitHub d01acf994b feat(cli): read Claude plan quota on demand via get_usage (#2451) 2026-11-17 07:37:06 +08:00
weishu 096563c584 Release version 0.36.1 2026-11-16 19:06:39 +08:00
weishuandHAPI 6cd6d375c0 fix(jobs): stop waking busy agents and gate session jobs to long work
Job wakes interrupted running turns: `deliverJobTerminalWake` only
special-cased inactive sessions, so an opted-in terminal job posted a
user message into whatever the agent was doing. Drop the wake when a
turn is running and settle the claim so a later idle flip cannot re-fire.

Those wakes also impersonated operator input — `sentFrom: 'webapp'`, a
bare user message with a "Verify the outcome and continue" imperative.
Tag them `hapi-system` and render them as a quiet status line in the web
chat instead of a user bubble with fork/retry actions. Drop the default
imperative; a prescription now has to come from `--wake-prompt`.

Agents attached jobs to short work (tests, builds, typechecks) because
the injected prompt was 2.1k chars of REQUIRED / MUST / FORBIDDEN. Replace
it with a decision rule: default is not to attach, never for work that
finishes in this turn, and run `hapi job --help` for the mechanics.

Co-Authored-By: HAPI <noreply@hapi.run>
2026-11-16 19:05:38 +08:00
weishu 8ff6bd12fa Release version 0.36.0 2026-11-16 17:36:27 +08:00
weishu 8aebb908bf feat(codex): attach HAPI to external desktop runtimes
Add explicit macOS attach/detach workers independent of owned runtimes. Preserve external engine lifetime, native queues and settings, and fence history rewrites with durable projection checkpoints.

Guard owned resume and deduplication paths, add protocol and CLI-to-Hub regression coverage, and document the isolated ChatGPT desktop GUI acceptance results.

Refs #2427
2026-11-16 16:24:33 +08:00
Junmo KimandGitHub 6237e90b37 feat: import local sessions through one registry (Pi, OpenCode, Codex, Claude) (#2435) 2026-11-15 17:06:21 +08:00
Junmo KimandGitHub 2d0c8a7695 fix(opencode): show each OpenCode v2 model's real effort options, with one Default (#2439)
* fix(web): drop provider-default entry from dynamic reasoning effort options

* fix(cli): support OpenCode v2 /api/model variant lookup and Basic auth
2026-11-15 08:00:10 +08:00
weishu abe1038cf7 Release version 0.35.1 2026-11-14 08:06:57 +08:00
OverbakerandGitHub 30835911fb feat(uploads): stream large session attachments via chunked uploads (#2429) 2026-11-14 07:48:04 +08:00
SSU-WEI HUANGandGitHub 6a19189cd8 fix(claude): deny pending permission requests when steering (#2432) 2026-11-14 07:47:48 +08:00
AnanovoandGitHub 80a5b94f8f feat(runner): add safe agent quota query infrastructure (#1787)
* feat: add runner-side quota query infrastructure

* test: cover usage query protocol contract

* fix: close quota query redirect and in-flight races

* fix: harden quota query cache and timestamps

* fix: restrict quota templates to read-only requests

* fix: harden quota credential and request boundaries

* fix: bind quota cache to credentials

* fix: retry quota failures after cooldown

* fix: require an active Codex provider

* fix: harden quota value parsing and redaction

* fix: close quota provider selection boundaries

* fix: resolve qualified Kimi provider defaults

* fix: continue Kimi config fallback when current is incomplete

* fix: isolate explicit Kimi profile fallback

* fix: bind provider credentials and URL safety

* fix: isolate Codex profiles and abort quota responses

* fix(usage-query): preserve case-sensitive Codex providers
2026-11-13 18:50:59 +08:00
f0ab4ba79d feat(cursor): detect inline model errors, surface, notify, and bridge (#878) (#987)
Cursor ACP sessions can fail mid-turn with a transient model error that the
agent reports inline rather than as an RPC rejection. HAPI treated those turns
as successful, so the session went quiet with no banner, no push, and no way to
resume without retyping the prompt.

This adds the full path:

- detect: classify inline/stderr model errors from the Cursor ACP stream,
  requiring strong signatures before typing a failure as a model error
- surface: persist `lastModelError` on session metadata; render a chat banner
  and a session-list indicator, with the prompt text kept out of list/SSE
  summaries so they never ship up to 32 KB of user prompt
- notify: deliver a push for an unacknowledged error, watermarked on the hub
  copy so a restart does not re-page the same eventId
- bridge & retry: offer a one-shot recovery prompt that replays the failed
  turn, bound to the originating eventId and gated so a real user turn always
  supersedes it. Auto-bridge is opt-in and defaults to OFF, persisted in hub
  settings and fanned out to live Cursor CLIs.

Re-cut onto current upstream/main. The branch had accumulated 108 iterative
hardening commits against a 289-commit-older base; replaying them individually
would have re-resolved the same conflicts ~100 times. The pre-re-cut tip was
2c28a1365 if the granular history is ever needed.

Absorbing upstream required adapting to three refactors that landed meanwhile:

- `MessageQueue2` grew an `internal?: boolean` control-message flag upstream
  while this branch added richer `internal` provenance. Unified on a tagged
  `QueueItemInternal` union (`control` | `model-error-bridge`) so one field
  carries one concept. `hasPendingNonBridgeTurn()` now treats *any* internal
  item as non-user: otherwise a queued `/auto-review` control slash would have
  counted as a user turn and wrongly superseded a live bridge.
- `AcpSdkBackend.prompt()` gained a `timing` callback upstream; merged it with
  this branch's `shouldSend` gate into a single options object.
- The hub settings route moved to a unified `updateSettings` transaction.
  `autoBridgeTransientModelErrors` is applied outside that transaction because
  SyncEngine owns its CLI fan-out and rollback under its own lock.

via [HAPI](https://hapi.run)

Co-authored-by: HAPI <noreply@hapi.run>
2026-11-13 18:50:09 +08:00
JeeandGitHub a7e472bb39 refactor(cli): move media guidance into tools and infer job countdowns (#2416)
* feat(cli): render local Markdown links as attachments

* fix(prompt): auto-infer sleep durations and deduplicate MCP media guidance

* fix(prompt): rely on tools and attachment fallback instead of injecting media guidance into system prompt

* fix(attachments): gate fallback by session permission mode and track denied paths

* fix(pr-review): track permission denials, exclude sidechains, and support multi-arg sleep

* fix(attachments): canonicalize denied paths, track local Claude & Codex approvals, exclude sidechain

* fix(attachments): canonicalize symlinks, hook Cursor PermissionAdapter, process Pi/ACP terminal snapshots

* fix(attachments): recognize ACP display titles, block file-read denials, document relative countdowns

* fix(attachments): normalize ACP read permissions, track native Claude denials, align sleep instruction

* fix(attachments): normalize AcpPermissionHandler read denials without rawInput

* fix(attachments): preserve SharedCodexPermissions file read/display denials

* fix(attachments): recognize qualified MCP read tools and preserve terminal-resolved Codex denials

* fix(attachments): support multi-file path extraction, avoid duplicate web markdown images, guard terminal resolution

* fix(attachments): multi-file denial tracking, guard terminal Codex approvals, conditionally suppress web cards

* fix(attachments): nested multi-file denial extraction, resolve terminal Codex approvals, parent-relative image card retention

* fix(attachments): recursive multi-file path extraction, native Codex approval reconciliation, decode percent-encoded targets

* fix(codex): reconcile native execution in root.ts, track webApproval vs terminal denial

* fix(codex): verify thread ownership and successful execution before clearing denials in root.ts

* fix(codex): validate MCP result error envelopes and retain web cards for non-image targets

* fix(cli): support underscored MCP server names, accept null error on Codex success, and deduplicate across cold resumes

* refactor(cli): keep media delivery in tool contracts and remove link fallback

* test(cli): avoid assuming a typed MCP config description

* fix(cli): anchor inferred sleep countdowns to child launch
2026-11-13 18:49:36 +08:00
SSU-WEI HUANGandGitHub bb97a6512f fix(runner): verified exit must confirm stop despite unrelated protected wrapper (#2346)
* fix(runner): let verified exit confirm stop when only unrelated wrappers are protected

* test(runner): verified exit confirms stop despite unrelated protected wrapper
2026-11-13 18:48:00 +08:00
Junmo KimandGitHub acddadf194 fix(agy): keep empty edit/write strings and the question card's free-text limit (#2331)
* fix(agy): keep empty strings in edit and write tool card inputs

A deletion edit (empty Replacement) or an empty-file write was mapped
without new_string/content, so the web Edit and Write views rendered
nothing. Keep '' for old_string, new_string and content.

* fix(web): take the question card's free-text flag from the pending request

agy's ask_question tool call is shown before its form arrives, so its input
cannot say whether free text is allowed, and the card kept offering Other on
forms without qN_other. Fill allowFreeText on the tool call input from the
pending request's input for questions that carry none. Inputs and requests
without the flag keep showing Other.
2026-11-13 18:47:11 +08:00
Junmo KimandGitHub 90fbb417ca fix(agy): concatenate ACP text chunks as deltas (#2332)
agy streams agent_message_chunk as pure deltas, but the backend used the
default overlap-dedupe mode, which dropped a repeated character at a chunk
boundary (73-8 + 800 was shown as 73-800). Set textChunkMode to delta,
as the OpenCode and Grok backends do.
2026-11-13 18:46:55 +08:00
weishu 5f1516489b build(android): derive versionCode from the git commit count
- versionCode is now `git rev-list --count HEAD`; the hapiVersionCode
  property is gone. Builds without git fall back to 1.
- Official builds fail fast when git is unavailable or the clone is
  shallow, since a shallow history undercounts.
- The official build workflow drops the version_code input, checks out
  full history and names the artifact hapi-android-<versionCode>.
- Android and CLI READMEs describe the new rule.
2026-11-13 17:03:06 +08:00
adminandGitHub bebda45006 fix(dsh): respawn dead ACP children, recover closed sessions, sandbox modes, inline images, reasoning effort (#2386) 2026-11-13 08:40:55 +08:00
HeavyGeeandGitHub 04032d704e fix(cli): isolate claude.test.ts resume-identity tests from HAPI_INVOKED_CWD (#2396) 2026-11-13 08:40:19 +08:00
JeeandGitHub ebd4ac2105 fix(agy): handle stale errors and missing session titles (#2401) 2026-11-13 08:39:32 +08:00
AnanovoandGitHub 083aaca779 fix(web): distinguish and navigate pending requests (#2402) 2026-11-13 08:39:15 +08:00
JeeandGitHub d391324e81 fix(cli): handle ACP stdin stream errors (#2403) 2026-11-13 08:38:54 +08:00
AkiiiaandGitHub 72b341fde1 perf(cli): load command modules on demand (#2404) 2026-11-13 08:38:41 +08:00
Junmo KimandGitHub e24ccf5e50 feat(agy): show the round turn count and running background commands (#2405) 2026-11-13 08:38:25 +08:00
SSU-WEI HUANGandGitHub f1339d3ee5 docs(cli): note that worktree spawn-peer needs a git repository (#2410) 2026-11-13 08:38:08 +08:00
HeavyGeeandGitHub cca38a4acc fix(cli,hub): clear stale permission required when request is inactive (#2415) 2026-11-13 08:37:27 +08:00
JeeandGitHub b3219357eb fix(pi): register peer tools directly when registerMcpServer is absent (#2418) 2026-11-13 08:37:02 +08:00
Junmo KimandGitHub cad21ec6d0 feat(opencode): fork and rewind OpenCode v2 conversations (#2424) 2026-11-13 08:35:45 +08:00
weishu 06d9e51f5c Release version 0.35.0 2026-11-12 10:16:52 +08:00
KiyoshiandGitHub 31cb262ee0 feat(usage): display CLI account quotas and rate limits in Settings -> Usage (#2389)
* feat(usage): display CLI account quotas and rate limits across Codex, Antigravity, and Claude

* fix(usage): persist live quota state across processes and normalize agy usage

* fix(cli): isolate Claude quota observations by account and bound probe deadlines

* fix(usage): bind Claude quota events to producing session account and surface quota fetch errors

* fix(usage): preserve OAuth token isolation without email and surface Codex read failures

* fix(usage): skip host claude path lookup when test probe override is active
2026-11-12 10:16:07 +08:00
KiyoshiandGitHub 0bea8967b4 fix(agy): wake session and stream reactive background turns over agy acp (#2387) 2026-11-12 08:47:36 +08:00
adminandGitHub 446cf2351c feat(cli): diagnose Bun pre-init fatal crashes in webhook failure messages (#2365) 2026-11-12 08:46:26 +08:00
AnanovoandGitHub 2e8b2a108b fix(codex): preserve completed-fork availability across stale refreshes (#2370) 2026-11-12 08:45:54 +08:00
Junmo KimandGitHub 20878e317a fix(claude): mark only the compaction turn result, not pending-compaction rounds (#2374) 2026-11-12 08:45:40 +08:00
weishuandGitHub 926eac7023 fix: keep one stable HAPI session id per Claude conversation (#2388)
* fix: keep one stable HAPI session id per Claude conversation

Every terminal `hapi claude -r` minted a new HAPI session id for the same
Claude conversation; the hub then merged the duplicates after the fact and
deleted the older row, so links and peer references to it broke, and two
live duplicates hid one row in the web sidebar.

CLI: resolve identity before Claude starts (HAPI_SESSION_ID is fixed at
bootstrap). `--resume <id>` / `--continue` look up the owning HAPI session
and reopen it with the same id, handing an active remote session over and
refusing one controlled by another terminal; bare `--resume` uses the
`hapi resume` picker filtered to Claude. Rotated Claude ids are kept in
`claudeSessionIdHistory` so older ids still match.

Hub: schema v35 adds `session_redirects`; every merge that deletes a row
records old -> survivor, and client-facing lookups follow it (sockets and
job ownership stay strict). New `GET /cli/sessions/resume-target-by-agent`.

Web: a merged-away URL moves to the survivor instead of bouncing home, and
live Claude duplicates stay visible in the sidebar.

* fix: keep job-key remaps and hub-archived resumes working after redirects

Review follow-up for the stable session identity change.

- Job routes: the session lookup now follows a merged-away id to the
  survivor, so `requestedSessionId` must stay the raw URL id. Otherwise a
  colliding `<old id>/<key>` remap was bypassed and PATCH/DELETE/late PUT
  through the old id hit the survivor's own job.
- Terminal resume of an inactive session now asks the hub to clear a
  hub-authored archive first (`POST /cli/sessions/:id/prepare-local-resume`,
  same clear as hub reopen), so `hapi claude --resume/--continue` (and
  `hapi resume`) no longer exit on the #1911 existing-session guard.

* fix(cli): refuse an explicit Claude resume whose transcript is gone

Reopening the owning HAPI session drops --resume and hands the id to the
local launcher, which silently starts a fresh conversation when the
transcript is missing — under the existing HAPI id, title and history.
Check the transcript before any handoff or archive change and fail
explicitly instead.

* fix: follow merged-session redirects on /api only for clients that rebind

Native clients store a session detail under the requested id and drop SSE
events for any other id, so a merged-away id that resolved to the survivor
loaded history but never showed live messages.

`SyncEngine.resolveSessionAccess` is strict again by default; `/api` routes
follow redirects only with `x-hapi-follow-session-redirects: 1`, which the
web client (that rebinds to the returned id) sends. Native clients keep the
previous 404. CLI REST always follows. Job routes still keep the raw URL id
for key remaps under both modes.
2026-11-12 07:05:37 +08:00
Junmo KimandGitHub 7ac33a70c3 feat: show generation rate (tok/s) for Codex rounds (#2379)
* feat(codex): fill the round footer tok/s from app-server timing

Measure each Codex round's generation window the way agy rounds do: the
live turn span minus tool-execution and wait-for-the-user windows, over
the thread-cumulative output-token delta, emitted on the turn's
turn_duration so the round footer shows tok/s. Tool windows prefer the
app-server's own item timing (startedAtMs/completedAtMs/durationMs).
The token baseline is the last reported cumulative total: the CLI seeds
a thread it created in this process (thread/start) to zero, while
resumed and forked threads receive the app-server's attach-time usage
replay and stay unseeded, so inherited history is never counted as a
turn's output. Only the live root-turn feed reaches the ledger: history
replays re-project old items and must not settle a round. Permission
hooks keep timing waits for the user.

* fix(codex): seed gateway-created threads for the first-turn tok/s baseline

Native /new and /clear create threads through the gateway before/after
hooks, whose after() binds the fresh root without the zero usage seed
the runtime create path applies - so the new thread's first turn
captured a null baseline and never showed tok/s. Seed it there too,
same as create(): thread/start only, since forked threads receive the
app-server's attach-time usage replay instead (tiann/hapi#2379).

* fix(codex): keep the active generation ledger across a hub-only reconnect

SharedCodexRoot's session.onReconnect reset the whole projection, but a
hub reconnect only replays final history: the native turn keeps running
without a new turn/started, so dropping the ledger identity, baseline
and windows made generation.settle() return null at completion and the
round permanently lost its tok/s. Add projection.resetAfterHubReconnect
which replays without touching the ledger; the app-server reconnect
path keeps the full reset, because the resumed turn re-announces itself
and must re-measure from its own start (tiann/hapi#2379).

* fix(codex): seed fresh usage before session-ready releases queued input

The gateway thread/start seed ran in the after() hook, after the bind
wrapper had already activated the root: registerControls and
emitSessionReady open the input gates, so a queued Web prompt (or one
submitted on session-ready while the runner notification is delayed)
could start the thread's first turn before the zero baseline existed,
and seeding afterward could not repair that captured-null turn. Move
the seed into the bind wrapper right after root.bind, guarded by a
freshThread flag the create and gateway paths set for thread/start
only - forks keep their app-server attach-time replay baseline
(tiann/hapi#2379).
2026-11-11 20:32:54 +08:00
adminandGitHub eff515e2e0 feat(cli): rotate hub entries after repeated connect failures (#2383)
Self-hosted hubs are commonly reachable through several origins (an
edge-proxied domain and a direct one); cross-border interference can
randomly break TLS on either for hours. A runner pinned to a single
HAPI_API_URL sat dead through those windows.

When HAPI_API_FALLBACK_URLS is set, the machine client keeps a rotation
ring (primary + fallbacks) and, after HAPI_API_FAILOVER_AFTER (default 5)
consecutive connect failures, tears the socket down and reconnects
through the next entry. A successful connection on a fallback schedules
a return-to-primary attempt after 30 minutes. Without the env, behavior
is byte-for-byte unchanged.
2026-11-11 20:30:23 +08:00
weishu 92da78469a Release version 0.34.6 2026-11-11 13:10:41 +08:00
AnanovoandGitHub 5e76af5615 feat(codex): fork running sessions through the last completed turn (#2369) 2026-11-11 13:04:43 +08:00
AnanovoandGitHub f11f7097ef fix(cli): respect workspace image delivery preferences (#2368) 2026-11-11 10:03:57 +08:00
Junmo KimandGitHub ac82d2d8d6 feat: show generation rate (tok/s) for Claude rounds (#2367)
* refactor(agent): extract agy's generation-time clock into a shared helper

agy computes generation time as the round minus tool-run and user-wait
windows. Move the window math and the event-fed bookkeeping into
cli/src/agent/generationClock.ts (GenerationClock + generationTimeMs) so
other ACP launchers can time their rounds the same way, and feed agy's
clock the same session updates and permission waits it always did.
Numbers are identical: the moved pure function is agyGenerationMs
verbatim and the agy tok/s integration tests pass unchanged.

* feat(claude): fill the round footer tok/s from the SDK result

Claude Code reports duration_api_ms on every result: the API-active time
of the round, with tool execution and permission waits already outside
it. Pair it with the round's usage.output_tokens and send both in the
existing turn_duration resultSummary, so the web's generic round-summary
normalizer picks them up and the footer renders tok/s — no new wire
types, and the renderer already knew how to format the pair.

Errored rounds and the manual /compact turn carry no meaningful
generation rate, so they emit nothing: claudeRemote marks the compact
turn result in-process (hapi_compact_turn) before it reaches the log
converter. Values that cannot produce a rate (zero, negative, fractional,
missing) are omitted rather than guessed.
2026-11-11 08:57:45 +08:00
KiyoshiandGitHub a9024c0eb8 fix(deps): patch WebSocket and math rendering dependencies (#2361)
* fix(deps): patch WebSocket and math rendering dependencies

* fix: retain the release version after integration validation
2026-11-10 16:33:33 +08:00
weishu b312641b30 Release version 0.34.5 2026-11-10 16:26:31 +08:00
SSU-WEI HUANGandGitHub 7ac95e0e2e fix(cursor): fresh-spawn resume when ACP thread never persisted a store (#2184) (#2343) 2026-11-10 15:32:27 +08:00
AkiiiaandGitHub bfec91b5e1 fix(codex): start a new goal after the previous one completes (#2338) 2026-11-10 15:20:33 +08:00
39da0be557 feat(cli): Cursor emits AGENT_NOTIFY_SUMMARY when status-summary toggle is on (#2354)
* feat(cli): Cursor emits AGENT_NOTIFY_SUMMARY via rules overlay

When Emit status summaries is on, install a transient workspace
.cursor/rules overlay for Cursor ACP sessions and clean it up on
teardown, closing the flavor hole left after #1376.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): harden Cursor notify-rule overlay ownership and exclude

Address review on the emit overlay: clear ownership state under lock,
refresh crash-recovery snapshots after user replacement, fall back to
an alternate rule filename when the primary path is tracked, and lease
.git/info/exclude so git add -A cannot stage the transient rule.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): path-scope notify overlay ownership and reap excludes

Refresh restore snapshots on live user replacements, key ownership by
selected rule path, and prune dead PID-stamped .git/info/exclude leases
left by crashed Cursor sessions.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): harden Cursor notify overlay against symlink and path traps

Refuse rule writes through symlinks, canonicalize workspace paths for
ownership, escape literal Git exclude patterns, and qualify settings
copy as Cursor ACP.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): preserve unreadable rules and file modes in notify overlay

Skip install when an existing rule cannot be backed up, restore original
permission bits on cleanup, and stop retrying ownership-lock callback
failures as lock contention.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): keep notify overlay restore snapshot on unreadable cleanup

When teardown cannot read the generated rule, leave the file alone but
retain the private ownership snapshot so a later session can restore the
user's original content; write state.json as 0600.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): restore notify overlay snapshot even if install never wrote

Last-owner cleanup now restores from the shared snapshot whenever the
on-disk rule is still HAPI-owned, including handles that registered then
failed before writing the generated rule.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): write notify overlay ownership state atomically

Replace in-place state.json writes with temp+rename so a partial failure
cannot destroy the only backup of a user rule, and harden the failed-
install recovery test to actually chmod the exclude file.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): fail closed on abandoned notify overlay locks

Publish pid+token via link(2) like the MCP overlay so a crashed holder
leaves an identifiable lock, and surface an actionable rm path instead of
silently spinning for five seconds.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): retry notify overlay lock when holder already released

After link EEXIST, a missing lock means the contender freed it before our
owner read - retry acquire instead of misreporting the path as abandoned.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): treat notify lock ENOENT during owner read as retry

Distinguish missing vs invalid lock contents so a holder that releases
between existsSync and readFile is not misclassified as abandoned.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(cli): recreate notify overlay stateDir under the ownership lock

Last-owner cleanup no longer rmdirs stateDir, and install mkdir+write runs
inside the lock so a waiting installer cannot hit ENOENT on state.json.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 15:12:06 +08:00
Junmo KimandGitHub ce6d074a54 fix(session): deactivate a session as soon as its runner child dies (#2351)
* feat(shared): add session-child-exited CLI socket event

* feat(cli): report unexpected runner child exits to the hub

* feat(hub): mark a session inactive when its owning runner child exits

* fix(hub): respawn resume when the active session has no live CLI socket

* fix(hub): fail safe owner guard when the session row has no start marker

A session row can carry no hostStartMarker (the CLI's start-marker probe
fails at spawn). The child-exit owner guard then matched on pid alone, so
a late notice from an old process whose pid the OS reused deactivated the
current owner instead of being ignored.

Require an exact marker match whenever either side carries a marker, and
when both sides lack one, accept only a notice that is not older than the
current owner's registration (metadata.lifecycleStateSince, written by the
CLI together with hostPid on every spawn). Anything else falls back to the
keep-alive grace.

* fix(cli): release intentional-stop pid markers that no exit event will consume

intentionallyStoppedPids entries were only consumed by onChildExited. A
stop that ended already_gone, still_alive or unknown never produced that
exit event for pids without a runner-spawned child handle, so the entry
stayed forever and suppressed the real unexpected exit of a later child
that reused the pid.

markIntentionalStop now returns the pids it marked plus the subset with a
child 'exit' listener; the stop wrapper releases the rest once the stop
attempt settles, so only exits that a spawned child will still report
through onChildExited keep their suppression.

* fix(hub): only respawn an active row without a live socket when it is runner-spawned

An empty session socket room also happens during a transport reconnect
while the CLI process still runs. Resuming a terminal-started session in
that window fell through to spawning a second CLI: the runner's spawn
dedupe only covers sessions it spawned itself, so the replacement could
overwrite ownership metadata and compete with the original process when
its socket returns.

Keep the legacy no-op success for active rows the hub cannot prove are
runner-spawned; runner-spawned rows keep the respawn shortcut, where the
runner deduplicates spawns per existing session while its child lives.

* fix(cli): keep intentional-stop suppression only for the pids a stop terminated

A stop that preserved a shared Codex wrapper for sibling roots returned
stopped while its PID stayed marked intentional; because the wrapper has
an exit listener, the marker survived until the wrapper's own exit. A
wrapper that later crashed on its own consumed that stale marker and
suppressed the death notifications for every sibling root, leaving them
active until the keep-alive grace. Failed stops that leave a tracked
child alive leaked the same way.

Record the PIDs each stop attempt actually terminated and retain their
suppression only while the child's own exit event is still pending;
release the rest (preserved wrappers, children left alive, already-gone
outcomes) so a later real death is reported.

* revert(hub): keep the active-session resume shortcut

Revert the ghost-active respawn from resume: an empty socket room also
happens during a transport reconnect, runner dedupe can return the live
child while the resume path waits for a fresh ready the session never
re-emits (Pi readiness emits once), and a ghost-active Codex row refuses
cold resume while the row is still active. Upstream's original behavior
returns success for any active row; dead owners there are recovered by
the child-exit notice, the owner guard, and the keep-alive grace.
2026-11-10 15:11:29 +08:00
SSU-WEI HUANGandGitHub b7b1da40eb feat(copilot): reasoning effort selection for remote sessions (#2348)
* feat(copilot): reasoning effort selection for remote sessions

Copilot's ACP session advertises the active model's reasoning levels as a
thought_level config option. Expose it like Grok's: a session RPC + hub
route for the options, the composer effort picker, and per-turn
session/set_config_option in the remote launcher. The runner forwards
--effort so resumed sessions keep the selection.

* fix(copilot): keep effort options in step with model switches

Copilot answers session/set_model with no config options and pushes the
new model's thought_level via config_option_update; capture it (opt-in in
the ACP backend), re-baseline the launcher's effort after a switch, report
'switch pending' until the next turn applies it, and have the web poll
until discovery succeeds instead of giving up on the first failure.

* test(acp): flavor-neutral config_option_update test

* fix(copilot): gate effort discovery on the model the backend applied

Compare the model the next queued turn carries with the backend's model
instead of session state, so an older queued batch or a failed switch
keeps discovery pending; forward the saved effort on terminal resume.
2026-11-10 15:11:16 +08:00
SSU-WEI HUANGandGitHub 42a00d5dcf fix(cli): name the failed phase and delivery state in ping_peer errors (#2345) 2026-11-10 14:55:51 +08:00
SSU-WEI HUANGandGitHub 72ecf885d6 fix(codex): resolve developer instructions after session bootstrap (#2344)
Fixes #2305
2026-11-10 14:55:34 +08:00