Skip to content

feat(desktop): add clickable source citations - #11519

Merged
Git-on-my-level merged 4 commits into
BasedHardware:mainfrom
Git-on-my-level:codex/clickable-citations
Aug 13, 2026
Merged

Git-on-my-level merged 4 commits into
BasedHardware:mainfrom
Git-on-my-level:codex/clickable-citations

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • add a durable typed citation model for conversations, memories, tasks, goals, screenshots, and web sources
  • render inline citation controls in Query Shell with hover previews, keyboard/accessibility behavior, and source-specific navigation
  • carry canonical source metadata through backend tool responses, agent tool output, final answer persistence, and journal replay
  • remove the now-duplicative bottom source rail while keeping unmatched legacy markers inert instead of guessing their destinations
  • replace the shared oversized-file baseline ledger with target-branch comparisons and exact PR-body exceptions, eliminating unrelated metadata conflicts and making reductions ratchet down automatically

Verification

  • focused citation, Markdown interaction, Rewind focus, and owner-fencing Swift tests — 23 passed
  • xcrun swift build -c release --package-path desktop/macos/Desktop --jobs 1 — passed
  • backend/.venv/bin/pytest -q backend/tests/unit/test_tools_router.py backend/tests/unit/test_tools_agent_route_response_shape.py — 97 passed
  • backend/.venv/bin/python -m pytest -q backend/tests/unit/test_chat_memory_tool_caller.py — 6 passed
  • scripts/pr-preflight --base origin/main --head HEAD --lane local --pr-body-file ... — 112 checks passed
  • desktop/macos/scripts/agent-logic-harness.sh --cross-surface-smoke — passed
  • named QA bundle /Applications/omi-clickable-citations-v2.app passed strict code-signature verification and automation health checks
  • live Query Shell prompt What should I work on next? Give me citations. produced inline markers and persisted 12 matching typed citation blocks with canonical IDs

Product invariants

  • INV-AUTH-1
  • INV-CHAT-1
  • INV-VOICE-1

Failure-Class: none

Line-count exceptions

Line-Count-Exception: desktop/macos/Desktop/Sources/MainWindow/Components/ChatBubble.swift | 2023 -> 2050 | Threads settled typed citation references through the existing assistant-text rendering seams while keeping provenance and layout implementation extracted.
Line-Count-Exception: desktop/macos/Desktop/Sources/MainWindow/Components/OmiMarkdown.swift | 1262 -> 1636 | Citation controls must participate in the existing attributed Markdown flow so prose, tables, keyboard actions, and hover previews share one wrapping geometry owner.
Line-Count-Exception: desktop/macos/Desktop/Sources/Onboarding/OnboardingChatView.swift | 2156 -> 2157 | Keeps the new invisible citation provenance block exhaustive in onboarding's existing block-visibility switch.
Line-Count-Exception: desktop/macos/Desktop/Sources/Providers/ChatProvider.swift | 6757 -> 6889 | Citation finalization remains beside streaming acceptance and journal terminalization so revoked runs cannot persist stale or incomplete click targets.
Line-Count-Exception: desktop/macos/Desktop/Sources/Providers/ChatToolExecutor.swift | 3242 -> 3411 | Typed source registration remains at each owner-fenced tool result boundary so canonical IDs are never reconstructed from prose.

Notes

  • no backend deployment or production app mutation was performed
  • web URLs are restricted to HTTP(S); stale or unresolved typed sources fail closed

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 32 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread backend/routers/tools.py Resolved
@Git-on-my-level
Git-on-my-level force-pushed the codex/clickable-citations branch 3 times, most recently from 73ef10d to e9afb6f Compare August 13, 2026 21:52
@Git-on-my-level
Git-on-my-level force-pushed the codex/clickable-citations branch from e9afb6f to 4b7dac2 Compare August 13, 2026 22:22
@Git-on-my-level
Git-on-my-level merged commit 00cc9ed into BasedHardware:main Aug 13, 2026
30 of 32 checks passed
kodjima33 added a commit that referenced this pull request Aug 14, 2026
…nner's defaults

The fourth failure in the red lane, and the last one:
`testRewindCitationFocusIsOneShotAndPreservesExactScreenshotID` has
failed on every CI run since #11519 landed while passing locally.

`RewindCaptureOwnerSnapshot` resolves an owner id two different ways.
`capture()` prefers the authorization snapshot's owner, which comes from
the persistent `auth_userId` default; `isCurrent()` compares against
`RewindDatabase.currentUserId ?? "anonymous"`, which is in-memory and
starts nil in a fresh process. `swift-test-suites.sh` runs each suite in
its own process, but UserDefaults is on disk and outlives all of them, so
on a runner where an earlier suite left `auth_userId` set the focus
request captured owner "X" and `consume()` compared it against
"anonymous" and refused — one-shot handoff lost, on an assertion that has
nothing to say about owner plumbing.

Reproduced exactly, locally: setting `auth_userId` before the same test
turns it red with CI's message ("nil" is not equal to "Optional(42)").
Pinning `RewindDatabase.currentUserId` to `currentOwnerId()` for the
duration turns it green with that default still set — 18/18 — and green
again with it cleared.

The divergence between the two owner sources is a real product defect
(any snapshot captured before `currentUserId` is resolved at launch can
never validate), but narrowing a fail-closed ownership fence is not a
change to make alongside a CI unblock; filed separately.

Verification: `swift test --filter` on all four suites the lane reports —
ChatCitationTests 18/18, ShellModalScrimTests 7/7,
GlassSurfaceReviewRegressionTests 3/3, ProactiveLaneClientTests 11/11,
InkGlassHitRegionReporterTests 2/2. 77 failures -> 0.

Failure-Class: none
kodjima33 added a commit that referenced this pull request Aug 15, 2026
…#11596)

Three Swift suites have died with SIGSEGV on the macos-15 CI runner since
2026-08-14, leaving the desktop lane red on every run that executes desktop
tests: AgentPillLifecycleTests, ChatTimelineContinuityTests,
MarkdownNestedScrollTests.

The crash report surfaced by #11589 names the cause. It is a stack overflow,
not a bad pointer: the faulting address sits 80 bytes below thread 0's stack
limit inside the guard region, and the backtrace is 511 frames of one repeating
unit --

  OmiMarkdownContent -> _ConditionalContent -> OmiMarkdownCitationContent
    -> _ConditionalContent -> OmiMarkdownContent -> ...

all of it `View._viewListCount(inputs:)`. That is a *static* walk: SwiftUI
resolves it from view types alone and never evaluates a body, so the cycle is
in the type graph, not in any value. `OmiMarkdownContent.body` reaches
`OmiMarkdownCitationContent` through both `textView` and `OmiMarkdownTableView`,
and the citation view's mask-failure fallback named `OmiMarkdownContent` --
closing two cycles on one back-edge. The fallback almost never executes at
runtime, which is why this looked value-dependent for two days; the static walk
recurses regardless of whether that branch is ever taken.

Erasing that one back-edge with `AnyView` terminates the walk (`AnyView`
resolves its count dynamically) and leaves the graph acyclic.

The cycle was closed by 00cc9ed "feat(desktop): add clickable source
citations (#11519)" (David Zhang, 2026-08-13), which introduced
`OmiMarkdownCitationContent` and its fallback.

Not CI-only: the production transcript hosts the same tree
(ChatMessagesView.scrollContent -> ScrollView -> VStack -> ChatBubble ->
OmiMarkdown), so a macOS 15 user on a build carrying #11519 hits the same
recursion. Changelog entry added.

Verified:
- desktop/macos/scripts/swift-test-suites.sh over the three crashing suites
  plus OmiMarkdownCitationInteractionTests and OmiMarkdownLineSpacingTests.
- New regression test measures a cited answer inside a ScrollView/LazyVStack
  host -- the container that forces the static count. Pre-fix that shape is
  what kills the process on macOS 15; it cannot fail an assertion, so the
  suite's survival on the macos-15 runner is the assertion.
- The macos-15 CI lane is the authority here: the crash does not reproduce on
  macOS 26, so lane-green on this PR is the proof.

Failure-Class: new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant