Commit Graph
69 Commits
Author SHA1 Message Date
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
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
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
OverbakerandGitHub 430ad66ceb fix(web): keep chat pinned to tail when switching sessions (#2456)
* fix(web): keep chat pinned to tail when switching sessions

* fix(web): preserve tail following when upward gesture has no older history
2026-11-17 15:15:48 +08:00
KiyoshiandGitHub 4d1a12b5a3 feat: branch a conversation at a user turn with harness and model selection (#2247) 2026-11-17 12:06:26 +08:00
Junmo KimandGitHub 47b3fb6b7d perf(web): drive session-list activity indicators from one low-rate ticker (#2447)
* perf(web): drive session-list activity indicators from one low-rate ticker

* fix(web): keep one reduced-motion query for the ticker's lifetime

* fix(web): keep the model-error halo pulsing on the low-rate ticker

* fix(web): start each ping subscription at its own first frame
2026-11-16 19:51:31 +08:00
SSU-WEI HUANGandGitHub 6c38c50f1b fix(web): keep unread rows mounted when a collapsed project group is toggled (#2434)
* fix(web): keep unread rows mounted when a collapsed project group is toggled

A collapsed group drew its unread rows in a separate peek list and the
expanded group drew every row inside its CollapsiblePanel, so toggling the
group remounted those rows: on expand they faded in from opacity 0 and their
icon and spinner restarted; on collapse they showed twice while the panel
closed.

Render each group's rows once, each in its own CollapsiblePanel that is open
while the group is expanded or the row is a kept unread row. Toggling the
group now only folds the other rows. Spacing moves inside the panels so
folded rows take no room.

Fixes #2433

* test(e2e): count expanded project groups by header, not by open panels

Rows now have their own collapsible panels, so open panels no longer map
one-to-one to expanded groups.
2026-11-15 17:32:40 +08:00
AnanovoandGitHub d27e276a65 fix(web): show background-only work as a static blue dot (#2412) 2026-11-14 20:13:42 +08:00
AnanovoandGitHub 083aaca779 fix(web): distinguish and navigate pending requests (#2402) 2026-11-13 08:39:15 +08:00
Junmo KimandGitHub cad21ec6d0 feat(opencode): fork and rewind OpenCode v2 conversations (#2424) 2026-11-13 08:35:45 +08:00
AnanovoandGitHub 44fde2072b feat(web): combine session activity and unread indicators (#2380) 2026-11-12 08:44:38 +08:00
AnanovoandGitHub 5e76af5615 feat(codex): fork running sessions through the last completed turn (#2369) 2026-11-11 13:04:43 +08:00
KiyoshiandGitHub 810aab72fc fix(web): keep jump-to-bottom visible in history (#2304) 2026-11-06 13:13:32 +08:00
AnanovoandGitHub f95dcee05e fix(web): preserve blob-backed images in shared exports (#2282)
* fix(web): preserve blob-backed images in shared exports

* test(web): include blob export spec in CI
2026-11-05 07:27:45 +08:00
KiyoshiandGitHub ec414ce474 fix(web): keep Fast toggle legible in dark mode (#2286) 2026-11-05 07:27:33 +08:00
bc6b1577fa merge: hapi upstream v0.34.1
Merge release tag v0.34.1 into the local deployment fork. Preserve local
features (Agent Team, Studio, session shares, skins, DSH Web runtime,
attachment cache, deploy tooling) while adopting upstream session-list,
composer, steering, model-catalog, native-client, and migration changes.

Regenerate the local chat_attachments migration as v31→v32 behind the
upstream v28-v31 ladder; keep DSH on the Web runtime instead of the ACP
transport added upstream.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: HAPI <noreply@hapi.run>
2026-11-05 00:51:11 +08:00
KiyoshiandGitHub 49c22d73a1 feat(web): group and collapse inactive session mentions (#2271)
* feat(web): filter session mentions to active sessions

* feat(web): group and collapse inactive session mentions
2026-11-04 15:58:01 +08:00
AnanovoandGitHub 55f0f7b11d fix(web): dismiss fullscreen image previews on browser Back (#2191) 2026-11-02 18:07:10 +08:00
AnanovoandGitHub fe25c24d4e feat(web): add mobile attachment source picker (#1713)
* feat(web): add mobile attachment source picker

* fix(web): gate mobile attachment picker by adapter

* chore(web): trigger PR checks

* fix(web): start mobile attachment uploads concurrently
2026-11-02 18:04:26 +08:00
AnanovoandGitHub 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
2026-11-01 14:52:42 +08:00
AnanovoandGitHub 75aa3d929a fix(web): preserve completed status summaries during follow-up sends (#2241) 2026-10-30 07:17:44 +08:00
AnanovoandGitHub 0f76485ad9 feat(web): support local Markdown images in conversation messages (#2215)
* fix(web): resolve relative Markdown assets in file previews

* fix(web): harden standalone Markdown asset resolution

* fix(web): preserve Markdown URI and image policies

* fix(web): route Markdown file links through app history

* fix(web): preserve session reference navigation in previews

* feat(web): support local Markdown images in conversation messages

* fix(cli): bound session file reads

* fix(cli): avoid blocking bounded reads on FIFOs

* test(cli): run FIFO regression with Bun

* fix(hub): preserve legacy session file RPC calls

* test(web): update markdown preview fixture context

* fix(cli): reject symlinked session files outside workspace
2026-10-29 22:12:57 +08:00
AnanovoandGitHub f29be07bb9 fix(codex,web): preserve late command result identity and timing (#2239) 2026-10-29 22:12:27 +08:00
AnanovoandGitHub f48a6696cf fix(web): reveal directory tails and support touch scrolling (#2237) 2026-10-29 21:22:31 +08:00
AnanovoandGitHub bb51684339 fix(web): hide reorder handles for single composer attachments (#2235) 2026-10-29 12:49:12 +08:00
AnanovoandGitHub f6bc583471 feat(web): open a session in a separate window (#2192)
* feat(web): open a session in a separate window

* test(web): cover session sidebar restore control

* fix(web): preserve hidden sidebar across session navigation

* fix(web): retain hidden sidebar on session routes
2026-10-28 12:15:22 +08:00
AnanovoandGitHub 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
2026-10-28 12:14:48 +08:00
AnanovoandGitHub 35205ddb53 fix(web): keep mobile code gutters clear across renderers (#1720) 2026-10-28 12:06:50 +08:00
AnanovoandGitHub b4f46f58bb fix(web): preserve shared turn layout and generated file downloads (#1543)
* fix(web): preserve wrapped inline code in shared images

* test(web): snapshot wrapped inline code export

* ci: cover shared turn export on Linux

* ci: cover shared turn export on Linux

* fix(web): preserve generated file controls in shared previews

* fix(web): ignore late shared file responses

* fix(web): keep shared file links keyboard accessible

* chore: retrigger PR checks

* chore: retrigger PR checks

* fix(ci): correct E2E workflow indentation

* fix(web): hide table scrollbars in shared image exports
2026-10-28 12:05:20 +08:00
AnanovoandGitHub 1eacdd6ff1 fix(web): contain image preview labels to prevent chat layout shifts (#2116)
* fix(web): contain image preview labels to prevent chat layout shifts

* test(web): run history layout regression in CI
2026-10-26 10:27:06 +08:00
AnanovoandGitHub f198ab29a4 fix(web): preserve composer image previews across updates (#2070) 2026-10-26 10:01:08 +08:00
AnanovoandGitHub e3d42503b6 fix(web): contain transient scrollbar overflow during resize (#2077) 2026-10-26 10:00:49 +08:00
AnanovoandGitHub 2c1361ba5d fix(web): stop composer image previews from dragging after release (#2124) 2026-10-25 15:33:46 +08:00
AnanovoandGitHub 097a693348 fix(web): remove composer attachments without waiting for cleanup (#2128)
* fix(web): remove composer attachments without waiting for cleanup

* test(web): run attachment removal regression in CI
2026-10-25 15:33:37 +08:00
ee8802784d merge: hapi upstream main 2026-10-19 (34 commits past v0.30.7)
Bring in the post-0.30.7 upstream work while keeping local team, macaron,
requirement, DSH and deployment features:

- runner/hub: cross-platform orphan reap on archive and tracking loss,
  machine-spawn preallocated stubs, keepalive-only sessions reconcile to idle
- hub: prepared-statement cache, stale/canceled permission request handling
- cli: Codex compaction announcements, dynamic Kimi models, MCP bridge reap
- web: session toolbar icon shedding, mark-all-read, unread/active sections,
  Russian locale, external-link preference, 48px search chrome
- ios/android: locale and font-size updates

Conflict resolution keeps local-only behavior (agent team spawns, macaron
skins, collapsible sidebar, workspace markdown images) layered on the new
upstream toolbar and session lifecycle plumbing.

Test infrastructure: skip the Docker-only pwsh integration test quickly when
Docker is unavailable, and exclude the Bun-only usageScan test from vitest.

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

Co-Authored-By: HAPI <noreply@hapi.run>
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-23 12:44:05 +08:00
wushenghua e156e5b907 fix(web): tighten macaron session rows and align metadata 2026-10-17 00:44:37 +08:00
wushenghua f7fde1b963 fix(web): extend macaron backgrounds through safe areas 2026-10-17 00:29:24 +08:00
wushenghua aa082c0ff0 fix: unify macaron surfaces and page backdrop 2026-10-17 00:16:43 +08:00
wushenghua 8924dba80e feat: add five macaron color palettes 2026-10-16 23:57:18 +08:00
wushenghua 1bb12c8685 feat: add macaron gradient skin 2026-10-16 23:31:25 +08:00
wushenghua 08bb829e5f fix: use full-page forest skin backgrounds 2026-10-16 23:08:53 +08:00
wushenghua 65887b171e feat: enrich forest skin artwork
Add layered forest clearings, a responsive chat scene strip, larger companions and transparent nine-slice wooden frames. Export artwork for phone pixel density and preserve compact navigation, drafts, default appearance and existing session actions.
2026-10-16 22:47:44 +08:00
wushenghua eb540f80c8 feat: add forest adventure mobile skin
Add an opt-in forest skin with original transparent artwork, session companions, matching mobile surfaces, and on-demand offline art caching. Preserve existing theme customization and session actions. Include reproducible art slicing, browser coverage, and baseline test evidence.
2026-10-16 22:10:09 +08:00
SSU-WEI HUANGandGitHub c258a2279e fix(web): synchronize assistant runtime and history loading (#1893) 2026-09-21 13:56:14 +08:00
AnanovoandGitHub a7ad631691 feat(web): auto-hide primary session scrollbars (#1730)
* feat(web): auto-hide primary session scrollbars

* test(web): run scrollbar auto-hide E2E in CI
2026-09-16 08:15:02 +08:00
ca1fd80afd fix(cursor): pin Auto to CLI --model auto instead of account default (#1819)
* fix(cursor): pin Auto to CLI --model auto instead of account default

Selecting Auto was treated as unset/ACP default[] after the Default→Auto rename. Persist and spawn `auto` so the picker matches `agent --list-models`.

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

* fix(cursor): keep live ACP model until Auto actually applies

Pin session.model to auto for the next `--model auto` spawn, but do not claim the live backend switched when ACP only advertises default[].

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

* fix(cursor): reject live Auto unless ACP auto or spawn confirmed it

Do not persist Auto when the running catalog has no auto option. Clear the spawn-auto flag after a concrete model apply so Auto → concrete → Auto cannot fake a live switch.

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

* fix(cursor): keep ACP wire ids spawn-safe and apply effort

Cursor's parameterized picker (`clientCapabilities._meta.parameterizedModelPicker`)
advertises bare model bases plus separate `fast` / `thought_level` config options.
`buildCursorModelsSnapshotFromAcp` synthesized every base as
`${base}[fast=${fast}]`, and Cursor rejects any bracket id whose parameter set is
not that model's complete set, so 74 of the 76 published picker ids failed at ACP
`session/new` with `Cannot use this model` (#1818).

- Stop synthesizing wire ids: keep the advertised values verbatim (bare bases are
  accepted by `--model`, defaults applied). Parameter sets differ per model, so a
  synthesized id cannot be validated from the options alone.
- Flag such catalogs as `parameterized` so variant CLI skus still attach to their
  base rows — the ACP apply path expresses them through config options.
- Apply effort in `applyParameterizedCursorModel` (ids `effort`, `reasoning`,
  `reasoning_effort`), applied against the config options Cursor re-advertises for
  the newly selected model, and skipped on models without that axis.
- Match CLI sku bases across Cursor's legacy `cursor-` family prefix
  (`cursor-grok-4.6-high` → ACP base `grok-4.6`) so those variant rows are not
  dropped.
- Version the shared on-disk catalog cache (v2) so runners that already cached the
  rejected synthesized ids re-probe instead of serving them.

Verified with live `cursor-agent 2026.09.10-fd3934a` ACP runs: the catalog no
longer contains bracket ids, every advertised base and sampled variant sku spawns,
and in-session `claude-opus-4-8-low` / `cursor-grok-4.6-low` set the matching
`effort`/`reasoning` option.

* test(cursor): cover aliased effort ids and thinking coexistence

Covers the branches the HAPI bot review called out for #1818: the
`xhigh` → `extra-high` alias on `gpt-5.5` (`reasoning`), the
`reasoning_effort` id used by `gemini-3.8-flash`, and switching effort on a
model that also advertises Claude's separate `thought_level` `thinking`
toggle.

* test(cursor): cover legacy sku base and post-switch effort option

Adds the two apply-path cases the HAPI bot review called out for #1818:
resolving `cursor-grok-4.6-high` onto an advertised `grok-4.6` base, and
reading the effort option Cursor advertises for the newly selected model
(`reasoning` for gpt-5.5 → `effort` for claude-opus-4-8) instead of the
previous model's options.

* test(cursor): create the cache dir in the migration test

The version-envelope test wrote $HAPI_HOME/cache/cursor-models.json without
creating the directory, so running it alone (or filtering with -t) failed with
ENOENT before the assertion; it only passed because sibling tests in the same
file had already created the path. Reported in the HAPI bot review of #1822.

Verified: `vitest run ... -t 'ignores pre-versioned'` → 1 passed, whole file → 4 passed,
and every other changed test file passes when run standalone.

* Clarify Cursor Auto live-switch limitation in session pickers

* Reconcile partial Cursor model changes before acknowledging Auto

* Serialize Cursor model changes across clients with the existing async lock

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 08:12:16 +08:00
AnanovoandGitHub 7b6c575514 fix(web): refresh cached session tails with a small page (#1847) 2026-09-16 07:26:18 +08:00