mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-25 05:07:05 +00:00
bfec91b5e1d264f87d13529bc993da093135c83e
210
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bfec91b5e1 | fix(codex): start a new goal after the previous one completes (#2338) | ||
|
|
72ecf885d6 |
fix(codex): resolve developer instructions after session bootstrap (#2344)
Fixes #2305 |
||
|
|
ee73f3a848 |
feat: show progress bar on session for hours-long jobs (#1424)
* feat: session-attached long-running jobs (#1404) Hub-persisted jobs that outlive the agent process: register/update/clear via REST + `hapi job`, surface primary running progress on the session list even when active=false. Opt-in registration only — not thinking progress. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(jobs): agent guidance + wall-clock elapsed on list chrome Document the session-job contract for agents and always show startedAt elapsed next to remaining/fraction/running so indeterminate drains still read as wall time without inventing an ETA. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): address Opus cold-review Majors for #1404 Add hapi job run supervisor (auto-heartbeat + exit status), follow post-merge job-owner redirects so $HAPI_SESSION_ID heartbeats keep working, cover the CLI parser/resolve/run paths with tests, and steer agents toward the supervisor instead of an idle-agent heartbeat myth. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): honor explicit startedAt on PUT; document late-attach clock Beets dogfood: PATCH rejects startedAt; sticky PUT clock made elapsed lie after late attach. Explicit upsert startedAt now corrects; CLI --started-at; clear+set recipe kept for older hubs. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): keep merge redirect keys in MetadataSchema (#1404) SessionCache.refreshSession stripped jobsAcceptedFromSessionIds / jobsTransferredToSessionId as unknown keys, so resolveAttachedJobSessionId could not follow post-merge heartbeats. Declare the fields, add a real SessionCache integration test, and pass full UUIDs through the CLI when the merge source is missing from GET /sessions. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(jobs): MCP session_job tool for catalog-level discoverability Expose session-attached jobs in the same HAPI MCP catalog as ping_peer / inspect_peer so Cursor/ACP and steered flavors see outliving-work meters as first-class tooling, not docs-only. Auto-approve own-session calls; steer prefers MCP set/update or CLI job run for supervised children. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(web): tri-state pin — default long-running jobs with #1404 Replace boolean pin-in-progress with off / jobs / all. Unset preference defaults to jobs so outliving attached-job sessions float to In progress by default; legacy true→all, false→off. Settings Display gets a 3-way control. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): cold-review pass 3 Blocker + Majors (#1404) CI: bump migration tip expects to SCHEMA 22; stub list attachedJobs mocks; align Codex/OpenCode/ACP fixtures with job steer + session_job tool list. Merge: write jobsAccepted/Transferred redirects after metadata merge so a name/summary copy cannot clobber the post-merge job owner map. MCP: session_job is own-session only (drop sessionId from schema) so auto-approve cannot silently write peer meters. Prefer hapi job run in steer. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): close pass-3 minors — stable primary, own-client heartbeats Resolve JWT/session once for job run heartbeats; order primary job by started_at ASC; cover job redirect 404 + invalid key/body; idle jobs get a Jobs bucket (not Running); treat attachedJob.startedAt as render-relevant. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): refresh JWT for long job-run heartbeats (#1404) Cache sessionId once but re-exchange JWT before hub's 4h expiry and on 401 retry so days-long supervised jobs keep heartbeating and can still mark completed/failed. Log the first heartbeat failure to stderr. Co-authored-by: Cursor <cursoragent@cursor.com> * test(jobs): cover proactive JWT refresh; map 401 to auth_failed Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): stamp fresh startedAt on job run; prefer supervisor Re-running the same job key was sticky-reusing a prior row's startedAt, so elapsed lied. Drain in-flight heartbeats before terminal status. Align AGENTS/guide: CLI supervisor first, MCP as manual path. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): typecheck-safe assertion for run startedAt Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): type put mock args so startedAt assertion typechecks Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): address Codex Majors — redirect ancestry, heartbeat status, ACP allowlist Inherit jobsAcceptedFromSessionIds across A→B→C merges; heartbeat PATCH omits status so late ticks cannot resurrect running; drop session_job from global name-only auto-approve (bridge/--allowedTools remain the trust path). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): type from-session metadata when inheriting job redirects Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): version attachedJob SSE; keep live job on merge collision Gate list cache on versioned attachedJob patches so dual EventSources cannot resurrect a cleared meter. On transfer key collision, prefer a running source over a terminal target (heartbeats no longer rewrite status). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): monotonic attachedJob emit watermark (not primary.updatedAt) Primary switches can go backwards in updatedAt and strand the list cache. Emit versions are Math.max(Date.now(), prev+1); REST list stamps a fresh wall-clock watermark so null jobs do not reset the client gate to 0. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): one attachedJob watermark allocator for REST and SSE GET /sessions and emitAttachedJobChanged share allocateAttachedJobVersion so equal-ms terminal patches are not rejected after a list refetch. Also preserve real Unix signal exit codes in hapi job run. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): stub allocateAttachedJobVersion in sessions route mocks Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): always record merge redirects even with zero jobs transferred Agents may attach the first outliving job after merge while still holding the pre-merge HAPI_SESSION_ID; redirects must exist before that first set. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): install source redirect before merge awaits; allow empty update Point jobsTransferredToSession immediately after transfer so mid-merge heartbeats follow the new owner during scratchlist I/O. Empty CLI/MCP update bodies are heartbeat-only (hub stamps heartbeatAt). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): expect empty MCP update as heartbeat Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): treat merge redirect metadata as hub-owned CLI update-metadata must not forge or erase jobsAcceptedFromSessionIds / jobsTransferredToSessionId — same strip/restore as supersede/clear links. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): reconcile REST list against attachedJob watermark Slow /api/sessions can finish after SSE clear/progress and resurrect a stale attachedJob. Also prefer newer terminal results on merge key collisions. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): retry terminal status write; reject startedAt on update Supervisor exit is the only running→terminal transition — retry transient hub failures. --started-at / startedAt only apply to set, not update/run. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): keep both live jobs on same-key merge Dual-running collisions remap the source key and record jobKeyRedirects so pre-merge supervisors cannot terminal-mark the winner. Also raise the flaky claudeRemote first-result test timeout under CI load. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): hard-refuse MCP set; louder stale heartbeat chrome Process-shaped work must use Shell hapi job run. MCP set is refused with the run recipe (wardrobe freeze). Stale rows show "no heartbeat · age". Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): preserve jobKeyRedirects across metadata merge + A→B→C Recompute merge metadata from latest target so early key remaps are not clobbered; compose inherited redirects through the current remaps. Localize stale/progress chip strings (en + zh-CN). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): keep running-job stubs in sidebar; align bar precedence Empty idle stubs with a live attachedJob must survive prepareSidebarSessions before title metadata lands. Match fraction to remaining-first label order. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): block delete while job running; keep jobful dedup losers CASCADE would erase outliving meters on inactive delete. Sidebar dedup must not hide a running attachedJob behind a jobless duplicate winner. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): guard store delete for running jobs; transfer on Codex merge Route-only 409 still left Codex duplicate consolidation and other callers cascading live meters. Refuse in DELETE SQL, clear watermarks, and transfer+redirect before Codex hard-deletes duplicates. Co-authored-by: Cursor <cursoragent@cursor.com> * test(jobs): stub transferAttachedJobs in Codex duplicate-merge mock Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): fence supervisor PATCH with expectedStartedAt Stale hapi job run processes must not heartbeat or terminal-write a newer run that reused the same job key. Treat startedAt as the run generation: supervisors send expectedStartedAt; hub rejects mismatches with 409 (CAS in SQL too). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): CAS supervisor writes with UUID runId (schema V24) Date.now()/startedAt is not unique across concurrent job-run processes. Persist run_id, mint UUID on PUT (client or hub), and reject PATCH when expectedRunId does not match. Replaces the interim expectedStartedAt fence. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): heartbeat PATCH must not re-send launch --detail Supervisor timer only needs expectedRunId so MCP/CLI progress detail updates are not clobbered by the next heartbeat. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): stamp heartbeatAt on the hub only Drop heartbeatAt from upsert/patch schemas and always persist Date.now() on the hub so a skewed/future client clock cannot keep a dead job green. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(jobs): note schema tip V25 after A2A V23 collision Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): clear stale jobsTransferred redirect on reclaim When A→B then B→A makes A canonical again, drop A's outgoing jobsTransferredToSessionId so resolve(A) no longer hops to deleted B. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): transfer attached jobs on OpenCode /clear finishOpenCodeClear already wrote supersededBySessionId (which job APIs follow) without moving session_jobs. Transfer first so heartbeats on the retained source id reach the replacement row. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): follow job redirects with cycle detection Replace the five-hop cap so supervisors that retain the original HAPI_SESSION_ID across many OpenCode /clear replacements still resolve to the canonical owner. Visited-set stops redirect cycles. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): defer no-engine Codex merge; pending outranks Jobs Refuse duplicate merge when SyncEngine is unavailable and the source still has attached jobs (redirects cannot be persisted). Sidebar: put operator-pending ahead of the Jobs bucket when both apply. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): allocate list watermark before reading jobs GET /api/sessions was labeling snapshots with a version allocated after the job read, so a concurrent SSE emit could lose to a stale REST value. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): stamp supervised startedAt on the hub clock hapi job run omits startedAt; hub uses now when runId starts a new generation so runner/hub skew cannot zero or inflate elapsed time. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): preserve -- for hapi job run under normalizeCliArgs Runtime-wrapper handoff was dropping everything before `--` (or stripping `--` itself), so `job run … -- <cmd>` fell through to Claude. Keep `--` when a HAPI command already precedes it; only treat bare `bun entry -- <cli>` as a wrapper handoff. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): allow PATCH null clears from CLI and MCP Hub already accepts null to drop stale remaining/done/total so done+total can take over. Expose that via MCP nullable fields and hapi job update --clear-remaining (and siblings). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): scope -- keep to job run; expose runId fence on CLI Only preserve the child `--` separator for `job run`. Re-inserting it for `hapi -- auth` / `codex --` broke resolveCommand. Manual wrappers can now stamp `--run-id` / `--expected-run-id` to match hub CAS. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): fence DELETE/clear with expectedRunId Stale manual wrappers must not clear a newer run after key reuse; hub DELETE and CLI/MCP clear now honor the same run fence as PATCH. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): include runId on listSessionJobs for fence recovery Safe PATCH/DELETE need expectedRunId; list/MCP/CLI must return the generation so reconnecting wrappers can fence without guessing. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): stamp attachedJob on new SessionSummary test helpers Upstream share-picker / row-summary fixtures landed without #1404 fields; restore typecheck after rebase onto main. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): fail job run when terminal status never persists Child exit 0 with a frozen running meter lied to wrappers; surface hub write failure as exit 1 (run-mismatch still non-fatal). Clarify Active-sessions-only copy for attached jobs. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cursor,web): stop attached-job sessions bouncing Running/Jobs (#1553) Rebase onto upstream/main (#1503). Ignore ambient ACP thinking bumps while the message queue is idle and prompt() is not in flight. Prefer the Jobs in-progress bucket and suppress the thinking spinner when a running attached job is the honest outliving signal. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): do not mask foreground thinking when attached job runs (#1553) Keep the CLI queue-idle ACP guard; web now trusts hub thinking during real prompts instead of treating every attached job as ambient chatter. Co-authored-by: Cursor <cursoragent@cursor.com> * fix: rebase onto upstream/main — resolve test mock conflicts Merge upstream title/summary stubs with attached-job mocks; drop duplicate showSessionSummaryInChat key introduced during rebase. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): preserve child exit 0 when meter cleared during job run Treat terminal PATCH not_found as detached (operator cleared via session_job) instead of a supervision failure. Retry transient 404s; accept absence on the last attempt. Regression test covers successful child after external clear. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cursor): filter only debounced running chatter while queue-idle (#1553) Tag agent-activity listener callbacks with source in AcpSdkBackend so the Cursor launcher can ignore queue-idle state_update:running without hiding harness resume (requires_action, permission). Regression test updated. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(#1424): trust ACP foreground signals; preflight merge job check Drop queue-idle running suppression in Cursor launcher — it hid autonomous harness work. Attached-job Running/Jobs flicker stays in web/sessionInProgress. Refuse no-engine Codex merge before copying history when sources have jobs. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): steer agents away from sleep-stub jobs and remaining=0 traps MCP update-before-create and hapi job run -- sleep while real work runs elsewhere can leave a misleading running meter. Return job-run recipe on not_found, warn when remaining hits zero without completion, and tighten session_job agent instructions. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): steer MCP session_job not_found even when instanceof breaks MCP HTTP server bundles can load duplicate SessionJobError identities so update-before-create fell through to bare "job not found". Detect not_found by code and message, not instanceof alone. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): idempotent MCP clear-not-found; reject --heartbeat-sec off run Clear on an already-absent job returns success without steering to hapi job run. Parser rejects --heartbeat-sec on set/update/clear/list. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): reject mutation flags on job list/clear and status on run Parser now fails fast when list/clear receive label/status/progress fields, or when run receives --status, instead of silently discarding them. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): reject stray MCP fields and non-run command suffix MCP list/clear reject incompatible fields; CLI rejects -- <cmd> unless action is run so clear/set cannot silently drop a trailing command. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): preserve runId on corrective job PUT without runId Started-at corrections via job set must not mint a new generation and break an in-flight supervisor's expectedRunId fence. Docs heartbeat recipe now shows run-id + expected-run-id. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: mark ALL_DONE late-attach example as completed status job set defaults to running; remaining=0 alone does not finish the meter. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web,cli): finish #1424 rebase onto upstream pin buckets Keep Jobs in the In progress section after upstream split Active/Running. Preserve Cursor ACP retry fields and Codex prompt test names from main. Quiet connected sessions stay in directories (#1404 stand). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): rename All activity — quiet connected is not in-progress Connected-but-idle sessions stay in project folders in every pin mode. UI mode label is now Working & pending; drop the unreachable Active pin bucket and the copy that claimed quiet actives floated under All. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(guide): session-id contract and remaining vs bar fill Document hub-row vs worker HAPI_SESSION_ID bug and that --remaining alone does not move the progress bar without total. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): bind isNewerVersionedPatch after sessionPatch extract `export … from` does not put the helper in module scope, so attachedJob list patches failed typecheck after the rebase onto upstream's extract. Guide copy now matches Working & pending; quiet connected stays in folders. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): commit job-row move and owner redirects together A failed metadata write after sessionJobs.transfer left the old session id pointing at an emptied source, so heartbeats 404ed. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): fail-closed session id for remote Cursor job run AGENTS and recipe copy no longer treat \$HAPI_SESSION_ID as always safe; remote Cursor may export a worker row. Cursor resume bootstrap test asserts the requested existingSessionId is exported into the child env. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): refresh job redirects before scratchlist merge await persistAttachedJobRedirects wrote SQLite while resolveAttachedJobSessionId still read stale cache; heartbeats via the old id could 404 during attachment I/O. Refresh both sessions immediately after persist. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cursor): ignore ambient ACP running without a prompt in flight state_update_running chatter while the queue is idle was setting hub thinking and floating quiet sessions (with jobs) into Working. Permission and requires_action still bump; prompt-owned running still bumps. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cursor): drop leftover rebase conflict markers in ACP launcher Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): sanitize job text before terminal stdout Strip VT/ANSI and remaining C0 controls from job key/label/unit/detail/runId in formatJobLine so list/set/update cannot emit OSC escapes from persisted fields. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): sanitize MCP session_job output via shared formatter Move terminalText/formatJobLine into modules so CLI stdout and MCP tool results both strip VT/ANSI/C0 before agents render job fields. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): scrub C1 controls in shared job-output sanitizer Co-authored-by: Cursor <cursoragent@cursor.com> * test(cli): fix C1 sanitizer assertion (content may remain) Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): remap late job PUT when merge left no key redirect When a merged-away session registers a new runId for a key the target already owns as a different running generation, allocate a remapped key and persist jobKeyRedirects so the target's live meter is not overwritten. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): also remap redirected job set without runId on collision Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): tree-kill supervised job children on SIGINT/SIGTERM Bare process.kill only hit the immediate child; a shell grandchild could keep running after the wrapper marked the job terminal. Use killProcessByChildProcess. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): preserve SIGINT on job tree-kill and await teardown Forward the received signal through killProcessByChildProcess so Ctrl-C stays exit 130, and wait for verified tree termination before writing the terminal job meter. Co-authored-by: Cursor <cursoragent@cursor.com> * test(cli): type the tree-kill teardown patch mock for typecheck Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): supply attachedJob fields in upstream session fixtures After rebasing onto main, mark-all-read and app-badge helpers need attachedJob / attachedJobUpdatedAt for SessionSummary typecheck. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): record identity jobKeyRedirects on no-collision transfer A→B transfers that keep the original key must still map A/key→key so a later B→C remap can compose A through to the remapped key instead of resolving onto C's unrelated live same-key job. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): resolve job owner after PUT/PATCH body parse A merge/clear during the JSON await must not leave mutations targeting the pre-merge session id. Validate the body first, then resolve owner and key synchronously before upsert/patch. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): honor identity jobKeyRedirects on corrective PUT Explicit A/key→key maps from no-collision transfers must short-circuit late-registration remapping so job set without runId updates the same row instead of allocating a second key and orphaning the supervisor. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): persist identity redirects on late free-key job PUT Empty A→B then late register left no A/batch map, so B→C remaps could not compose and A targeted C's live meter. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): skip redirect inheritance on late job-key PUT Recording a free-key identity via retained B was reimporting B's stale A/batch map onto C and undoing composed A→B→C remaps. Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): supply attachedJob on new upstream search fixtures Rebase onto main brought search-rank helpers that omit SessionSummary.attachedJob fields required by #1424. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): pass XDG_CACHE_HOME through vitest hub globalSetup Estate bun installs pin the cache via XDG_CACHE_HOME; the test hub whitelist omitted it and `bun run hub` hung before ready. Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): retarget bucketRunningSessions for jobs pin modes Upstream #1820 idle/active boolean buckets no longer exist after the quiet-connected never-floats contract; cover jobs/working/pending instead. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): add Russian strings for session jobs pin modes Upstream shipped ru locale after the jobs pin UI; fill attachedJob and tri-state pin copy so Display settings are not missing keys. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(cli): steer agents to list session jobs before done/archive MCP session_job description and always-on SESSION_JOB_INSTRUCTION now require list on resume and before done; clear zombie running meters without asking the operator. No hub auto-clear. Co-authored-by: Cursor <cursoragent@cursor.com> * test(cli): keep ACP MCP tool list without video/media after rebase Co-authored-by: Cursor <cursoragent@cursor.com> * docs(jobs): forbid frozen 0/N job run for display meters Split alive-only vs fraction bars in the guide and always-on steer: heartbeats do not advance launch --done/--total; name hapi-job-run-metered and the continuous-update portable path; note exit≠semantic failure. Co-authored-by: Cursor <cursoragent@cursor.com> * test(cli): expect Codex autoReview in set-mode allowed lists Upstream #2090 added autoReview after #2095 set-mode tests; update the allowed-mode strings so CI matches the catalog. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): use SessionSpinner for foreground thinking after merge Keep isAgentForegroundThinking gate; match upstream SessionSpinner markup so background/thinking spinner equality tests pass. Co-authored-by: Cursor <cursoragent@cursor.com> * test(hub): expect schema tip v29 in migration-v26 after jobs remap Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): expect fixed-order + jobs pin after merge with upstream display Upstream asserted Fixed session order was gone; #1424 keeps it with the tri-state pin choice group. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): honor Fixed session order with creation-time sort Tip Minor: the setting only paused pin float while directories still sorted by lastUserMessageAt. Use createdAt comparators for rows, groups, and global pins when fixed mode is on. Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): cover Fixed session order vs activity list promotion Upstream order test forced obsolete fixed-order=true and expected activity promotion; with #1424 keeping the setting, split default vs fixed cases. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): preserve composed jobKeyRedirects on cleanup re-merge A second B→C merge with empty remaps was reimporting retained B's stale A/batch→batch and clobbering C's composed A/batch→batch.<B> mapping. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): survive hub-down after job run child exit Terminal completed/failed PATCH now retries connection/502–504 failures for up to ~10m so a brief hub restart cannot leave a zombie running meter. Refuse wrapping hapi-restart-hub / stack-switch argv in job run; document the hard rule in the guide and CLI help. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): classify HTTP 502–504 via SessionJobError.httpStatus Structured hub outage bodies (e.g. 503 "Not connected") no longer drop the status code, so terminal PATCH keeps the hub-down retry window instead of exiting after three short attempts. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: nudge GitHub PR head sync for #1424 Fork tip already includes the upstream/main merge; empty commit to re-fire the cross-repo PR head webhook (API still showed prior SHA). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): honor jobs exception and fixed order under list view Active status filter keeps idle running attachedJob rows (and keeps them out of archived). Fixed session order forces created sort with activeFirst off, not only pin-off. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): ignore obsolete fixed-order key under SessionListView Upstream #2263 made hapi-fixed-session-order obsolete; reading it overrode last-message promotion. Keep jobs-aware status filtering; list sort stays on SessionListView. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): include attachedJob on content-search summaries Content-search replaces live list rows; omitting jobs dropped meters and the active-filter exception for matching idle sessions (#1424). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): remove obsolete fixed session order setting SessionListView owns list order (#2263); the switch only wrote a dead localStorage key and kept recycling tip Findings on #1424. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: nudge GitHub PR head sync for #1424 Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): drop Fixed session order assertion from display settings Matches removal of the obsolete switch under SessionListView (#2263). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): drop fake 1/3 fill for indeterminate attached jobs Remaining-only jobs have no fraction; the old pulse bar painted a constant w-1/3 that looked like progress. Keep honest text; show a bar only when done/remaining+total yields a real fraction. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(jobs): wake owning session on terminal status (#1489) Fold opt-in wakeOnTerminal into the #1424 tip for dogfood-lane ship. Schema v33→v34 additive wake columns + runId one-shot claim. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): release terminal wake claim on delivery failure Provisional wake_emitted claims must clear when resume/send fails so a reconnect retry can reclaim; schedule capped backoff and use a run-scoped localId for send dedupe (#1489 tip Finding). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): requeue wakes after retry budget and follow ownership Keep undelivered terminal wakes eligible after rapid-retry exhaustion and rescan on hub start / machine offline→online. Resolve job-owner and key redirects before claim, release, and deferred retry so merges cannot strand a provisional wake_emitted claim. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): provisional pending wake claims + run fence Persist wake delivery as pending:<runId> until send succeeds so hub restart can clearAbandoned and reclaim. Before send, fence the live row to the claimed run/terminal/opt-in so key reuse mid-resume cannot mis-prompt. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): classic indeterminate marquee for unknown attached jobs Session list claimed an "indeterminate bar" but only rendered the pulse dot when fraction was null. Show a track with a sliding segment (no %) in the same slot as determinate fill, with unit coverage and docs/help aligned to shapes A/B. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): quiet striped indeterminate job bar Replace the loud sliding-chunk marquee with CSS-Tricks-style diagonal stripes that drift slowly at low contrast — still reads as moving, not carnival mode. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): seamless loop for indeterminate job stripes Animate background-position by exactly one 8px tile on both axes so the diagonal stripe phase matches at the loop boundary (was -12px → jump). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(jobs): requeue wakes on machine-update-state online Connect marks active via runner-state update before the first heartbeat, so heartbeat offline→online never fired. Requeue pending terminal wakes when machine-updated refreshes an offline machine to active. Co-authored-by: Cursor <cursoragent@cursor.com> * test(hub): cast private machineCache in wake reconnect coverage CI typecheck failed on private SyncEngine.machineCache access from the machine-updated requeue test. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): monotonic machine active_at on runner-state online refreshMachine only adopts store activity when storedActiveAt is strictly newer than the cache. Same-ms create→updateMachineRunnerState left the cache stuck inactive and skipped #1489 wake requeue. Bump active_at past the activity floor; align the reconnect test with memory-only expiry. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(cli): require --progress mode on job run/set Forces an explicit affordance (unknown|fraction|until) so known-duration countdowns cannot silently fall into indeterminate stripes. until stamps remaining/total and job-run heartbeats re-stamp remaining from the deadline. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(session-jobs): require --progress in create examples Bot Minor: wake/set/heartbeat/CLI recipes and AGENTS.md omitted the now-mandatory progress mode, so copy-paste creates would fail parse. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): refuse numeric sleep without until; honor --started-at on countdown Closes the dogfood footgun: sleep N under unknown/fraction is rejected. Until-mode job run accepts --started-at so mid-window re-attach keeps the original window total; heartbeats stamp against that start. Docs demote estate-only hapi-job-run-metered as non-upstream. Co-authored-by: Cursor <cursoragent@cursor.com> * test(cli): type heartbeat mock args in until startedAt coverage Fixes CI TS2493 on patch.mock.calls[0][1] from an untyped vi.fn. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): exempt job-wake prompts from session-end sweep Session-end was synthetically consuming unacked hapi-job-wake: rows, so a completion wake queued behind an active turn could be lost when the CLI disconnected before messages-consumed. Mirror the ping-peer- exemption so wakes stay replayable until a real runtime ACK. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
f34ff13fce |
feat(peer): forward peer replies back to the caller with waitForReply (#2167)
* feat(peer): spawn_peer and reply forwarding for peer sessions Peer sessions could only fire messages at each other: the caller had to poll inspect_peer to learn that a peer finished, and nothing woke it once it ended its turn. There was also no way to start a peer for new work. - spawn_peer starts a session on the caller's machine (directory and agent default to the caller's) and sends it a task. - ping_peer gains waitForReply. - In both cases the caller's CLI watches the peer and, when its turn ends, posts the peer's latest reply into the caller session, which starts the caller's next turn. spawn_peer needs manual approval like ping_peer. No hub changes. * refactor(peer): drop own spawn_peer; add waitForReply to upstream spawn_peer Upstream #1922 ships spawn_peer (spawn, rename, remit delivery, fresh-child wait, manual approval). Remove this PR's duplicate spawnPeer and keep only reply forwarding: spawnPeer now returns the remit's ping-peer localId and resolved flavor, and MCP spawn_peer/ping_peer share one waitForReply hook. Add a steered-task attribution test. Co-Authored-By: Claude <noreply@anthropic.com> * fix(peer): keep waiting for a task an offline peer has not read The hub keeps unconsumed peer tasks for replay, so a peer that goes offline before reading the task can still run it after a resume. Only a stop after consumption ends the reply watch. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
3ce46a9b13 |
feat(acp): re-enable change_title for ACP launchers with manual title precedence (#1672)
* feat(acp): re-enable change_title for ACP launchers with manual title precedence opencode/cursor/kimi disabled the hapi change_title MCP tool (#1028), relying solely on native ACP session-title sync. When the agent never generates a native title there was no way to set one short of hub API calls. Re-enable change_title on those launchers. The shared title-sync controller marks manual titles, so later native sessionInfoUpdate titles no longer overwrite them. * fix(acp): include copilot in change_title re-enable and harden tests Copilot has the same ACP title-sync shape as opencode/cursor/kimi, so it gets the same shared controller wiring. Add a cursor regression test asserting one controller instance is shared across backend (re)creation paths and cover the onChangeTitle failure path. * fix(acp): persist manual title precedence in session metadata The manual flag lived only in one controller closure, so a recreated remote launcher or a resumed session started fresh and let the next native ACP sessionInfoUpdate overwrite a change_title rename. Store acpManualTitle in session metadata and initialize new controllers from it. * fix(agent): preserve acpManualTitle through existing-session bootstrap bootstrapExistingSession rebuilds metadata through an allowlist, so the manual-title marker was dropped on process resume and native ACP title sync could overwrite a change_title rename. * fix(cursor): preserve manual title precedence across live relaunch |
||
|
|
5a5731f938 |
fix(cli): stop peer pings from waking or broadcasting to unrelated sessions
ping_peer resumed any inactive target by default, and list_peers returned the whole namespace (including offline sessions) with no machine or cwd, so agents re-woke finished collaborators and broadcast exclusive-work notices to every listed peer. - ping_peer refuses inactive targets unless wake=true (CLI --wake, exit 5); spawn_peer keeps waking its own fresh child. - list_peers lists active sessions only (hub GET /api/sessions?active=true) unless includeInactive (CLI --list --all); rows show busy/idle, machine, cwd, and same-machine/same-cwd marks relative to the caller. - inspect_peer reports the peer's machine. - Prompts and tool descriptions: message only task-related peers, inspect unfamiliar peers first, never broadcast, never wake for FYI/status. |
||
|
|
e2b2af695b |
feat(codex): support explicit local model catalog configuration (#2266)
* fix(codex): reuse local model catalogs by default * fix(codex): verify catalog provenance and native schema before reuse * fix(codex): keep refresh credentials out of discovery homes * refactor(codex): reduce catalog support to explicit configuration * fix(codex): invalidate selected catalogs and resolve shim names |
||
|
|
8c602eb7a1 |
fix(cli,hub): prevent premature archive failures on Windows (#2126)
* fix(cli,hub): prevent premature archive failures on Windows * fix(cli): preserve tree-wide forced shutdown escalation * fix(cli): stop disconnected survivor subtrees completely * test(hub): assert structured archive cleanup uncertainty * fix(cli): use invariant Windows process markers * fix(cli): attempt Windows termination when CIM fails |
||
|
|
7f5d6b17f3 |
feat(peer): spawn-peer remit + rename-proof Parent UUID stamps (#1922)
* feat(cli): spawn-peer with required remit and MCP spawn_peer Machine spawn creates an empty composer; stuffing message into that JSON is stripped. Add hapi spawn-peer and MCP spawn_peer that spawn, rename, deliver via the ping-peer path, and fail closed unless the remit is on the new session. Reject message/prompt/text on machine spawn with 400. Do not auto-approve spawn_peer in default/read-only. Fixes #1509 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): reject overlong spawn-peer names before spawn Hub rename max is 255; continuing past PATCH 400 left a live session under a different title. MCP/steer copy now says the hub 400s a spawn-body remit instead of stripping it. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): wait for fresh spawn-peer child instead of resuming it Machine spawn can return while the hub row is still inactive. ping-peer then POSTed /resume, which can launch a second agent because the original spawn has no existingSessionId for runner dedupe. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): reject flavor-illegal permissionMode before spawn-peer Codex + bypassPermissions (and Pi + any mode) used to reach the runner and fail after a child existed, or silently drop the mode. Check isPermissionModeAllowedForFlavor when both agent and mode are explicit. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): treat omitted spawn-peer agent as Claude for permissionMode Hub and runner default agent to claude when spawn omits it. Validate permissionMode against that effective flavor so yolo/read-only fail closed before a child starts. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): resolve spawn-peer dir locally and archive failed children Relative --dir values were forwarded unchanged, so the runner resolved them against daemon cwd. Remit delivery failures also left the new session running, so a retry spawned a duplicate. Resolve in the caller and best-effort archive the child before rethrowing. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): verify remit before archiving a failed spawn-peer child A timed-out ping-peer POST can still land the remit. Check the transcript before archive, and only say the child was archived when the hub returns ok. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): swallow spawn-peer transcript GET errors and skip unapplied names A thrown messages GET after spawn skipped archive and leaked a live child. Treat transport errors as a miss so the verify loop can retry, then clean up. Also do not return a requested name the hub never applied. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(spawn-peer): hub peerSpawnDefaults + model/effort spawn surface Add hub settings peerSpawnDefaults (agent, permissionMode, per-flavor models) with stock claude/yolo/sonnet fallbacks. spawnPeer resolves explicit args → hub settings → stock, maps yolo to flavor equivalents, and forwards model/effort into machine spawn. Settings UI under General → Agents; MCP/CLI optional overrides. Co-authored-by: Cursor <cursoragent@cursor.com> * test(hub): use cursor-valid permission mode in peer spawn defaults test Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): teach spawn_peer that omit permissionMode means yolo MCP copy said "pass permissionMode only when the operator asked", so agents omitted it and got hub/stock whatever was stored — often approval-gated default. Clarify omit = yolo via peerSpawnDefaults/stock; pass only to tighten. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub,web): apply peerSpawnDefaults to machine spawn and New Session POST /api/machines/:id/spawn now resolves omitted agent/permissionMode/model from hub Settings, and New Session seeds from the same peerSpawnDefaults so UI create and peer spawn share one authoritative default (stock yolo). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): NewSession hub seed respects sticky prefs + QueryClient in tests Sticky localStorage last-used agent wins over hub seed; machine spawn still applies peerSpawnDefaults server-side. Tests provide QueryClientProvider. Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): mock CREATABLE_AGENT_FLAVORS for settings general peerSpawn UI Co-authored-by: Cursor <cursoragent@cursor.com> * test(web): stabilize NewSession tests after hub peerSpawnDefaults seed Wrap remaining mounts in QueryClientProvider, pre-seed hub settings so a late useQuery resolve cannot wipe in-test model picks, and use neutral stock permission defaults in the fixture. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): address tip Codex Majors for peerSpawnDefaults Preserve explicit yolo booleans on machine spawn, fail closed when hub defaults cannot load, validate permission modes against the resolved agent, remap auto-approval across flavors, and stop late hub settings from wiping New Session edits. Reject retired agents in spawn defaults and restore the CLI executable build docs. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): address follow-up tip Codex Majors Stop absent Yolo localStorage from beating hub defaults, track New Session edits before late hub seed, reject incompatible machine-spawn permissions, resolve MCP spawn_peer paths against the session working directory, and hide unsupported Codex safe-yolo from Settings spawn defaults. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): clear tip-2 CI and follow-up Codex Majors Omit permissionMode for Pi/DSH, preserve explicit Yolo-off across delayed hub seed, fix settings test mocks for launch permission helpers, and restore unrelated CLI README lifecycle/ACP docs. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): tip-3 Majors for seed edits and launchable modes Skip hub agent seed after permission edits, resolve inherited modes via the launch catalog (AGY request-review fallback), preserve hub Cursor models through preference restore, and restore Codex auth README nuance. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): tip Minors for Cursor/Grok hub permission seeding Give Cursor the native permission select so Plan/Ask survive machine spawn, and re-apply Grok hub permissions after agent-init resets. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): tip Minors for Cursor select and hub seed remap Map hub permission through resolvePermissionModeForFlavor, keep native Default when agent is explicit without a model, and assert Cursor Plan/Ask Mode labels. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): tip Minors for delayed hub seed and Default model Apply hub permission/model to unset fields even with a sticky agent, preserve explicitly saved auto models, and seed OpenCode/AGY selectors from hub defaults. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): tip Minors for model edit sticky and clear override Mark OpenCode/AGY model picks as edited so delayed hub seed cannot overwrite them, and treat empty hub model values as clear sentinels. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): tip Majors for models patch typing and remit page scan Type the models patch as NonNullable and paginate transcript verification oldest-ward so a busy child is not archived when the remit leaves page 1. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): tip Minor — keep agent after explicit model pick Do not apply a late hub default agent when the operator already chose a model; otherwise preference restore drops that selection. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(spawn-peer): tip Cursor YOLO migrate and Codex effort map Bridge Cursor's saved YOLO toggle (incl. false) into native Default over hub yolo, and send Codex/OpenCode --effort as modelReasoningEffort. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): tip Majors — scoped YOLO bridge and catalog fallback Keep unsupported saved permission modes at Default instead of hub yolo, and apply delayed YOLO migration only when the sticky bridge agent matches. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): drop rebase conflict markers in startHappyServer Both sessionDisplayRename and spawnPeer imports are required after rebasing onto upstream rename work; markers had slipped into tip. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): wrap Kimi NewSession tests in QueryClientProvider Hub settings useQuery requires a provider; upstream Kimi catalog tests rendered bare and broke after the spawn-peer rebase onto main. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(peer): rename-proof Parent UUID stamp on spawn remits Orchestrated spawn_peer / spawn-peer remits now auto-stamp a durable [title](/sessions/<uuid>) Parent chip (fail-closed in-session). MCP copy forbids inventing titles; UUID stays identity after parent rename. Refs heavygee/hapi#175 Co-authored-by: Cursor <cursoragent@cursor.com> * style(peer): plain hyphen in Parent-stamp warning and test comment Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): reject blank remit before Parent stamp Codex review on #1922: stamping first turned empty remits non-empty and bypassed the idle-session guard. Also only treat ## Parent blocks as already-present so bare /sessions citations still get the chip. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): gate New Session Create on hub defaults; require Parent chip Codex tip review on #1922: block Create while getHubSettings is pending so stock mount defaults cannot bypass restrictive hub peerSpawnDefaults; skip Parent stamp only when ## Parent already has a markdown session chip; clarify codex resume takes a native thread id. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): resolve MCP spawn cwd; Agents settings section Codex Major on #1922: spawn_peer relative directories now prefer the launcher cwd (Codex --cd), then skillLookup, then session metadata.path. Move peerSpawnDefaults UI into the unused Agents settings section. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): pass session cwd to MCP spawn_peer; Agents settings section Codex tip review on #1922: resolve relative spawn_peer directories from the launcher working directory (Codex --cd), skillLookup, then metadata.path; move peerSpawnDefaults UI into the Agents settings section. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): skip archive on unread transcript; validate startingMode after hub agent Codex tip review: do not archive a child when remit verification cannot read the transcript; run AGY/DSH remote-only startingMode checks against the resolved hub agent; update MCP bridge test expectations for workingDirectory. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): treat exhausted remit pagination as unverifiable Hitting the messages page cap with hasMore still true must not count as an observed-empty transcript — that would archive a child whose remit may still exist on older pages. Co-authored-by: Cursor <cursoragent@cursor.com> * docs(cli): list HAPI_API_URL as optional with localhost default Codex tip review: the README had moved HAPI_API_URL under Required even though configuration defaults it to http://localhost:3006 (and settings can supply a URL). Also drop trailing whitespace flagged by git diff --check. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): re-verify empty transcript before archiving failed spawn An earlier observed-absent page plus later unread GETs must not archive a child whose remit may have landed after the first empty read. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): never auto-archive on spawnPeer failure path Timed-out remit POSTs and empty-read/archive TOCTOU races can still land work on the child. Leave the session running with its id for inspection instead of terminating an in-flight peer. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): classify empty_session from final remit verify An earlier empty transcript read must not stick as empty_session once later message GETs become unavailable — report verify_failed instead. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): recognize escaped brackets in Parent chip labels Titles with ] were escaped in the chip label but the idempotency regex stopped at the first raw bracket and re-stamped a second Parent block. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): avoid Parent chip regex backtracking on backslashes Exclude \\ from the single-char label alternative so escaped pairs have one parse path — long nonmatching backslash runs no longer explode. Co-authored-by: Cursor <cursoragent@cursor.com> * feat(cli): MCP/CLI spawn_peer --machine for cross-host remits Wire optional machine (UUID or hostname via GET /api/machines) through MCP spawn_peer and hapi spawn-peer into existing spawnPeer({ machineId }). Skip local directory existence checks for cross-host targets to match the estate wrapper; keep fail-closed remit verify. Fixes tiann/hapi#1931 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): reject ambiguous spawn --machine label matches Tip bot Major on #1922: hostname/displayName selectors that match more than one online runner now fail closed with ambiguous + UUID guidance. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): preserve cross-OS absolute dirs for spawn --machine path.resolve on the caller OS was rewriting foreign absolute roots (C:\… on Linux, /srv/… on Windows) before the hub spawn POST. Detect POSIX or Windows absolute paths and only resolve relative directories. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(peer): resolve spawn dirs after local vs remote is known Defer directory resolution until the target machine is selected. Remote spawns still preserve foreign absolute roots; local spawns use native path.resolve so Windows drive-less paths like \repo bind to the caller drive. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): apply delayed DSH model defaults without replacing edits * fix(web): preserve hub permission defaults across form remounts --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: weishu <twsxtd@gmail.com> |
||
|
|
679a2e36ca |
feat(cli): show images agents view inline in chat
Codex view_image (app-server imageView items) and Claude Code tool results with image blocks (Read of an image, screenshot tools) now emit generated-image messages tied to the tool call, so web/iOS/Android render what the agent looked at instead of only a path. Claude transcript lines forwarded to the hub drop the duplicated base64 payloads. |
||
|
|
ecf40d8851 |
feat(web): fork active and archived sessions from the session list (#2258)
* feat(web): fork active and archived sessions from the session list * fix(codex): preserve fork titles during history replay * fix(web): limit list forks to supported Codex sessions |
||
|
|
59dcddf32b | fix(codex): support queued async user questions | ||
|
|
46bae9b0f1 |
fix(codex): fork archived sessions without reopening the source (#2231)
* fix(codex): fork archived sessions without reopening the source * fix(codex): reconcile interrupted archived fork recovery * fix(codex): release rejected forks and serialize source startup * fix(codex): fence unconfirmed resume startup across retries * test(codex): validate durable resume recovery and serialize archive * fix(codex): block local resume of pending archived fork sources * fix(hub): coalesce concurrent resume requests to preserve idempotent startup * fix(hub): bypass startup coalescing for PTY sessions |
||
|
|
be41e854e0 |
feat(codex,opencode): show compaction summaries and token counts (#2249)
* fix(chat): render available compaction facts * feat(opencode): unify native compaction summary cards * fix(opencode): report actual compaction application lifecycle * feat(codex): render native compaction checkpoints and metrics * fix(chat): render compaction summaries and token facts in native clients * fix(opencode): preserve transcript priming across read failures * fix(opencode): recover snapshot-only replies after attachment |
||
|
|
3e628cad5d | fix(test): make shared launch path assertions cross-platform (#2255) | ||
|
|
557ed3c99f |
perf(codex): reduce history replay during thread recovery (#2214)
* perf(codex): reduce history replay during thread recovery * fix(codex): restore live child subscriptions during bounded replay --------- Co-authored-by: gaodq <gaodq@koal.com> |
||
|
|
f29be07bb9 | fix(codex,web): preserve late command result identity and timing (#2239) | ||
|
|
9384ce031b |
feat(cli): add Codex-aware auto peer delivery
Default peer CLI and MCP messages to auto, steering eligible Codex turns and queueing otherwise. Preserve explicit delivery modes and uncertain-send safety, and clarify steer guidance for important time-sensitive findings. |
||
|
|
2a75984b75 |
feat(cli): add peer delivery modes for CLI and MCP (#2197)
* feat(cli): select queue or steer for peer messages * fix(peer): respect per-agent steering availability --------- Co-authored-by: NightWatcher <hitszzzf@gmail.com> Co-authored-by: weishu <twsxtd@gmail.com> |
||
|
|
009e6d7799 |
feat(codex): allow historical forks while a turn is running (#2185)
* feat(codex): allow historical forks while a turn is running * fix(web): fork user-only completed turns during generation |
||
|
|
577ab7546b |
feat(sessions): add explicit per-session title locks (#2072)
* feat(sessions): add explicit per-session title locks * fix(sessions): preserve title locks across rename entry points |
||
|
|
ffd950a220 |
fix(codex): drop safe-yolo from Codex permission modes (#2183)
* fix(codex): drop safe-yolo from Codex permission modes Every Codex session runs on the native shared runtime (runCodex is runSharedCodex), which rejects safe-yolo. The mode stayed in CODEX_PERMISSION_MODES and six filters hid it again in the web picker, composer, hub permission-mode route, hapi set-mode and both native apps. API callers that validate against the flavor catalog (e.g. a spawn with permissionMode: 'safe-yolo') still passed it through and only failed inside the runner. Remove it from the Codex catalog (shared, iOS, Android, fixture) and delete the filters. autoReview is the native replacement. Safe Yolo stays for Gemini, Kimi and Copilot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ios): Codex option list now has four modes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2a612c5c72 |
perf(cli): reduce Windows process probes during session shutdown (#2046)
* fix(runner): prevent Windows process probes from blocking session lifecycle * perf(cli): reduce Windows process probes during session shutdown * test(cli): update PowerShell fixtures for complete process snapshots |
||
|
|
2b63091421 |
fix(runner): adopt untracked runner webhooks only from the reporting process generation (#1943)
* feat(cli): report the CLI process start marker in session metadata The session webhook only names hostPid. A PID alone does not tell the runner which process generation reported it: once the CLI exits, the OS can hand the same PID to any other process, including another runner-spawned CLI. Add metadata.hostStartMarker, the reporting process's own start marker (getProcessStartMarker(process.pid), the same probe the runner uses for its resume records and the stop-session generation check). buildSessionMetadata is the only place that sets hostPid, so every bootstrap path (fresh, existing, lazy, shared Codex) reports it. The runner uses it to decide whether an untracked runner webhook may be adopted (decideUntrackedRunnerWebhook). * fix(runner): adopt untracked runner webhooks only from the reporting process generation Since #1911 the runner adopts an untracked `startedBy: 'runner'` webhook (runner restart before the webhook; Claude has no HAPI id on argv) and persists getProcessStartMarker(pid) of whatever currently owns hostPid, so that a later stopSession can tree-kill that generation. If the webhook is late - the reporting CLI has exited and the OS has already reused its PID - the persisted marker belongs to a foreign process, possibly another runner-spawned CLI. The generation check in stopSession then passes and the foreign process tree is killed. The webhook now has to prove the generation itself: the CLI reports its own marker as metadata.hostStartMarker and decideUntrackedRunnerWebhook adopts only when it matches the live PID. A marker that names another generation, or a failed probe, is ignored without killing anything, also on the webhook-timeout path: a proven mismatch means the PID is not the ghost. A webhook without a marker (older CLI) is left untracked instead of adopted blindly; the timeout kill for those CLIs is unchanged. The integration test drives a real runner over its control server: a webhook carrying the live marker is adopted, listed and stoppable; a webhook with a stale or missing marker leaves the PID untracked and alive, and stop-session reports unknown. Follow-up to #1911 (#1910). * fix(cli): probe the process start marker only for runner-started sessions buildSessionMetadata probed getProcessStartMarker(process.pid) on every bootstrap, terminal starts included. The runner reads metadata.hostStartMarker only in the untracked `startedBy: 'runner'` path (decideUntrackedRunnerWebhook); a terminal webhook never consumes it, and neither do hub or web. The probe is a synchronous spawn: `ps` on POSIX, `tasklist` plus a PowerShell Get-CimInstance call on Windows, each with a 10 s timeout. A terminal `hapi` start on Windows therefore blocked on a PowerShell cold start before the session row existed, for a value nobody reads. With shared Codex the probe also ran per /new and /fork on the event loop shared by all sibling roots. Set hostStartMarker only when startedBy is 'runner'; that is the one case the runner evaluates. This narrows the earlier commit: every bootstrap path reports the marker for runner-started sessions, not for terminal ones. * fix(codex): keep hostStartMarker in the shared runtime's runner webhook The shared Codex runtime bootstraps its roots with reportStarted: false and reports them to the runner itself, from root.session.getMetadata(). That is the hub's view of the metadata: the hub parses stored metadata through MetadataSchema, so a hub that predates hostStartMarker strips the field and the webhook arrives without it. The hub's update-metadata merge never returns it either, so the loss lasts for the root's lifetime. With the generation check, an untracked runner-started webhook without a marker is ignored instead of adopted. A runner restart (for example the version handoff of a single-host upgrade, where the hub process keeps running the old code) followed by /new or /fork in a long-lived shared root therefore left the root unlisted and untracked, the very situation the adoption from #1911 addresses. The Claude and lazy bootstrap paths are unaffected: they report the local metadata. Take the marker from the local bootstrap metadata instead. The opt-in runtime integration test models the stripped hub view in its session mock and asserts the reported payload still carries the marker. The mock also gains the `on` subscription that SharedCodexRoot requires since #1911, without which the suite's bind test could not run. * test(runner): run the late-webhook suite in the serial integration project lateRunnerWebhook.integration.test.ts starts a real runner and a detached child process per case, but the default vitest project picked it up and `bun run test` ran it in a parallel worker. Tests that spawn runner process trees belong to the serial integration project (vitest.integration.config.ts, CI job `integration`), as the config comments and .github/workflows/test.yml require. Include the file in the integration project, exclude it from the default one, and remove the temporary HAPI_HOME of each case, which was left behind in the temp directory. --------- Co-authored-by: Benedict Groppe <195190800+BGGBTAC@users.noreply.github.com> |
||
|
|
0aec975434 |
fix(codex): gate history actions until native thread is ready (#1604)
* fix(codex): gate history actions until native thread is ready * fix(codex): clear history capabilities during bootstrap * style(codex): normalize CLI file line endings * fix(codex): await history capability persistence * fix(codex): restore goal status coverage * fix(codex): await bootstrap metadata persistence * chore: retrigger PR review * fix(codex): scope metadata readiness flush * fix(codex): gate metadata flush by stale history |
||
|
|
aed99e22cf | fix(codex): allow larger histories over shared WebSockets (#2171) | ||
|
|
c64051eba6 |
fix(codex): persist Round duration across session reloads (#2025)
* fix(codex): persist Round duration across session reloads * fix(codex): preserve completed plan summaries between turns * test(ios): make plan transcript recycling deterministic * fix(ios): preserve reading anchors with stale sizing attributes |
||
|
|
62872d80fa |
feat(cli): HAPI_DISABLE_PEER_TOOLS — hide peer-session tools from wrapped agents (#2052)
* feat(cli): add HAPI_DISABLE_PEER_TOOLS to hide peer-session tools from agents Wrapped agents with peer tools can browse the session list and message other sessions, polluting peer contexts on busy runners. Setting HAPI_DISABLE_PEER_TOOLS=1 (true/yes also accepted) in the runner environment now removes the peer surface entirely instead of advertising it and refusing: - the session MCP server does not register list_peers / inspect_peer / ping_peer, and they are dropped from the toolNames consumed by Claude --allowedTools and the codex/generic bridge --tools lists - the stdio bridge filters peer names even when a stale --tools value lists them explicitly - flavor system prompts (claude/codex/opencode) swap the peer steer block for a short notice that keeps the hub-path-is-not-a-file guard while pointing citations at the user - the peer core (pingPeer/inspectPeer/listPeerSessions) refuses with a new 'disabled' error code before any network call, so shell `hapi ping-peer` / `inspect-peer` from inside a wrapped agent fails loudly as defense in depth Operators scope the variable to the runner (systemd/launchd/guard env); an interactive terminal without it keeps full CLI access. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Code <noreply@anthropic.com> * test(cli): cover peer-tool prompt steer and default bridge tool list Adds regression tests for the two surfaces the kill switch mutates beyond the explicit --tools path: - happyMcpStdioBridge: default tool list (no --tools) keeps the peer tools as a positive control, then HAPI_DISABLE_PEER_TOOLS=1 filters them out of the same default seed. - New cross-flavor prompt test: the citation steer baked into the claude/codex/opencode prompt consts swaps to the disabled notice under the env flag and keeps the flavor-specific "Call \"<tool>\"" instruction by default (module consts evaluate env at import, so each mode is imported fresh via vi.resetModules + dynamic import). via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Code <noreply@anthropic.com> * test(cli): keep peer-tools env set through prompt assertions Keeps HAPI_DISABLE_PEER_TOOLS applied until after the assertions and restores it at test end. Some upstream shapes resolve the citation steer at call time (getSystemPrompt(env)) rather than baking it into the import-time const, so restoring the env inside the import helper made those shapes observe the enabled steer and fail. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: HAPI <noreply@hapi.run> Co-authored-by: Claude Code <noreply@anthropic.com> |
||
|
|
878ca2058c |
feat(codex): expose Approve for me as a permission mode (#2016) (#2090)
* feat(codex): expose Approve for me as a permission mode (#2016) Add autoReview to the Codex permission catalog. It keeps the workspace-write sandbox with on-request approvals and routes escalations to Codex's native reviewer (approvals_reviewer = "auto_review"), the same config as `hapi codex --approve-for-me`. It works at launch and mid-session via thread/settings/update; explicit modes now reset the reviewer to user, and sessions report autoReview from the native reviewer setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(native): expect Auto-review in the Codex permission lists (#2016) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(modes): label autoReview as Auto, matching Claude's auto mode (#2016) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cb2ff05c2a | fix(codex): distinguish compaction waits from unknown delivery (#2115) | ||
|
|
6f155313ff | fix(codex): keep status summaries out of intermediate messages (#2041) | ||
|
|
5847b034e5 | fix(codex): announce automatic context compaction when it starts (#1999) | ||
|
|
c3e33835c3 |
fix(cli): stamp and reap orphan HAPI MCP bridge helpers (#2004)
* fix(cli): stamp and reap orphan HAPI MCP bridge helpers MCP stdio bridges survive agent-root death (OOM / partial kills) and were invisible to #1911 argv orphan reap. Stamp --hapi-session-id on bridge spawn and match mcp --url helpers in orphanReap. Fixes #2003 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): use ApiSessionClient.sessionId for MCP bridge stamp bootstrapSession returns ApiSessionClient directly; session.client was a typecheck failure that broke CI typecheck:cli on #2004. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: retrigger Codex PR review after 503 infra failure Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
86c88df93b |
fix(runner,hub): cross-platform orphan reap on archive / tracking loss (#1911)
* fix(runner,hub): reap detached driver CLI on archive and tracking loss Archive always verifies via stopRunnerSession; runner stopSession scans argv orphans and awaits webhook-timeout tree-kill so PPID=1 children cannot accumulate after KillSession miss or map drop. Fixes #1910 Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): keep --hapi-session-id reap-only; test orphan kill path Claude/cursor swallow the stamp without bootstrap reuse, and reapRunnerSpawnedOrphans is unit-tested as the stopSession map-miss path. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): address #1911 CI and bot Majors Use Vitest in orphanReap tests, add Pi session.on mock, refuse archive when machine StopSession is unreachable, trust full tree-kill results, and argv-sweep orphans after every mapped stop. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): gate late-webhook kill on timeout orphans; fail closed on scan error Track webhook-timeout PIDs separately so recovered shared roots are not killed, and treat ps-list failures as still_alive rather than empty. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): keep shared Codex wrapper alive when archiving one root StopSession must detach a single shared root without tree-killing the wrapper PID while sibling roots remain, including after KillSession has already marked the runtime inactive. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): keep shared Codex siblings after restart tracking loss Before persisted-PID or argv orphan kills, consult the durable runtime registry for active sibling roots on the same wrapper PID so archiving one root after a runner restart cannot tree-kill live shared sessions. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub,cli): deliver hub-authored archive metadata to reconnecting CLIs When KillSession misses and archive is written via markSessionArchivedFromHub, emit Socket.IO update-session to the session room. On reconnect, ApiSessionClient reconciles GET /cli/sessions/:id metadata so hub-archived still fires. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): argv-scan orphans even when shared siblings remain Remove session-wide early returns that skipped orphan reaping whenever any shared wrapper had active siblings. Keep only the PID-specific filter so older untracked CLIs with the same HAPI id are still reaped. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): protect tracked shared wrappers when runtime registry is empty Argv orphan sweeps must exclude in-memory shared wrapper PIDs that still host sibling roots, not only durable registry siblings — otherwise a missing runtime record lets the sweep tree-kill the wrapper while archiving one root. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): adopt untracked nonshared CLIs after runner restart When a runner-spawned Claude webhook arrives with no TrackedSession (typical after restart mid-bootstrap), durably adopt the PID instead of ignoring it so StopSession can reap. Keep killing only nonshared timeout orphans; never kill shared Codex wrappers on late webhooks. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): keep recovered shared wrappers for registry siblings After restart adoption tracks only a newly reported Codex root, archiving it must consult the durable registry before tree-killing the wrapper PID so older active sibling roots survive. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): do not archive on KillSession ack when StopSession is unknown KillSession returns before cleanupAndExit finishes. When the runner cannot find the PID (unknown), wait for the session KillSession handler to drop before archiving; refuse if the CLI socket remains reachable. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub,cli): confirm KillSession pid via StopSession before archive KillSession now returns the CLI pid. When session-id StopSession is unknown, archive confirms that OS pid (without treating socket loss as exit) and still refuses when confirmation stays unknown or still_alive. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner,hub): tree-kill adopted CLIs and require PID start markers Adopted post-restart runner sessions now use killProcessTreeByPid when no ChildProcess handle exists. KillSession carries a process-start marker so raw PID confirmation cannot tree-kill a reused OS pid. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner,hub): verify adopted PID markers and hub-archive after stop Adopted sessions compare the persisted start marker before tree-kill and drop stale tracking on mismatch. After confirmed StopSession, hub-authors archive metadata when the CLI did not finish its flush. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): refuse unconfirmed shared/adopted stops Keep shared wrappers when siblings remain, but return unknown unless runtimeControl already ended the root. Adopted PIDs without a start marker no longer tree-kill by tracked PID alone. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): require inactive binding before sibling-kept archive Siblings alone must not flip StopSession to stopped on retry, while an acknowledged inactive Codex registry binding remains stop proof. Handle PID- markers before any tracked kill so reuse cannot nuke strangers. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): distinguish orphan reap from unknown keep-wrapper base Pass unknown into finishWithOrphanSweep so a successful argv reap stays stopped instead of being overwritten by an absent registry binding. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): honor orphan reap when adopted PID lacks a start marker finishWithOrphanSweep with an unknown base lets a successful argv kill report stopped instead of forcing unknown after the marker probe fails. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): confirm archive via metadata.hostPid tombstone When StopSession(sessionId) is unknown and KillSession supplies no confirmable pid+marker, probe PID-<metadata.hostPid>. already_gone allows archive; still_alive/unknown still refuse (#1911 Peer #1820). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): escalate Windows taskkill to /F like SIGTERM→SIGKILL Soft taskkill /T is refused on win32 console trees; orphanReap left orphans still_alive. waitForProcessToDie now force-escalates on both platforms so cross-platform reaping matches. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): widen process.kill mock signal to string | number Match @types/node process.kill(pid, signal?: string | number) so the Windows taskkill escalation mocks typecheck on tip 54f141368. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): tasklist liveness + immediate /F after soft taskkill refuse Windows orphan reap still failed in 5ms on Teemo: soft taskkill refused but escalate waited on an unreliable process.kill(0) probe. Prefer tasklist for win32 liveness and escalate to /F as soon as the PID is still live after soft kill. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): coerce win32 ps-list PIDs and escalate soft taskkill to /F String PIDs from ps-list made Number.isFinite fail so orphan kill returned still_alive without calling taskkill. Coerce PIDs, prefer tasklist liveness, and escalate soft taskkill to /F like SIGTERM→SIGKILL. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): Windows orphan scan via CIM CommandLine + taskkill /F escalate ps-list/fastlist is missing CommandLine and often missing from single-exe bundles, so Teemo orphan reap returned scan_failed (logged as live PIDs). List via Win32_Process CIM, coerce PIDs, escalate soft taskkill to /F. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): grace-wait after successful soft taskkill before /F Escalate immediately only when soft taskkill is refused. When soft succeeds but the PID is still draining, honor the existing grace period before force (Codex Major on #1911). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(runner): re-verify start marker before orphan argv tree-kill Capture getProcessStartMarker after the argv match list, re-check immediately before killTree, and skip on mismatch/null-while-alive so PID reuse cannot tree-kill an unrelated process on the orphan fallback. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): preallocate HAPI id before fresh machine spawn Fresh POST /machines/:id/spawn omitted existingSessionId, so argv never got a reap stamp. Preallocate the hub row (fork/clear pattern) and pass that id so a runner restart before the first webhook remains reapeable. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): close three post-prealloc unreapable paths Pass --hapi-session-id into Claude/cursor/kimi/copilot bootstrap so the preallocated hub row is used. Treat null marker re-check while alive as still_alive (not stopped). Keep the preallocated stub when spawn-fail StopSession cannot confirm the child is gone. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): adopt-stub via reservedSessionId, not existingSessionId `--hapi-session-id` binds a fresh create bootstrap to a hub-preallocated UUID (getOrCreateSession id) without taking the reopen path. Non-UUID stamps stay reap-only to match hub create schema. Restores integration spawn invariants broken by mapping hapi→existingSessionId. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): close Opus cold-read B1–B3 for #1911 B1: capture start markers from the same process snapshot as argv match (POSIX ps lstart / Win32 CreationDate); re-check before kill. Continue other orphans when one target is unconfirmed. B2: Windows killProcessTreeByPid verifies every collected descendant, not root-only — taskkill /T exit 0 is signalled, not gone. B3: runner sets childStarted:false on pre-exec rejection; hub deletes the preallocated stub without StopSession. Post-exec ambiguity still keeps the row until stop confirms. Terminal archives no longer refuse when no runner is connected. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): explicit adopt for hub-preallocated session stubs Fresh machine spawn preallocates with tag machine-spawn:<uuid>; CLI create with a different tag and the same id 409'd on identity conflict. Add adoptPreallocatedSession (hub-internal stub check) and POST /cli/sessions { adopt: true, id } so create binds the reserved row and overwrites tag/metadata without guessing the hub tag. Tests fail-first on the real prealloc→CLI create path. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): preserve snapshot markers + unify Windows CIM start markers Runner stopSession was still on findOrphans (PID-only), discarding same-snapshot markers and reopening the PID-reuse kill window. Switch both call sites to findTargets. Force UTC ISO 'o' CreationDate for list and single-PID probe so ConvertTo-Json cannot disagree with getProcessStartMarker on WinPS 5.1. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): exercise production orphan sweep wiring in tests Extract findStopSessionOrphanTargets as the stopSession discovery path both run.ts sweeps call. Add tests that drive that helper end-to-end (not an injected findOrphans seam), assert run.ts source wiring, and cover CIM-list ISO vs probe ISO agreement plus the broken WinPS shape mismatch. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub,cli): never delete live spawn on RPC timeout; release stub tags Ambiguous machine-spawn failures (timeout / unset childStarted) no longer call stopRunnerSession or deleteSession — that path killed healthy late boots and CASCADE-wiped transcripts. Pre-exec delete still requires a real machine-spawn stub (store tag check). Metadata updates release the stub tag so reopen flavors are not permanently adoptable; adopt refuses archived stubs. POSIX pgrep ENOENT fails closed instead of root-only verify. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): parseable Windows tree scan + fail closed on CIM failure Space-joined PowerShell for collectWindowsProcessTree was a WinPS parse error ($seen=@{} $bfs=@()), so every scan fell open to [root] and B2 false-stopped again. Join with newlines; return scan_failed on error/empty; killProcessTreeByPid refuses root-only verify. Assert on generated command text (Teemo-confirmed) so mocks cannot hide the next malformed script. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): reopen stamps existing-session-id; scan-fail signals root Opus Critical on #1911: runner always stamps --existing-session-id for known hub ids so Claude/Kimi/Copilot reopen does not hit adopt-stub 409. On pgrep/CIM tree-scan failure still signal the verified root but never claim stopped. Archive when both KillSession and machine RPC are missing. Empty Win process-list stdout and strict Codex registry reads fail closed. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): OK: sentinel for Windows tree scan; adopt CAS CIM failure under SilentlyContinue printed root-only with exit 0 — byte-identical to a healthy childless tree, so scan_failed never fired and killProcessTreeByPid false-stopped (#1911 Overseer B1). Require ErrorActionPreference=Stop, trap exit 1, and an OK: success sentinel; parse anything else as scan_failed. Same Stop/trap on the machine-wide list command. Execute the generated scripts under Docker pwsh in CI when the image is present. Treat pgrep status=null as scan_failed; coarsen Windows tasklist poll; wrap adoptPreallocatedSession in a transaction with stub-tag CAS. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): reservedSessionId for fresh prealloc; signal Win survivors Fresh machine-spawn stubs must not stamp --existing-session-id — that sends Codex down reopen without a thread binding (#1911 bot Major) and re-broke local HTTP non-UUID hints as reopen (round-4). Hub passes prealloc as reservedSessionId; buildCliArgs stamps --hapi-session-id for reserved/sessionId and --existing-session-id only for live reopen. Codex parses --hapi-session-id and adopts via bootstrapSession. Windows tree kill now taskkills surviving pre-scan PIDs after /T misses broken intermediate links. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): fail-loud Docker pwsh CI; scope Codex registry; stub leak CI skipped all four windowsProcessTree.pwsh tests on 48bb (image inspect without pull). Pull the image in test.yml and throw under CI when missing. Scope strict runtime-registry failure to Codex stop contexts so one bad JSON cannot block archive machine-wide. Stamp childStarted:false on machine RPC outside_workspace_roots. Add Codex reservedSessionId prealloc and runSharedCodex regression coverage for the #1911 Critical. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): single-use reservedSessionId; skip UUID HTTP hints Consume the machine-spawn reservation on first prepare() so a second Codex root/fork cannot re-adopt a consumed stub (409). Stop stamping UUID local-HTTP sessionId as --hapi-session-id (adopt hard-fail). Update stale hub spawn mocks for the reservedSessionId arity. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub): archive never-started machine-spawn stubs on unknown Ambiguous keep-stubs (startedBy=runner, no hostPid, still machine-spawn tagged) made StopSession return unknown forever while the runner was online, so archive threw permanently. Treat unknown + prealloc stub + no hostPid as already_gone. Also reject spawn success when the runner reports a different id than the preallocated stub. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub,cli): refuse dual-RPC-miss archive; generation-check Win survivors Both KillSession and StopSession missing is not proof a detached CLI exited — keep the row unconfirmed until the runner reconnects. Windows tree kill now re-checks process-start markers before individually signalling survivors so PID reuse is not killed. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): refuse archived reopen in bootstrapExistingSession Hub-archived rows could be resurrected when a late-booting child hit --existing-session-id: buildSessionMetadata stamped lifecycleState=running and updateMetadata overwrote the archive. Adopt already rejected archived stubs; reopen now matches. Intentional revive still goes through hub reopenSession first. Correct stub-hatch comment (no post-archive argv sweep). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub,cli): reject un-archive in updateSessionMetadata CAS Hub-side transactional guard (Discovery #1911 M1): refuse metadata writes that clear archived lifecycle unless allowUnarchive (reopen clear). Client stops infinite updateMetadata backoff when mismatch applies archived. Clear archive immediately before spawn so Pi/PTY attempt snapshots stay valid. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(hub,cli): success+preserve hub archive; M3 reservedSessionId split Replace version-mismatch refuse (livelock in CAS backoff) with success + merge-preserve of hub-archived fields unless allowUnarchive. Ack path routes through noteHubArchived so the CLI exits (criterion 6). Clear- before-spawn remains the authorized revive. Thread --hapi-session-id to reservedSessionId for shared-parser flavors (adopt≠reopen). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): fail-closed orphan ps signal; PID- registry; spawn timeouts Overseer B1: signalled ps (status null) is scan_failed, not empty table. B2: unreadable registry on PID-* stops returns null (no soft []). B3: 10s timeout on process/orphanReap spawn.sync. Narrow bootstrap archived belt to archivedBy=hub to match hub merge-preserve. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli,hub): hubArchived latch; PTY archiveSnapshot durability Criterion 6: noteHubArchived latches hubArchived so late registerKillSessionHandler registrations still EXIT (EventEmitter does not replay). Mirror Pi: persist archiveSnapshot on ptyResumeAttempt across clear-before-spawn and quarantine, restore on failed-resume cleanup (#1911 Discovery Majors). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): Codex hub-archived exit; AC6 latch test production order C2: SharedCodexRoot registers hub-archived (and latch check) beside its private KillSession — Codex never called registerKillSessionHandler. C1: keep latch+subscribe; test write-then-register order Discovery proved. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): type Codex hub-archived end mock for tsc vi.fn(async () => {}) inferred zero-arg calls; RootHost['end'] signature unblocks end.mock.calls[0][0] (TS2493). Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): catch hub-archived Codex host.end rejection void this.host.end() discarded archive-RPC failures as unhandled rejections; Codex has no unhandledRejection handler, so Node can exit the shared wrapper and kill sibling roots mid-turn. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
a259ad3144 |
fix(cli): change_title updates metadata.name for visible renames (#1896)
* fix(cli): change_title updates metadata.name for visible renames Agent change_title was writing metadata.summary only, so spawn --name sessions kept showing the old title. Route explicit renames through metadata.name (web rename semantics) across MCP, Codex, and Pi. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(web): voice context prefers metadata.name for session title Voice bootstrap/full formatters only read summary.text, so after change_title sets name the spoken context kept a stale title. Use the same name→summary precedence as getSessionTitle. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: polish title rename tests after cold review Rename the Codex root title test to match last-writer-wins behavior, and skip the voice full-context summary header when no title signal exists (avoid literal undefined). Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
93e9c5ac65 | fix: restore Codex titles and iOS collaboration controls | ||
|
|
0a9f15a9a7 | fix: align request_user_input other answers across clients | ||
|
|
917baf1201 | fix(codex): sync shared plan proposals and web actions | ||
|
|
d1f4972079 | fix(codex): restore shared sessions after heartbeat and archive | ||
|
|
18c454fb87 | fix(cli): remove Codex startup warning and banner | ||
|
|
d18c01b4b6 |
revert(codex): remove Luna Reserve fallback (#1780)
Revert
|
||
|
|
0c4abcb3d1 |
feat(codex): share sessions across terminal and web
Use one native app-server for terminal, Web and phone clients while retaining the existing CLI and Runner lifecycle. Synchronize native queues, permissions, question history and steering state; preserve explicit permission precedence and per-turn usage models. Resume inactive clear commands through Runner and reject independent child cold resumes. Add shared-runtime regression tests, generated protocol fixtures and lifecycle documentation. |
||
|
|
25af3f8e13 |
fix(cli): give Windows Codex MCP shim-spawn test a 20s budget (#1824)
Vitest's 5s default flakes under GHA Defender/cold-start on the only unit test that real-spawns on Windows (#1823). Keep the global unit default unchanged. Co-authored-by: Cursor <cursoragent@cursor.com> |
||
|
|
e2518b6fba |
fix(codex): emit ready notifications after local turn completion (#1802)
Co-authored-by: Alireza Ghassemi <ravenblackdusk@gmail.com> |
||
|
|
2b402d24d9 |
fix(web): show Codex round usage metadata (#1685)
* fix(web): show Codex round usage metadata * fix(web): skip imported Codex round duration |
||
|
|
8357da0a9d |
feat(codex): support backend-authorized Luna Reserve fallback (#1780)
* feat(codex): reconcile Luna Reserve fallback and conditional usage * fix(codex): preserve queued settings and reconcile Reserve sessions |
||
|
|
5c5c8b3a9f |
feat(codex): support user-configured MCP servers in remote sessions (#1789)
* feat(codex): load user MCP servers in HAPI sessions * feat(codex): proxy Windows MCP command shims * fix(codex): address MCP review feedback * fix(codex): use HAPI-owned MCP proxy * fix(codex): preserve Windows MCP argv boundaries * fix(codex): keep remote MCP placement unchanged |
||
|
|
97b1dd4c34 | fix(codex): preserve context config in remote sessions (#1633) | ||
|
|
aa0c1dc808 |
fix(codex): fail closed on ambiguous Web Rewind boundaries (#1707)
* fix(codex): fail closed on ambiguous Web Rewind boundaries * fix(codex): reject malformed native rewind history * fix(codex): reject duplicate rewind identifiers * feat(codex): offer Fork fallback for ambiguous rewind * fix(codex): gate rewind Fork fallback on exact native boundary * fix(codex): reject unresolved rewind boundaries safely * chore: trigger PR checks * fix(codex): gate safe rewind fallback on fork support * fix(codex): require complete user ids for rewind fallback |
||
|
|
f4553dd1ec |
fix(codex): ignore late app-server writes during disconnect (#1748)
* fix(codex): ignore late app-server writes during disconnect * fix(codex): scope app-server responses to their process --------- Co-authored-by: huxiang <huxiang@myai.tech> |