Skip to content

feat(ios): haptic feedback for chat send, completion, and failure - #100416

Merged
steipete merged 1 commit into
mainfrom
feat/ios-chat-haptics
Jul 5, 2026
Merged

steipete merged 1 commit into
mainfrom
feat/ios-chat-haptics

Conversation

@steipete

@steipete steipete commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Part of #100415

What Problem This Solves

Chat lifecycle moments on iOS — sending a message, a run completing, a run failing — have no tactile feedback, making the app feel less native than platform peers.

Why This Change Was Made

Adds OpenClawChatHaptics to the shared chat package: a small injectable-performer type (UIKit feedback generators on iOS behind platform conditionals; macOS is a deliberate no-op since NSHapticFeedbackManager only fires from gesture contexts). Wiring goes through a single choke point — every pending-run clear site passes its haptic event through clearPendingRun(hapticEvent:) — so completion/failure feedback fires exactly once even under duplicate terminal-event delivery, and durable assistant rows are classified by stop reason (error/aborted → failure). Send feedback fires on accepted sends only.

User Impact

iOS users feel a light tap when a message sends, a success tap when the assistant finishes, and an error buzz when a run fails or times out. No settings surface added in v1; macOS behavior unchanged.

Evidence

  • cd apps/shared/OpenClawKit && swift test --filter "ChatHapticsTests|ChatViewModelTests" — 108 tests, 2 suites, all pass (new suite covers send, duplicate-completion single-fire, durable error/aborted ordering).
  • Codex autoreview during development: accepted findings on durable error/aborted classification fixed; one suggestion consciously rejected (abort-event path that never surfaces errorText — outside the failure contract).
  • Implementation by Codex (gpt-5.5) from a frozen spec; reviewed line-by-line by the orchestrating session.

Known deferral: the offline-outbox enqueue haptic waits for the outbox PR (#100331) to land, since that code is not on main yet.

@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Jul 5, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bd4d61c24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let hapticEvent: OpenClawChatHaptics.Event? = switch chat.state {
case "final": .runCompleted
case "error": .runFailed
default: nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Map aborted chat events to failed haptics

When the gateway sends a terminal chat event with state == "aborted" for the pending run, this switch falls through to nil, so clearPendingRun clears the run without any haptic feedback. Other failure paths added in this commit already treat aborted durable rows and agent lifecycle aborts as .runFailed, so user/coordinator cancellation delivered through the chat-event path silently misses the new failure feedback.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 4:30 PM ET / 20:30 UTC.

Summary
The PR adds an injectable Swift OpenClawChatHaptics performer, wires it into OpenClawChatViewModel send/completion/failure paths, and adds focused haptics tests.

PR surface: Other +220. Total +220 across 3 files.

Reproducibility: yes. Source inspection gives a high-confidence reproduction path: emit a pending-run chat.state == "aborted" event, or refresh history after a gateway-injected abort row with stopReason: "stop" plus openclawAbort.aborted.

Review metrics: 1 noteworthy metric.

  • Public chat haptics API: 1 public type added, 1 defaulted initializer parameter added. This is source-compatible, but it creates shared package API and default behavior maintainers should accept deliberately before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100415
Summary: This PR is the haptics candidate for the broader iOS chat polish issue; the transcript-export and offline-outbox PRs are related but distinct work streams.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Map direct chat.state == "aborted" events to .runFailed and add a focused haptics test.
  • Carry or decode the persisted openclawAbort.aborted marker so durable abort rows play failure haptics.

Risk before merge

  • [P1] Direct aborted chat events can clear the pending run with no failure haptic, despite the PR promising failure feedback for cancellations and failures.
  • [P1] Persisted abort partials can be classified as .runCompleted because the Swift message model drops openclawAbort.aborted while the stored stopReason remains stop.
  • [P1] The PR adds default-on iOS haptics and a public shared package type, so maintainers should intentionally accept that API and UX surface after the correctness blockers are fixed.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the single haptic choke point, but map both live and persisted abort paths to failure haptics with tests before maintainers decide whether to land the default-on iOS haptics feature.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] A focused repair can fix the two haptic abort classifiers and tests on this PR branch; final product acceptance still remains a maintainer decision.

Maintainer decision needed

  • Question: After the abort-classification blockers are fixed, should the shared iOS chat package accept default-on structured chat haptics and the new public OpenClawChatHaptics API now?
  • Rationale: The remaining code repair is mechanical, but the PR adds new user-visible iOS behavior and public shared package surface while carrying the protected maintainer label.
  • Likely owner: steipete — @steipete owns the umbrella request, authored this candidate PR, and appears in recent history for the affected shared chat surface.
  • Options:
    • Accept after abort fixes (recommended): Land the feature once live aborted events and persisted abort rows both map to failure haptics with focused Swift coverage.
    • Require an opt-out first: Ask for a settings or policy surface before enabling chat haptics by default for all iOS users.
    • Defer haptics: Pause or close the haptics feature until maintainers re-scope iOS chat polish direction.

Security
Cleared: The diff adds Swift chat UI haptic logic and tests only; it does not touch secrets, dependencies, CI, package resolution, or code-execution surfaces.

Review findings

  • [P2] Map aborted chat events to failed haptics — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift:2236-2239
  • [P2] Treat persisted abort markers as failed haptics — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift:2659
Review details

Best possible solution:

Keep the single haptic choke point, but map both live and persisted abort paths to failure haptics with tests before maintainers decide whether to land the default-on iOS haptics feature.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection gives a high-confidence reproduction path: emit a pending-run chat.state == "aborted" event, or refresh history after a gateway-injected abort row with stopReason: "stop" plus openclawAbort.aborted.

Is this the best way to solve the issue?

No. The single pending-run haptic choke point is the right shape, but this version is not the best fix until both abort classifiers are repaired and covered.

Full review comments:

  • [P2] Map aborted chat events to failed haptics — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift:2236-2239
    Still present from the prior review: this branch handles chat.state == "aborted", but the new haptic switch maps only final and error, so a live abort clears the pending run without the promised failure haptic.
    Confidence: 0.95
  • [P2] Treat persisted abort markers as failed haptics — apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift:2659
    Still present from the prior review: gateway-injected abort partials are stored as stopReason: "stop" plus openclawAbort.aborted, but the Swift model drops that marker and this helper treats the row as completion. A cancelled durable row can therefore play the success haptic.
    Confidence: 0.91
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.92

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 13e59025783a.

Label changes

Label justifications:

  • P3: This is low-risk iOS chat polish with narrow correctness blockers and no evidence of data loss, security impact, or broken core runtime.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor real-behavior proof gate is not applied because the live PR carries the protected maintainer label; the body provides Swift test evidence rather than device haptic proof.
Evidence reviewed

PR surface:

Other +220. Total +220 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 248 28 +220
Total 3 248 28 +220

Acceptance criteria:

  • [P1] cd apps/shared/OpenClawKit && swift test --filter "ChatHapticsTests|ChatViewModelTests".

What I checked:

Likely related people:

  • steipete: @steipete opened the umbrella issue and this PR, has current-main history in iOS/global chat transcript handling, and is the likely owner for accepting default-on iOS haptics as product polish. (role: recent area contributor and likely product owner; confidence: high; commits: 772d13c19d88, e43c72954a30; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatModels.swift)
  • jcooley8: Remote history shows @jcooley8 authored recent shared iOS chat reconciliation and transformed-history work in the central view model this PR modifies. (role: recent area contributor; confidence: medium; commits: e43c72954a30; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift, apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatModels.swift)
  • jalehman: Remote history shows @jalehman authored the transcript-writer seam refactor on the gateway-injected transcript path whose abort metadata drives one haptic classification blocker. (role: adjacent gateway transcript owner; confidence: medium; commits: 00a75db4280b; files: src/gateway/server-methods/chat-transcript-inject.ts)
  • Solvely-Colin: Remote history shows @Solvely-Colin authored the iOS Pro UI and gateway-backed shared chat flow that established much of the affected surface. (role: iOS shared chat feature introducer; confidence: medium; commits: f6e51ff99af4; files: apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatViewModel.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (2 earlier review cycles)
  • reviewed 2026-07-05T18:46:29.705Z sha 0bd4d61c24cda32402d732b8e2eff73c80aeadc5 :: needs real behavior proof before merge. :: [P2] Map aborted chat events to failed haptics
  • reviewed 2026-07-05T19:40:04.542Z sha 190997920399dcb14c09d7a79e65e6e96d2b7f58 :: needs real behavior proof before merge. :: [P2] Map aborted chat events to failed haptics | [P2] Treat persisted abort markers as failed haptics

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 5, 2026
@steipete
steipete force-pushed the feat/ios-chat-haptics branch from 0bd4d61 to 1909979 Compare July 5, 2026 19:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1909979203

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2658 to +2659
let stopReason = message.stopReason?.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
return stopReason == "error" || stopReason == "aborted" ? .runFailed : .runCompleted

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat persisted abort markers as failed haptics

When pending state is cleared from a history refresh after a cancelled run with partial output, this classifier only checks stopReason, but the gateway persists those abort partials as stopReason: "stop" plus openclawAbort.aborted (src/gateway/server-methods/chat-transcript-inject.ts:99-113), and OpenClawChatMessage currently decodes only stopReason/errorMessage (apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatModels.swift:201-214). Fresh evidence beyond the existing chat-event comment is this persisted abort path: clearPendingRunIfAssistantMessagePresent can therefore fire .runCompleted for a cancelled durable row instead of the failure haptic.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the feat/ios-chat-haptics branch from 1909979 to 9a08875 Compare July 5, 2026 20:17
@steipete
steipete force-pushed the feat/ios-chat-haptics branch from 9a08875 to ebd6a3a Compare July 5, 2026 20:36
@steipete
steipete merged commit bf15638 into main Jul 5, 2026
41 checks passed
@steipete
steipete deleted the feat/ios-chat-haptics branch July 5, 2026 20:42
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant