Commit Graph
2119 Commits
Author SHA1 Message Date
d0b0fde6cb feat(ios): jump notifications and session rows to the pending request
Complete the pending-request center's entry points:

- Push payloads already carry the request id for permission and input
  pushes; the notification tap now passes it through AppModel into the
  home screen instead of only the session id.
- Opening a session row whose summary still has pending requests lands on
  the first wait (async questions first, since they live in the collapsible
  bottom panel; approvals scroll to their tool row).
- ChatModel queues the jump until the detail's request dictionary arrives,
  so a cold notification start does not drop the target and a blocking
  target waits for the transcript to settle before scrolling.
- A focus token lets the split detail re-fire for the session that is
  already open.

Routing and pending-target presentation tests cover the new request id.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-12-01 06:47:01 +08:00
a2f7b30ddd feat(ios): add a pending-request center to chat
Port the web's pending-request affordances to the native chat:

- A collapsible "Awaiting your reply" panel above the composer collects
  non-blocking request_user_input questions, including ones outside the
  loaded transcript. It reuses the existing question form/draft machinery,
  so collapsing and scrolling never discard an answer.
- The composer status bar shows the pending count and kind. One request
  jumps directly; several open a native menu with each request's command
  or question.
- Async questions reveal and briefly highlight in the bottom panel.
  Blocking requests scroll the transcript to their correlated tool row and
  flash that row, using a new tokenized scroll target on
  AnchoredTranscriptList.

Adds pure pending-request presentation tests and Chinese strings.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-12-01 06:32:25 +08:00
fe66a74a16 fix(ios): let Debug builds install with the personal development team
The v0.36 passkey merge added the webcredentials:auth.hapi.run
associated-domain entitlement to the shared app entitlements. The
personal team's iOS Team Provisioning Profile does not include that
capability, so a direct Debug install to the phone failed with
"provisioning profile doesn't support Associated Domains".

Keep the capability in Release (and the macOS entitlements); Debug uses
Hapi-debug.entitlements without associated domains so automatic signing
can reuse the existing team profile. Passkey sign-in remains available
in Release builds.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-12-01 06:19:02 +08:00
fc2a76b0b4 fix(ios): restore the chat screen's own surface lifecycle
The inspector refactor removed ChatView's onAppear/onDisappear start-stop
pair but never added the corresponding retainSurface("chat") call. The
session pipe/window observer now starts and stops with the screen again,
so leaving a chat actually releases its SSE subscription and message
observers instead of relying on deallocation.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-12-01 06:08:10 +08:00
8f3bec07bf fix(ios): keep the session settings sheet stable while chat streams
ChatView rebuilt SessionConfigView (and a fresh SessionConfigModel) on
every streaming update because the popover content closure lived in the
toolbar body. That allocation churn made a long session feel laggy with
the sheet open, and replacing the sheet content reset its @State detent,
so scrolling up snapped the sheet back down and rescaled the chat
behind it.

- Own the SessionConfigModel and selected detent in ChatView so they
  survive body updates.
- Host the popover content once instead of rebuilding it per update.
- Make the sheet's scroll view own the gesture
  (presentationContentInteraction(.scrolls)) so reaching the top does
  not resize/collapse the sheet.

Verified: iOS simulator build; SessionConfigPresentationTests pass.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-12-01 06:00:18 +08:00
wushenghua f8a9c7eec1 fix(hub): align OpenCode model discovery RPC timeout to 120s
listOpencodeModelsForCwd/ForSession fell back to the 30s default RPC timeout, so a busy runner surfaced HTTP 500 'operation has timed out' while other model probes wait 120s. Pass MODEL_LIST_RPC_TIMEOUT_MS explicitly and cover both paths in rpcGateway tests.
2026-11-27 10:49:35 +08:00
wushenghua 476769df05 fix(ios): gate cached list during initial sync 2026-11-25 07:16:46 +08:00
wushenghua 8e220fb54f fix(ios): defer list and transcript churn 2026-11-25 05:56:34 +08:00
wushenghuaandCodex d9b66befe7 fix(ios): coalesce session list refreshes
Avoid notifying observers for identical REST snapshots, share in-flight refresh requests, and fold scheduled invalidations into one follow-up refresh.

Co-Authored-By: Codex <noreply@openai.com>
2026-11-25 00:57:07 +08:00
wushenghua 0021159ae3 fix(usage): read OpenCode v2 store and batch machine reports
The reconciler only read the legacy message table, so v2 sessions (session_v2/session_message) were invisible. Read both tables with v2 precedence and parse v2 assistant rows by type column and nested model ids. Split machine usage reports into 250-session batches to stay under the hub's 500-session cap. Add a standalone script to attach unattributed OpenCode sessions' token totals as synthetic reconciled usage.
2026-11-24 18:16:13 +08:00
wushenghua 7ac5bd3f02 chore: track fixes already present in the deployed 0.36.5 build
Hub session-list stats now use the combined getFutureScheduledMessageStats call; web icon sizing and machine-filter breakpoints corrected; iOS build version bumped; Windows host install docs added.
2026-11-24 18:16:04 +08:00
wushenghua 733fb35aed fix(dsh): don't pass reasoning-effort flag to DSH runner
DeepSeek Harness manages reasoning effort through its ACP server; the
dsh CLI rejects --model-reasoning-effort outright. Runner still passed it for
dsh sessions with a stored effort, so every reopen exited 1 with 'DeepSeek
Harness effort is configured by the ACP server'. Drop dsh from the flag's
agent list (codex/opencode unchanged) and add a regression test.
2026-11-23 18:17:40 +08:00
wushenghuaandClaude 5e4f91ddc9 fix: stabilize shared session guest auth
Cache the session-storage auth object so guest API consumers keep a stable client across renders and do not restart their sync effects.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-23 11:20:46 +08:00
wushenghua 5d54044f32 feat(ios): add goal control buttons to chat status panel 2026-11-22 20:57:24 +08:00
283e901d9d fix: repair post-merge hub routes and web feature regressions
Reviewing the v0.36.5 merge against the per-package suites (the root
script short-circuited at the known CLI disclaim failures) exposed
several real regressions:

- Restore the machine-level Claude/Codex model routes dropped from
  createMachinesRoutes; both returned 404.
- Route Codex imports through ListLocalSessions when the runner
  advertises it, keep the legacy RPC for older runners, avoid reading
  the hub's own CODEX_HOME when a runner is available, honor the
  200-session cap, apply model/effort through applySessionConfig, and
  roll back a session created by a failed first import.
- Repair usage_scan_state for fork databases: add the missing namespace
  column and keep the scan cursor independent of session deletion, as
  the durable usage ledger requires.
- Pin KaTeX to `trust: false`; an inherited Object.prototype.trust
  could emit javascript: links from user Markdown.
- Reintegrate upstream fork preview/rewind flow, branch conversation
  UI, system notes, pending-request navigation, PR header, search
  match-mode dropdown, and machine-scoped session dedup in the web app.
- Restore the global Skip action for ask-user questions, queued-message
  steer labels, image preview attributes, and settings-transfer key
  classification.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-20 14:36:21 +08:00
67c23cea1e fix(ios): restore post-merge build and test behavior
- Reattach @MainActor @Observable to TranscriptContent; the keyboard-dismiss
  merge inserted SimultaneousGestureDelegate between the attribute and the
  class, so transcript environment updates stopped invalidating.
- Disable code-block collapsing inside the tool inspector so its body lays
  out the complete command; the transcript keeps the height cap.
- Add setGroup to the session-list test stores for the new protocol
  requirement.
- Fix the session row status/spinner bindings and move ListIdentity to file
  scope after the session-list merge.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-20 13:58:49 +08:00
1473fa1dfa merge: hapi upstream v0.36.5
Adopt fork preview/boundary and branch endpoints, GitHub PR awareness,
session external refs, queue batch aliases and the attached runtime's
history validation. The fork keeps its Session List/Row/Chat surfaces,
Claude/DSH import dialogs, goal controls and DSH Web runtime.

Notable resolutions:
- Codex projection compares replay payload identity while still carrying the
  fork's Hub persistence options; queue committed() now uses upstream's batch
  alias matching
- user messages are ACKed per accepted batch member, with the fork's replay
  createdAt/verifyPersistence path retained
- server keeps the fork's public studio/share middleware and one gzip
  middleware; upstream's static cache headers and HEAD handling are adopted
- settings keeps the fork's session-summary/teams/unavailable-agents rows and
  adds GitHub PR awareness
- iOS keeps the personal bundle id and local string catalog (Japanese catalog
  from upstream is not merged)

Validation: typecheck passes; suite 5971 pass, failures limited to the four
machine-specific macOS responsibility probes.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-20 13:33:58 +08:00
81f0c0215c merge: hapi upstream v0.36.0
Adopt passkey login/management endpoints, attached Codex runtime gating and
the generic local-session RPC registry. The fork keeps its per-flavor Claude/
DSH/Pi/OpenCode import routes and dialogs, DSH Web runtime and custom Session
List/Row UI.

Resolutions worth knowing:
- schema is v36 with both passkey_credentials and the fork's studio/share
  tables; local stores remain alongside upstream PasskeyStore
- server mounts passkey login before auth and passkey management after, with
  the fork's guest/share middleware intact
- Codex root keeps local history sync/compaction and goal metadata while
  honoring host.attached: no bridge, read-only forks, attached refresh
- generic ListLocalSessions is registered in addition to the fork's per-flavor
  handlers; Claude transcript conversion accepts the fork's localId shape
- web keeps the local Claude/DSH import dialogs and manual upload path

Validation: typecheck passes; suite 5689 pass, failures limited to the
machine-specific macOS responsibility probes.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-20 13:26:16 +08:00
1638bb8577 merge: hapi upstream v0.35.1
Keep the fork's DSH Web runtime, OpenCode goal/native-variant paths and
media uploads; adopt upstream model-error notifications, OpenCode rewind
gating, chunked upload endpoints, hub settings split and the ACP shouldSend
guard.

Notable resolutions:
- ACP prompt keeps the local runPrompt request hook, now with upstream's
  shouldSend option, numTurns and boolean result
- OpenCode dequeue keeps local goal-aware thinking and native variants inside
  upstream's runtime gate / conversation-history flow
- web attachment adapter intentionally stays on the local 50 MiB single
  upload path; hub/client chunked endpoints remain available
- removed the upstream DSH ACP model-probe test because the fork uses the
  Web runtime catalog

Validation: typecheck passes; suite 5600 pass, 6 fail (five macOS
responsibility probes in disclaimExec.darwin are environment-specific; one
obsolete DSH probe test removed).

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-20 13:19:03 +08:00
ed517bfc1f merge: hapi upstream v0.35.0
Preserve the fork's teams, session groups, widgets/Live Activities, skins,
DSH steering and custom Claude models while adopting upstream session-attached
jobs, tri-state pin policy, presence badges, ACP prompt timing, agent quotas
and the usage parser version.

Resolutions worth knowing:
- schema ladder is now v35; local v31→v32 chat attachments and upstream's
  session-jobs step coexist, and v32→v33 installs jobs for existing fork DBs
- store keeps local Studio/live-activity/share/attachment stores alongside
  upstream SessionJobsStore and SessionRedirectStore
- DSH steering stays enabled through upstream's capability map
- iOS keeps personal bundle ids, grouped sections and widgets; upstream's
  presence badge, job line, sort order and Filter menu are integrated
- team tools and peer spawn remain, now gated by enabledTools

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-20 13:06:05 +08:00
b679d52c49 fix(ios): use a searchable lazy list for session model selection
A Menu with an inline Picker re-laid out hundreds of OpenCode models on
every config update, causing progressive scroll lag and a reset to the
top. Push a searchable List instead and snapshot the catalog on open.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-20 12:36:22 +08:00
wushenghua 2f7251fabf perf(ios): resolve group names once per session in snapshot grouping 2026-11-20 08:43:04 +08:00
wushenghua f37d0be015 fix(ios): present group picker as on-demand sheet instead of per-row menu 2026-11-20 08:37:18 +08:00
wushenghua 8f04363b87 fix(ios): cache group names to avoid O(n^2) row renders while scrolling 2026-11-20 08:25:21 +08:00
wushenghua 8d602beb7f fix(ios): anchor group picker to the tapped row via context submenu 2026-11-20 07:58:22 +08:00
wushenghua d7a59b8931 feat(sessions): pick existing groups instead of retyping 2026-11-20 00:51:57 +08:00
wushenghua 5aed5f298a fix(ios): use sessionStore.sessions for group bulk actions 2026-11-20 00:21:57 +08:00
wushenghua 6d333a4df5 feat(sessions): user-defined groups across web, iOS and Android 2026-11-20 00:08:01 +08:00
weishu 590a9533c9 Release version 0.36.5 2026-11-18 12:55:16 +08:00
weishu f40a472fa2 feat(web,ios,android): add native Japanese localization
Add ja locale to the web app (ja.ts, detection, language pickers, date
format), Android (values-ja, AppLanguage.JAPANESE, locales_config) and iOS
(ja in Localizable.xcstrings, AppLanguage.japanese, knownRegions).
2026-11-18 12:55:02 +08:00
weishu a21b3db02d feat(web): add native app promo for desktop and phone web
Nudge web users toward the paid App Store / Google Play apps, framed as
support for a fully open-source project whose web app stays free and
fully functional.

- Desktop: dismissible "Get the app" pill in the top-right of the session
  header / empty pane; popover with QR code, store links, and a pairing link.
- Phone: one-time bottom sheet on the session list, never on the first
  visit, with platform-matched store buttons.
- Settings > About: permanent store links.
- Dismissal holds for the release line (major.minor) so patch releases
  never re-prompt, plus a 14-day cooldown across minor releases.
2026-11-18 12:55:02 +08:00
weishu 6e9b7928a1 feat(website): redesign in HAPI style with prerendered, crawlable pages
- Replace the Manus SPA with Vite SSR prerendering: / (en), /zh/ (zh) and a
  real 404, hydrated on the client with the locale taken from the URL
- Per-locale head: canonical, hreflang, Open Graph, JSON-LD (Organization,
  WebSite, SoftwareApplication, FAQPage), and a 1200x630 og image
- Warm HAPI look: brand coral on warm white, system fonts, light/dark, mascots
  from the App Store creative and current native screenshots (WebP)
- Show the real agent logos used in the web app, put App Store / Google Play
  badges in the hero and move Docs to the header
- Drop the pricing note from the home page; add a FAQ on why native apps are
  paid and that their source is open
- Remove react-helmet-async, i18next, wouter, framer-motion and other unused
  dependencies; add @lobehub/icons for the agent logos
- Serve /zh, 404 and the legacy /?lng=zh redirect from the Express server
2026-11-18 12:55:02 +08:00
weishu 6d089f8b18 feat(website): refresh marketing site and add GEO support
- Drop the removed Gemini claim, the unrouted VsHappy page and Manus template
  leftovers (unused components and dependencies)
- Rework the home page around supported agents and current features
- Move SEO to hapi.run with static meta tags, JSON-LD and a crawlable
  no-JS fallback generated from the English locale
- Generate llms.txt, llms-full.txt and per-page Markdown during build:site
2026-11-18 12:55:02 +08:00
weishu 1470b0c1e8 docs: refresh guides for drift and add reference pages
- Fix stale claims: passkey sign-in in FAQ/quick start/privacy, Android
  scheduled send, Russian locale and Mac Catalyst, session list search and
  filters, Claude remote integration, relay recommendation, shipped branch API
- Add authentication, CLI reference, configuration, peer sessions,
  conversation history, composer, usage and quotas, and local import pages
- Add a per-agent feature support table and missing REST routes
- Complete settings.schema.json, add page descriptions and a docs sitemap,
  and stop publishing native developer notes
2026-11-18 12:55:02 +08:00
e55d29c056 feat(session): opt-in GitHub PR awareness + explicit attach (#1163)
* feat(session): structured externalRefs + list PR chip

Add optional metadata.externalRefs for durable session↔GitHub PR
identity and a clickable primary-PR chip on session list rows, plus
GET /api/sessions/:id/external-refs. Fixes titles-as-identity hacks
without title parsing (tiann/hapi#1160).

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

* fix(session): validate external PR URL identity

Prevent structured PR chips from linking outside the declared GitHub repository and pull request.

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

* fix(session): preserve externalRefs on merge + restore row focus group

Carry forward metadata.externalRefs when consolidating into a replacement
session row that omitted them (explicit new values still win). Move
group/session-row back onto the focusable list button so keyboard tooltips
reveal correctly (PR #1161 review).

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

* fix(session): carry forward externalRefs on bootstrap/metadata write

Preserve metadata.externalRefs when CLI pickExistingSessionMetadata and
hub updateSessionMetadata receive sparse replacements that omit the
field; explicit incoming refs (including []) still win. Closes the
resume/bootstrap data-loss path left after mergeSessions (PR #1161).

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

* feat(session): opt-in GitHub PR awareness and explicit attach

Add hub githubPrAwareness (default off), features API, PUT/CLI external-refs
write path, Settings toggle, link dialog, hapi link-pr, and MCP link_pr so
sessions can attach to PRs without title scraping. Depends on #1161 schema.

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

* feat(session): cache PR status on externalRefs for chip display

Extend GithubPrExternalRef with optional status/statusCheckedAt/statusAction
so Meta can write classifier health onto the attachment. Chip renders emoji
+ #N with status tone. Fixes link_pr tool-list expectations in MCP tests.

Part of tiann/hapi#1162 / #1163 (awareness + state in one PR).

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

* test(web): mock AppContext for General settings language test

SettingsGeneralPage now reads githubPrAwareness via useAppContext /
useFeatures; wrap the settings page suite with mocks so the language
inline test stops throwing AppContext is not available.

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

* fix(web): put PR chip left of session list time

Chip was a trailing sibling outside the row button, so rows with chips
shoved the relative-time column left. Keep time as the stable trailing
meta; optional chip sits immediately before it.

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

* fix(web): mute PR chip when statusCheckedAt is older than 2h

Cache honesty for Meta-filled externalRefs — never live-query GitHub from
the browser; stale chips show ? and a muted tone.

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

* fix(web): use relative ago in PR chip tooltip title

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

* test(web): keep companion baseUrl when mocking AppContext for features

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

* feat(session): forge-native PR chip snapshot + estate display profile

Replace Meta babysit status enums with GitHub-shaped openState/checks/merge
plus opaque estateCode. Chip terms (emoji, action prose) come from
$HAPI_HOME/pr-chip-display.json served on GET /api/features.

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

* fix(hub): use bun:test in prChipDisplay tests

Hub package typechecks include *.test.ts and has no vitest types;
CI failed resolving 'vitest' from the forge chip display suite.

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

* feat(web): compact PR chip to emoji; details on hover/long-press

Session list chips show status glyph only (estate emoji, or PR/?) so
multi-digit numbers stop crowding the row. Full repo#N + status copy
moves to HoverTooltip (desktop hover/focus) and touch long-press.

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

* fix(web): show PR detail in session action menu, not chip long-press

Keep desktop HoverTooltip on the compact emoji chip. Mobile long-press
stays on the session row; linked PR identity/status now tops that menu.

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

* fix(web): chip-specific hover tooltip + emoji in PR menu header

Keep HoverTooltip scoped to the PR chip (not row), unclip overflow, and
front the same status glyph in list long-press and session ⋯ menus.

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

* fix(cli): give claudeRemote first-result test a 15s CI timeout

Same flake as sibling cases under full-suite load; default 5s timed out
twice on #1163 after upstream merge.

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

* fix(cli): drop duplicate vitest timeout after merge

Upstream #1493 uses it(name, { timeout }, fn); the merge also kept the
legacy third-arg timeout, which Vitest 4 types reject.

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

* fix(hub,cli): address Codex Majors on PR awareness

Owner-gate PATCH /features, persist githubPrAwareness via updateSettings,
and fail MCP link_pr unless flushMetadata keeps the ref.

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

* fix(cli,web,shared): close remaining Codex findings on #1163

Gate MCP link_pr on hub awareness, upsert externalRefs, mark undated
chip snapshots stale, and hide the settings toggle from tenants.

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

* fix(hub,cli,web): CLI features probe + preserve secondary PR refs

Expose GET /cli/features and /cli/sessions/:id/external-refs for CLI
auth, upsert primary links in hapi link-pr and the web dialog, and tick
chip/menu staleness on a minute clock.

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

* fix(hub,cli,web): atomic external-ref upsert + create-session gate

Hub merges refs inside the metadata-version retry loop; CLI/web call
upsert/remove-primary instead of snapshot PUT. Strip externalRefs on
CLI create when awareness is off; list chips are display-only in the
row button.

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

* fix(shared,hub,cli): preserve PR health cache on same-identity upsert

Re-linking an already-linked github_pr was wiping openState/checks/merge
snapshots. Merge identity fields instead of replace-on-upsert.

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

* fix(shared,cli): case-insensitive PR identity + valid source fixtures

Treat owner/repo as case-insensitive on upsert/re-link so cached health is
not dropped, and keep regression fixtures within agent|user|inferred.

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

* fix(cli): initializeToken before hapi link-pr hub calls

Match ping-peer/inspect-peer so settings.json auth and apiUrl load
before getAuthToken/axios; keep --help free of prompts.

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

* fix(cli): omit link_pr from standalone hapi mcp defaults

Keep awareness opt-in: internal bridges still pass --tools after hub probe.

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

* test(cli): match default MCP tool registration order

list_peers registers after ping/inspect on the stdio bridge.

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

* fix(cli,shared): exact link_pr auto-approve + single primary refs

Stop substring/call-id matching for link_pr, and reject multi-primary
externalRefs at the Metadata/PUT schema boundary.

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

* fix(web): drop duplicate showSessionSummaryInChat in markdown-a test

Upstream merge left a duplicated mock field that broke tsc.

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

* fix(#1163): cap externalRefs count and disable env-pinned PR toggle

Bound externalRefs at 32 in schema + socket update-metadata ingress;
forward disabled on SettingsSwitch when HAPI_GITHUB_PR_AWARENESS pins the hub.

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

* fix(#1163): validate mutate externalRefs + hapi-scoped link_pr approval

Re-parse upsert transforms with ExternalRefsSchema before persist; only
auto-approve link_pr when MCP server provenance is hapi or the tool name is
a verified HAPI bridge identity.

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

* fix(#1163): trust HAPI link_pr provenance from envelope only

Auto-approve link_pr variants only when trustedHapiMcp is set from MCP
elicitation envelope serverName, not from tool arguments. ACP no longer
reads forged serverName from rawInput; HAPI mcp_tool_call approvals route
through the permission handler instead of blanket bridge auto-accept.

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

* fix(#1163): outer envelope only for trusted HAPI MCP provenance

Do not treat nested elicitation request.serverName as trusted identity;
poll features query so hub-global githubPrAwareness updates reach other tabs.

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

* fix(#1163): reject duplicate external ref identities in schema

Case-insensitive github_pr repo+number pairs cannot appear twice in
externalRefs; prevents upsert health merge depending on array order.

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

* fix(#1163): bound repo slugs, hoist PR polling, toggle errors

Cap GitHub repo slugs at 140 chars; share one features query and minute
clock across session list rows; surface githubPrAwareness toggle failures.

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

* fix(#1163): hub upsert link_pr + read-only untrusted gate

MCP link_pr uses atomic hub upsert (no metadata flush retry loop); block
untrusted link_pr auto-approve in read-only mode.

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

* fix(#1163): authoritative hub upsert + merge retry + 400 invalid refs

Stop replaying stale externalRefs through CLI metadata after hub upsert;
recompute merge metadata from the latest target row on version retry;
map ExternalRefsSchema failures to 400 on upsert routes.

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

* fix(#1163): fail merge before deleting source on metadata contention

Use METADATA_RETRY_ATTEMPTS for carry-forward metadata during session
merge; throw if externalRefs never commit so the source row is not deleted.

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

* fix(#1163): merge metadata before moving source-owned rows

Run carry-forward metadata merge before messages, scratchlist, and
attachments transfer so a failed merge leaves the source intact.

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

* fix(#1163): validate externalRefs on CLI session create

Share externalRefsInMetadataValid between socket and REST session
ingestion so malformed metadata.externalRefs returns 400 before persist.

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

* fix(#1163): reject non-boolean githubPrAwareness in settings.json

Match serverChanBackgroundOnly: Boolean("false") is true and would
silently enable the opt-in PR-awareness flag from a hand-edited file.

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

* fix(#1163): reveal nested PR chip tooltip on session-row focus

Non-interactive chips sit inside the row button as spans; wire
SESSION_ROW_TOOLTIP_FOCUS_CLASS so keyboard focus shows the tooltip.

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

* fix(#1163): keep raw metadata when linking PR on unparsed rows

mutateSessionExternalRefs reads the on-disk metadata blob instead of
cache-null fallback so link/unlink cannot wipe name/summary/worktree.

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

* fix(#1163): prefer merge conflicts over passing checks on PR chip

Candidate forge keys now rank conflicting/blocked merge ahead of
checks.pass/pending so the chip cannot look healthy when unmergeable.

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

* fix(#1163): localize PR chip detail strings for zh-CN

Map default forge labels and checked/stale/linked through i18n so tooltips
are not mixed-language; pass estate labels through unchanged.

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

* fix(#1163): prefer terminal PR openState over clean/pass chip

Merged/closed/draft snapshots must not show "ready to merge" when the last
poll still has clean+pass. Also localize aria-label status via the same
forge-label map as tooltips.

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

* fix(#1163): a11y label and i18n for Link PR invalid input

Give the PR field an aria-label and show localized invalid-input copy
instead of English parseGithubPrInput errors in the dialog.

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

* fix(#1163): gate PR awareness switch; expose nested chip to AT

Disable the settings toggle until features load so owners cannot flip a
placeholder off state. Nested session-row chips use sr-only detail so the
focused row announces PR identity and status.

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

* fix(#1163): refresh MCP link_pr catalog when awareness flips

Re-fetch hub githubPrAwareness for each new HTTP MCP session and invalidate
stale sessions so listTools picks up the toggle without restarting the
Happy server. Stdio --tools remains spawn-scoped.

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

* fix(#1163): gate link_pr at call time without killing MCP sessions

Keep link_pr in the HTTP and stdio catalogs under dynamic awareness, and
re-check the hub flag on each call. Avoids 404ing the stdio bridge session
when Settings toggles awareness mid-run.

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

* fix(#1163): hide MCP link_pr via enable/disable when awareness flips

Keep HTTP/stdio transports alive; toggle RegisteredTool visibility from hub
settings and sync the Codex stdio catalog without killing cached sessions.

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

* fix(#1163): avoid link_pr list_changed loops; poll idle HTTP clients

Only call RegisteredTool enable/disable on actual visibility transitions.
Add a bounded awareness poll so Claude HTTP MCP learns Settings flips
without a client request, and cover idempotent + poll-only transitions.

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

* feat(#1163): accept GHES hosts for GitHub PR external refs

Fold the upstreamable multi-host parser core into PR awareness: validate
github.com and *.ghe.com (plus configureGitHubHosts inject), preserve forge
host in parse/build/upsert, and relax schema URL matching accordingly.
Browser-safe — no operator YAML or Meta tooling in this change.

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

* fix(#1163): keep GHES host through attach + PR identity

Pass parsed.url from UI/CLI/MCP builders, and key identity/dedupe on
host+repo+number so github.com and Enterprise PRs with the same slug
do not collide or share cached health.

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

* fix(#1163): typecheck link-pr GHES attachment test

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

* fix(#1163): assert GHES link-pr body via toHaveBeenCalledWith

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

* fix(#1163): do not auto-approve link_pr in read-only mode

Trusted HAPI MCP provenance must not bypass read-only permission mode
when linking a PR; leave the write pending for user approval.

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

* fix(#1163): make list PR chip open its PR and show #N

Render the session-list chip as a sibling link beside the row button
(no nested interactive content) and include the PR number in the
compact glyph so operators can tell which PR is linked at a glance.

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

* fix(#1163): drop invalid host from SessionList PR chip test

SessionSummaryMetadata has no host field; CI typecheck failed on the
fixture metadata literal.

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

* fix(web): put session-row focus group on the row button

Restore group/session-row on the focusable button so attention and
schedule HoverTooltips still reveal under group-focus-visible.

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

* fix(#1163): align stdio default-tool test with peer/session_job catalog

Standalone MCP defaults now include spawn_peer and session_job; keep
asserting link_pr stays opt-in.

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

* fix(#1163): match merge metadata failure tests to preserve contract

SessionCache throws "Failed to preserve session metadata during merge"
after exhausted retries / store errors; update hub expectations.

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

* fix(#1163): prompt for Codex link_pr instead of native auto-approve

Native approval_mode approve bypassed BasePermissionHandler's read-only
guard; prompt so linking a PR still requires permission in read-only.

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

* fix(#1163): satisfy typecheck on link_pr approval regression

Avoid optional tools property access that failed cli tsc under strict
null checks.

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

* fix(#1163): align archive timeout assertion with 503 Cloudflare contract

Upstream #2423 maps ArchiveCleanupError timeout to 503 (not 504) so
Tunnel keeps JSON bodies; update the missed singleflight assertion.

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

* fix(#1163): memoize session-list PR clock between minute ticks

Avoid sampling Date.now() every render so memoized SessionItem rows
do not rerender on unrelated SSE updates when awareness is off.

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

* fix(#1163): preserve machine-spawn stub when attaching a PR

External-ref metadata writes used to clear the preallocation tag, so
adoptPreallocatedSession failed after an early link. Pass
preservePreallocation and cover stub → link → adopt.

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

* fix(#1163): size PR chip padding from quick-action span

Pinned active rows show Unpin + Archive; reserve the CSS action span
so the chip no longer overlaps Unpin and steals clicks.

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

* fix(#1163): align quick-unpin unread focus test with #2434 panels

session-group-unread-peek was removed when collapsed groups kept unread
rows in per-row CollapsiblePanels; update the #2443 focus assertion.

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

* fix(#1163): unblock passkey browser CI after shared-RP rematch

Playwright route.fulfill drops Location fragments on 3xx, so the
callback never received #state/#code and the opener hung. Apply the
fragment via a document navigation in the harness. Also reuse the
parsed complete form body instead of reading the request twice.

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

* Revert "fix(#1163): unblock passkey browser CI after shared-RP rematch"

This reverts commit 0092ea4b8c69add993fdd2f4b3da411eca641364.

* Revert "Revert "fix(#1163): unblock passkey browser CI after shared-RP rematch""

This reverts commit 1094372855204375a72101c07fa06f70a1aefdd7.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 12:53:26 +08:00
Junmo KimandGitHub e57df1822a feat: preview forks and rewinds with the boundary the fork will use (#2421)
* refactor(hub): resolve fork and rewind boundaries in one place

Move selectForkTranscriptPrefix into forkBoundary.ts as the single home
for fork and rewind boundary resolution. Fork execution keeps calling
the same function with identical behavior; the forkTranscript module
and its tests move with it, so the next boundary consumers (preview,
token validation) extend one resolver instead of forking the rules.

* feat(shared,hub): read-only fork preview with a boundary token

Add POST /sessions/:id/fork-preview: the hub resolves the preview mode
from the live session (a running Codex with a verified completed turn
previews through it), runs the same admission guards as confirm without
taking the history-action lock, and answers with the kept tail rows,
the excluded rows, counts, and a boundary token.

Confirm accepts the token back on fork and rewind. The public wrappers
re-check it right after the history-action lock: an epoch change, new
invoked rows, or a source that started running since the preview reject
with 409 boundary_moved so the caller re-previews instead of forking a
transcript it never saw. Clients that send no token keep the legacy
behavior, and a latestCompleted preview fails closed on runners that do
not advertise the forkPreview capability, because answering it from hub
rows is the drift this replaces.

* feat(cli): codex shared runtime answers and pins its fork boundary

Add the PreviewForkBoundary RPC: the shared runtime reads its native
history and answers where each fork mode cuts - latestCompleted through
latestCompletedForkCutoff, current through the last turn (falling back
to the completed cut once a turn runs), message through the projected
turn with the steered-cut clientId rule - and names the first excluded
hub row so the hub cuts its preview tail at the same place.

Confirm accepts a preview-pinned lastTurnId: the runtime re-verifies the
turn still exists with a completed native prefix and forks through that
fixed inclusive cutoff instead of re-deriving a moving one, so a turn
that starts between preview and confirm cannot drift the boundary. The
capability is advertised as conversationHistory.forkPreview.

* feat(web): fork preview dialog fed by the hub

Replace the web-side fork boundary mirror with the hub's preview
answer: useForkFlow asks POST /sessions/:id/fork-preview, renders the
returned kept tail and excluded boundary through the regular
normalize/reduce pipeline, and confirms by echoing the boundary token.
A 409 boundary_moved refreshes the preview in place and demands a
re-confirmation, a source that starts running while the dialog is open
re-answers through the hub, and an older hub (404) falls back to the
legacy confirm dialog. forkPreview.ts keeps only the compact text
shaping; its cut rules are gone. SessionChat and SessionList share the
flow, the MessageActions fork button invokes it directly under the
message-fork testid, and the dialog's confirm stays accessible as
Fork. en and zh-CN locales and the e2e fixture/spec come along.

* feat(web): rewind preview dialog

Route rewind through the same hub-fed preview: the MessageActions
rewind button opens the rewind variant of the fork preview dialog,
which emphasizes the region the source would delete (destructive
styling, struck-through rows, and a truncation count) before confirming
with the boundary token. The runner-side fork-safe ambiguity still
offers the fork-at-boundary fallback, an older hub falls back to the
legacy rewind confirm, and the inline rewind confirmation dialog is
removed now that the preview gates the destructive action.

* test(hub): align archive cleanup timeout status with the 503 semantics

* fix(hub): reject the fork preview when the transcript moves during the boundary call

* fix(web): surface fork preview failures in the chat with a connect-error retry

* test(e2e): pin the list fork menu and opencode affordances to the preview flow

* fix(cli): make shared Codex fork previews respect forkable boundaries

The message-mode preview answered boundaries the confirm would refuse: a
historical cut whose completed-turn prefix contains an unfinished turn
only failed after the user confirmed. PreviewForkBoundary now applies
ForkConversation's terminal-status rule on the assertBoundary snapshot it
already fetched, so both sides inspect one history state.

The latestCompleted preview could also name an empty-text userMessage as
the cut row, but the projection never emits a hub row for those, so the
hub resolved a boundary that does not exist and failed with 'Fork
boundary message not found'. firstExcludedUserLocalId now skips items
without hub-visible display text, sharing the projection's rule through
userMessageDisplayText.

* fix(hub): gate the fork preview on the archived-fork admission rules

The inactive-session preview branch answered a boundary without any of
the guards the confirm enforces in forkArchivedCodexSession: an archived
Claude or OpenCode session, a diverged history, queued messages, or an
offline Runner all rendered a preview dialog that could only fail on
confirm. The admission guards now live in assertArchivedForkEligible and
run in both paths.

A latestCompleted token is only minted for a running source, so a runner
exit before the confirm used to fail with the unactionable 'No verified
completed turn' answer instead of refreshing; boundaryMovedReason now
returns boundary_moved when the source went inactive, and the client
re-previews under the archived rules.

* fix(web): replace a stale fork preview with the error dialog and honor the thinking edge

A preview refresh that failed with a non-404 error left the previous
ForkPreviewDialog mounted, so the error dialog — gated on
errorMessage && !preview — never appeared and the stale boundary token
stayed confirmable. The non-404 catch now drops the stale preview first.

The thinking-edge effect also consumed an edge that landed while the
first preview request was still in flight: neither the state nor the
legacy request existed yet, so the stale idle-time answer opened the
dialog after the turn had already started. The in-flight request intent
is now tracked in a ref the effect can re-issue from, and an edge during
a confirm RPC no longer mutates the dialog behind the mutation.

* fix(web): keep the legacy fork confirm locked while the RPC is in flight

confirmLegacy awaited the fork/rewind RPC without any pending flag, and
all three legacy confirm dialogs bind isPending to the preview-loading
state, so the confirm button never showed its confirming label and both
buttons stayed enabled: a double click submitted the fork twice and the
dialog could be dismissed mid-request. A dedicated confirming state now
covers the legacy RPC in useForkFlow and drives the three dialogs.

* fix(web): align the fork error dialogs between the chat and the list

SessionList's error dialog ignored the retry affordance the chat already
had: connect-level preview failures showed only Dismiss with the buttons
unbound to any pending state. Both components now share the same dialog
contract: Retry for connect failures, Dismiss otherwise, one action and
no duplicate Cancel, and the pending state bound to the retry fetch.

The chat's error dialog also introduced every failure as a fork even
when the failed request came from openRewind; useForkFlow now records
the failing intent and the dialog titles itself accordingly. Finally,
HappyThread's historyActionPending was hardcoded false after the preview
flow replaced the direct fork callbacks, so per-message Fork/Rewind
buttons stayed enabled while a preview request was in flight and another
click would supersede it via requestSeq; the loading state now locks them
like the pre-preview flow locked them during its RPCs.

* fix(web): clean up the fork preview dialog's confirm error and rewind footer

A failed confirm quoted the raw ApiError message ('HTTP 409 Conflict:
{...}') inside the dialog while the rest of the flow extracts the hub's
error text; the dialog now shares useForkFlow's apiErrorText. The error
also survived a background view refresh, quoting a stale boundary under
the refreshed one, and a rewind whose excluded rows were all non-text
hid the deletion summary because the section was gated on excludedTurns
being non-empty even though counts.excluded was not zero.

* fix(hub): reject the fork preview when the CLI answers a resolved error envelope

RpcHandlerManager serializes a thrown handler error as a RESOLVED
{error} envelope, so previewForkBoundary's cast answered the preview
with undefined nativeTurnId/cutBeforeLocalId and the runtime failure
was silently swallowed. Unwrap the envelope and throw so the hub
surfaces the failure like any other preview error.

* fix(web): honor the flattened summary capability on the legacy fork fallback

SessionSummary flattens conversationHistory onto metadata while the
full hub Session nests it under metadata.capabilities; the legacy
confirm only read the nested shape, so a 404 fallback from the list
sent a plain current fork for a running session that supports the
latest-completed fork. Accept both shapes.

* fix(web): offer the fork fallback when the legacy rewind is fork-safe

The legacy rewind confirm dropped the ambiguous-native-boundary fork
fallback that the preview confirm and the pre-preview dialog had: a
409 ambiguous_native_boundary_fork_safe surfaced as a dialog error
instead of offering fork-at-boundary. Mirror the preview confirm's
handling on the legacy path.

* fix(hub): catch source active transitions between fork preview and confirm

The boundary token did not record the source's active state, so a
transition between preview and confirm bypassed boundary_moved: a
stopped runner sent the confirm into the archived-fork path (uncoded
admission failure for non-Codex sources, or an archived fork that
silently ignores the previewed live cut), and a reopened session ran
the live fork with a token minted on the archived path. The rewind and
non-Codex message confirms also failed as uncoded 'Session must be
active' / 'Session is busy' on thinking edges.

ForkBoundary now carries sourceActive and boundaryMovedReason rejects
the mismatch across all modes; the rewind and live non-Codex message
cases also reject a thinking edge. latestCompleted keeps its existing
runner-exit guard for tokens minted before this field existed.

* fix(web): keep the preview confirm locked against thinking edges mid-confirm

confirmLegacy set confirmingRef but confirmPreview did not, so a
thinking edge landing while the confirm RPC was in flight re-answered
the preview behind the confirm: the dialog's view was replaced (or
unmounted into the error dialog) under a pending confirm, and the
confirm then navigated over it or threw against a dead dialog. Lock
the confirm the same way the legacy path does, and release it before
the boundary_moved re-preview so the refresh behaves like any other
in-flight preview.

* fix(web): mark the fork boundary on a current preview that excludes a running turn

A shared Codex runtime answers mode 'current' with the last completed
turn while a turn is already running in the CLI (before the hub saw
thinking), so the preview carries an excluded running turn and confirm
pins lastTurnId. The dialog gated the fork-point marker and boundary
box on kind !== 'current' and showed the full-copy footer, hiding the
cut the confirm would apply. Show the boundary section whenever the
preview carries a cut and use the latest-completed footer for a current
preview with exclusions.

* fix(hub): refuse the fork preview when the confirm's pending-fork guards would

forkConversation rejects a confirm outright while a Codex resume is
unconfirmed or an archived-fork child binding is pending on an active
source, but forkPreview ran neither check and opened a dialog whose
confirm always failed. The archived message preview also answered
without the conversationHistoryTurns entry (or pending attempt) that
forkArchivedCodexSession resolves the native turn from. Mirror all
three guards on the fork preview paths; rewind keeps its own, since
the rewind confirm runs different guards.

* fix(cli): answer the idle fork preview with a pin the confirm would accept

The idle current-mode preview pinned the last native turn without
checking its terminal prefix, so a thread holding a non-terminal turn
previewed a 200 whose confirm always failed verifyPinnedTurn with 'The
pinned fork turn no longer has a completed native history prefix'.
Validate the pin before answering and omit it when invalid: preview and
confirm then agree on the unpinned whole-history cut. Message mode also
fetched the thread twice per preview (once up front, once inside
assertBoundary); the up-front read now lives only in the branches that
need it.

* test(hub): pin the rewind route's coded 409 boundary_moved contract

The rewind route tests never sent a boundary token, so the claim that
the route maps a moved rewind boundary to a coded 409 had no coverage.
Mirror the fork route test: the boundary reaches the engine and the
structured code is returned on a 409.

* fix(hub): let a boundary-token rewind confirm reach the engine when the source went inactive

The rewind route answered 409 session_inactive before the engine ran
whenever the source had stopped, so the confirm's sourceActive
re-check was unreachable over HTTP and a confirm after the runner
exited dead-ended instead of refreshing the preview. Every rewind
token is minted on an active source, so an inactive confirm is always
a moved boundary: parse the body first and skip requireActive only
when a token is present, mirroring the fork route. Token-less legacy
rewinds keep the session_inactive 409.

* fix(web): keep the fork preview confirm locked while a refresh replaces the view

A boundary_moved refresh leaves the previous preview mounted until the
fresh answer lands, and the confirm's await only covers the refresh it
started: when a thinking edge fires a second re-preview behind that
refresh, the dialog's local pending resets and Confirm becomes
clickable on a view that is about to be replaced, re-sending the stale
boundary for another refresh. Gate Confirm on the flow's loading state
alongside the pending flag, in both the chat and the list dialogs;
Cancel stays available since closing discards the in-flight refresh.

* fix(web): refuse legacy fork dialog dismissal while the confirm RPC is pending

The legacy confirm dialogs lost the old handlers' pending guard when
they moved onto ConfirmDialog: its Cancel button honors isPending, but
Escape and the dialog's close button reach onClose unconditionally, so
dismissing mid-RPC unmounted the flow while the fork or rewind kept
running, and a later failure had nowhere to surface. Guard the legacy
fork and rewind dismissals with !confirming in the list and the chat;
the preview-route dialog already guards dismissal through its own
pending state.

* fix(hub): refuse archived-fork preview for attached runtimes

* fix(codex): name the original hub message when a fork cut starts at a queued batch
2026-11-18 10:12:23 +08:00
a9e4d445cc feat(hub,web,cli): work-scoped liveness — derive in-progress tool work so autonomous rounds stop rendering as waiting (#2470)
* feat(hub,web,cli): work-scoped liveness — derive in-progress tool work so autonomous rounds stop rendering as waiting

thinking is round-scoped, not work-scoped: a session running an
autonomous loop between turns reports thinking=false while its tool
calls are still open, so the client renders "waiting" for hours. The
hub now sweeps open tool-call rows (getLiveToolWork) and marks the
session with derivedToolWork while any live call exists; the web
session list and status row render it as working. Stale
backgroundTaskCount values are cleared by the same sweep, and the
claude backend re-bumps thinking on autonomous-round assistant frames.

Ported from the fork line; the queued-thinking-grace refinement is
dropped here because that feature does not exist upstream.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* test(web): assert the ticker-era presence badge class, not animate-pulse

The low-rate ticker refactor (#2447) removed animate-pulse from the
presence badge; the derived-work test still expected it. data-presence
plus the badge background class is the visible contract now.

Co-Authored-By: Claude Code <noreply@anthropic.com>

---------

Co-authored-by: miuiadmin <miuiadmin@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
2026-11-18 08:12:48 +08:00
24153c3d37 feat(web): show a fetching-latest pill during cached session re-entry (#2474)
* feat(web): show a fetching-latest pill during cached session re-entry

Re-entering a session whose message window is served from the
sessionStorage cache renders the stale rows first, then swaps in the
authoritative latest page once the background tail sync lands — with no
affordance in between (the skeleton only covers empty windows and the
older-messages pill is suppressed while isSyncingTail is true).

Expose the store's internal preferLatestOnActivation flag through
MessageWindowState / useMessages (isCatchingUpFromCache) and render a
top-center "Fetching latest messages…" pill over the stale rows while
the catch-up fetch is in flight. The flag is true only between cached
activation and the first tail-sync landing, so visibility tickers and
reconnect resyncs never flash it.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>

* fix(test): restore dropped describe closers lost in the port splice

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>

* test: harden v29.36 gap-audit edges (pill failure path, deliver-now guards)

- message-window-store: cover the cached re-entry failure path — a
  rejected tail sync settles (no endless syncing state), surfaces a
  warning, and deliberately retains preferLatestOnActivation so the
  retry still prefers the authoritative latest page; a successful retry
  then closes the catch-up window.
- messageService.deliverQueuedMessageNow: cover the four previously
  untested guards — CLI in-flight dispatch, cancel-ack timeout, shared
  concurrent-client sessions, and indeterminate rows (owned by the
  retry affordance). All leave the row unchanged and never emit.

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>
2026-11-18 08:12:01 +08:00
84d08dfc05 fix(runner): avoid blocking Windows heartbeat on process probes (#2472)
Co-authored-by: 3ndetz <30196290+3ndetz@users.noreply.github.com>
2026-11-18 08:11:08 +08:00
OverbakerandGitHub 1690f315fc fix(web,hub): compress web static assets and survive transient auth outages (#2473)
* fix(web,hub): compress web static assets and survive transient auth outages

* fix(web): isolate stale auth epochs and throttle SSE-closed retries
2026-11-18 08:10:48 +08:00
OverbakerandGitHub cde0b355d8 perf(cli,hub): compress large /cli payloads and coalesce keep-alive heartbeats (#2477)
* perf(hub): enable gzip compression for large /cli HTTP payloads

* perf(cli): extract zero-side-effect keepAlive module and bump interval to 10s

* perf(cli): share SESSION_KEEP_ALIVE_INTERVAL_MS across agent loops
2026-11-18 08:10:24 +08:00
OverbakerandGitHub 7210399d1f perf(web): cap retained inactive windows with reload-safe storage pruning (#2479)
* perf(web): throttle message window persistence and cap retained inactive windows

* test(web): cover inactive message window LRU eviction and reload protection

* fix(web): preserve sync generations across eviction and skip storage parse under limit
2026-11-18 08:09:36 +08:00
OverbakerandGitHub 351e6e53e9 perf(hub): optimize SSE broadcast fan-out, gzip event streams, and SQLite live tail (#2480)
* perf(hub): deduplicate SSE serialization, compress event streams, and coalesce activity

* perf(hub): use cursor pagination in hasConversationContent and skip FTS on live reasoning

* perf(hub): add self-validating O(1) live tail index for streaming tool calls and reasoning

* fix(hub): replenish live tail lookback window after snapshot deletion
2026-11-18 08:09:08 +08:00
f6d7238607 fix(shared): hide and report near-miss AGENT_NOTIFY_SUMMARY footers (#2481)
* fix(shared): hide and report near-miss AGENT_NOTIFY_SUMMARY footers

A turn whose final line attempts the machine footer but does not parse -
most often truncated before the closing brace - fails twice over: the
status is dropped, and because the strict matcher found nothing to strip,
the raw `AGENT_NOTIFY_SUMMARY {...` line is rendered to the reader. The
second half contradicts the product intent `e2e/notify-summary.spec.ts`
already asserts, and the first half is silent: `extractNotifySummary`
returns null with no log, so the only detector is a human noticing.

Introduce the near-miss notion: the last non-empty line is positionally
eligible to be a footer (the existing glued/indented rules, unchanged) but
yields no summary. On that condition:

- `stripNotifySummaryFooter` removes it, keeping any glued prose prefix
  exactly as it does for a valid footer. The machine line is addressed to
  the harness, not the reader, and a truncated one is no more readable
  than a valid one. `NotifySummaryText` now falls back to the stripped
  body instead of re-rendering raw text when there is no summary to show.
- `detectNotifySummaryNearMiss` classifies why it failed - unterminated
  JSON, trailing content, invalid JSON, not an object - and the work-graph
  ingest logs one warn naming the reason, so a broken emitter is greppable
  instead of invisible. Mid-stream snapshots are excluded: a footer still
  being written is incomplete by construction, not malformed. The log
  carries the payload *length*, not the payload, to keep agent output out
  of hub logs.

What is accepted as a *valid* footer is unchanged, and so is what is left
alone: whitespace-delimited prose mentions (`Example: AGENT_NOTIFY_SUMMARY
{...`), mid-body quotes, non-final footers, and a bare token with no
payload all still render as written.

Deliberately not included: repairing a truncated payload by appending the
missing brace. Truncation cuts content, not only syntax, so a repaired
footer would write a silently shortened summary into the append-only
work-graph ledger as though the agent had meant it. The near-miss reason
makes repair a small follow-up if a maintainer wants it.

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

Co-Authored-By: HAPI <noreply@hapi.run>

* fix(shared): keep quoted footer examples out of near-miss matching

Review catch: the near-miss path inherited the strict matcher's "glued"
eligibility, which treats any non-whitespace character before the token as
glue - including a backtick or quote. A final line such as

    Use `AGENT_NOTIFY_SUMMARY {"status":"done"}` at the end.

therefore matched, the closing backtick read as trailing content, and
stripping left only `Use ` + the opening backtick, deleting the example and
the explanation after it. The Codex commentary path strips before storage
rather than before display, so that text was lost, not merely hidden.

Near-miss matching now skips occurrences inside an inline-code span and
occurrences immediately preceded by a quoting or opening delimiter. The
strict matcher is deliberately left as it was: a payload that parses as an
object through end of line is its own evidence that the line is a real
footer, so a backtick-glued valid footer is almost certainly an agent that
forgot the newline. A near miss has no such evidence, so it has to be more
conservative about what it will delete.

Genuine glued footers are unaffected, including after an earlier inline-code
span on the same line (``Ran `bun test`.AGENT_NOTIFY_SUMMARY {...``), which
is covered by its own regression test alongside the preserved examples.

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

Co-Authored-By: HAPI <noreply@hapi.run>

* fix(shared): treat near-miss quoting as a span, not one character

Second review catch, same class as the first: the guard added in 3fbda1e7e
inspected the single character before the token, but quoting is a property
of the *span*. A final line such as

    The agent wrote "Done.AGENT_NOTIFY_SUMMARY {"status":"done"}" verbatim.

has ordinary prose punctuation immediately before the token, and the
backtick-parity check only counted backticks, so a double-quoted span read
as unquoted. The line was stripped to `The agent wrote "Done.`, and the same
variant existed for every quote style the local check did not enumerate -
`('Done.AGENT_NOTIFY_SUMMARY {...}')` among them.

Replace both checks with one span test: is the token inside an open quoting
or code span on this line? Symmetric delimiters (backtick, double quote,
single quote) are counted by parity, so a *closed* pair earlier on the line
(`He said "hello".AGENT_NOTIFY_SUMMARY {...`) does not grant immunity;
bracketing delimiters are counted by depth. An apostrophe inside a word is
not treated as a quote, or `didn't` would hide a real footer.

Angle brackets are deliberately absent: `a < b` is far more common in agent
prose than an angle-bracketed footer example, and treating `<` as an opener
would hide real footers. That narrows the previous commit's delimiter set by
one character, by choice.

The strict matcher remains untouched, for the same reason as before: a
payload that parses as an object through end of line is its own evidence of
a real footer.

Regression coverage for the quoted-glue variants, plus three over-correction
guards that pass on both sides of the change - a closed inline-code span, a
closed quote or bracket pair, and an in-word apostrophe must all still strip
a genuine glued footer. The Codex commentary path gets the same cases, since
that path strips before storage rather than before display.

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

Co-Authored-By: HAPI <noreply@hapi.run>

* fix(shared): strip a near miss only when its payload runs to end of line

Three review rounds found three quoting constructs the near-miss guard did
not know about - a single-backtick span, a double-quoted span with glued
prose inside it, a double-backtick run - and each fix enumerated one more
piece of syntax. That was not converging, and the reason is visible in the
classifier: *every* reported false positive is `trailing-content`.

    The agent wrote "Done.AGENT_NOTIFY_SUMMARY {…}" verbatim.   → trailing-content
    ('Done.AGENT_NOTIFY_SUMMARY {…}')                           → trailing-content
    Use `AGENT_NOTIFY_SUMMARY {…}` at the end.                  → trailing-content
    Use ``Done.AGENT_NOTIFY_SUMMARY {…}`` at the end.           → trailing-content
    See [Done.AGENT_NOTIFY_SUMMARY {…}] above.                  → trailing-content

while every shape this feature exists to catch is not:

    …,"summary":"ok     → unterminated-json      {bogus}    → invalid-json
    {"ver               → unterminated-json      not-json   → not-an-object

So stop enumerating quoting syntax and gate on the payload region instead:
strip a near miss only when it runs to the end of the line. Truncation
terminates the line by definition, so it always qualifies; a quoted example
always closes its delimiter *after* the payload, so it never does. One rule
replaces the whole guard - no quote characters, no backtick runs, no in-word
apostrophe case - and `shared/src/messages.ts` is ~40 lines shorter for it.

`trailing-content` stays classified and logged, so a genuinely stray-text
emitter is still greppable; it simply is not deleted. The cost is one odd
line on screen when an emitter really does append text after a complete
object - and the status was dropped for that shape anyway, since the strict
matcher rejects it too, so the change is purely cosmetic. The alternative is
deleting a reader's example and the prose around it, which the Codex
commentary path does before storage rather than before display. Showing a
strange line beats destroying text.

Every preservation test from the previous two rounds still passes, now for
this one reason rather than per-syntax guards, and the Codex commentary
suite keeps the quoted and double-backtick cases the review asked for.

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

Co-Authored-By: HAPI <noreply@hapi.run>

* fix(shared): only delete a near miss when no prose shares its line

Two review points, both about not destroying text.

**The log wording was wrong for the one reason that is no longer stripped.**
`[work-graph] ignored a malformed AGENT_NOTIFY_SUMMARY footer` is untrue of a
`trailing-content` line: a quoted example is correct prose, and it is kept and
shown rather than ignored. Someone grepping that string for lost statuses
would read an example as a dropped one. The message is now
`no AGENT_NOTIFY_SUMMARY status recorded from the final line`, which holds for
every reason, and `removedFromDisplay` carries which of the two outcomes
happened. The reason is still logged - an emitter that appends stray text
after a complete object is genuine signal, and suppressing it to quieten the
noise would trade the wrong way.

**A quoted example of an *incomplete* payload was still being deleted.**
``Use `AGENT_NOTIFY_SUMMARY {"summary":` to reproduce.`` classifies as
`unterminated-json`, so the end-of-line rule could not protect it: an
unterminated payload has no object end to measure against. This was a known
residual of that rule and should have been on the record when it landed.

The fix is a second structural condition rather than a return to parsing
quote syntax: **the token must own the line.** Nothing but whitespace may
precede it. That covers every quoting construct at once, including the ones
earlier rounds enumerated and the ones nobody has thought of, because what it
tests is the presence of prose rather than the shape of quotes.

A *valid* footer still tolerates glued prose - a payload that parses as an
object through end of line is its own evidence that the line is a real footer.
A near miss has no evidence, so it must be sure the line is machine output
before deleting it.

The cost, stated plainly: a truncated footer glued to prose on the same line
now stays visible. That is a real sub-case of the defect this PR fixes, and it
is given up deliberately. The status is lost either way - the strict matcher
rejects that shape too - so the cost is one odd line on screen, against the
risk of deleting a reader's example and the prose around it, which the Codex
commentary path does before storage rather than before display.

The four syntax guards from the previous rounds are replaced by this one rule
and their tests collapse into it, alongside a contrast test that a valid glued
footer is still stripped.

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

Co-Authored-By: HAPI <noreply@hapi.run>

* test(shared): pin why line ownership, not payload shape, decides the strip

A payload-shape predicate - "the remainder must be a well-formed JSON prefix
that runs to end of line" - looks like it should separate a truncated footer
from a quoted example, and it does for most shapes. It fails on an open
string, because an unterminated string swallows everything after it:

    Use `AGENT_NOTIFY_SUMMARY {"summary":"` to reproduce the failure.

the payload of which is byte-for-byte the shape of a real truncation
(`"summary":"ok`). The signature of the defect and the signature of the
false positive are the same, so no test of the payload can tell them apart -
which is why the decision is made from the line instead.

Pins that case so the next person to reach for a payload-shape rule finds the
counterexample already failing.

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

Co-Authored-By: HAPI <noreply@hapi.run>

---------

Co-authored-by: HAPI <noreply@hapi.run>
2026-11-18 08:08:40 +08:00
wushenghua 8338c17e4c feat(opencode): expose goal through live RPC like Codex 2026-11-18 05:29:00 +08:00
wushenghua 1efb55332f fix(opencode): keep goal sessions working and auto-apply PWA updates 2026-11-18 05:10:46 +08:00
wushenghua 0aac531f67 fix(web): read legacy OpenCode goal events as rounds, not tokens 2026-11-18 05:00:00 +08:00
wushenghua 09495f779b feat(opencode): bridge native /goal command, status and round output 2026-11-18 03:37:42 +08:00
KiyoshiandGitHub 37446bcf5f feat(agy): negotiate ACP slash commands and support native /swarm (#2454)
* feat(agy): negotiate ACP slash commands and support native /swarm

* fix(agy): clear cached ACP commands when available_commands_update is empty

* fix(agy): recognize backgrounded commands in swarm_wait turn boundaries
2026-11-17 15:16:17 +08:00
87be592a77 fix(hub): read passkey browser complete body once (#2455)
POST /api/passkey/browser/complete called c.req.text() twice; the second
form was empty so verify never saw response/error. Reuse the first parse.
Also teach the Playwright browser harness to apply Location fragments on
3xx (fulfill drops #fragment), so the opener callback can complete.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-17 15:16:02 +08:00