Skip to content

feat(native): prompt links - #115

Merged
rynfar merged 2 commits into
nativefrom
nw/111-prompt-links
Nov 3, 2026
Merged

rynfar merged 2 commits into
nativefrom
nw/111-prompt-links

Conversation

@rynfar

@rynfar rynfar commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Native could not share a prompt or receive prompt links. This ports the first native slice of #111 and keeps AP-PROMPTLINKS partial.

  • Adds pure Rust link building/parsing/sanitizing, hidden-character counts, the 8,000 UTF-16-unit limit, hosted/app-path/deep-link mapping, GitHub/GitCafe project matching, model selection (including Claude alias, ready-before-warning and exact/fallback results), and local PR-thread selection. Ports the shared/client-runtime TypeScript test cases, including ordered PR lookup selection.
  • Adds user-row Copy prompt link and both composer palette actions. Context links require a GitHub project. Outgoing links use https://app.t3.codes/new and show the web success toast.
  • Handles t3code-native://new, t3code-native://threads/<environment>/<thread> and hosted prompt URLs through GPUI open-URLs and CLI arguments. Waits for the shell, selects the most recently active matching project, reuses a locally linked PR thread, resolves the model with the web's notes, warns about hidden characters, and requires an explicit draft replacement. Links never send a turn.
  • Declares only t3code-native in the bundle plist; leaves Electron's t3code scheme alone. Adds snapshot --open-url, a local repository fixture flag, and intercepted --clipboard-output for verification without touching the real clipboard.

Validation: cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace (1,087 tests), snapshot build, theme generation check, 42 parity tests, conformance generation check, shell/plist validation, and offscreen interaction against the existing smoke server on 14658. Checked actual intercepted links from the message action and both palette variants. Native workspace changes only; web/mobile/providers/contracts/server remain unchanged. No server writes, paid turns, system URL registration or clipboard writes were needed.

vp run check:changed fork/native completed successfully (format, all 39 affected package typechecks, and the selected test). This revision is rebased onto fork/native at aff9199ee1.

Review fixes: both explicit and local PR-thread links now verify the selected environment/thread after navigation before staging a prompt. Rejected hidden destinations leave the home draft untouched. Explicit links resolve/connect a saved destination before waiting for its shell, and superseded links cannot stage into a different selected environment. User-row links flatten local t3-context:// references to readable labels before applying the length limit, matching the web.

The three core regressions failed with the previous behavior and pass with these fixes, including a context-only prompt remaining sendable without local records. Logs: /private/tmp/native-111-review-red.log and /private/tmp/native-111-review-green.log.

Local evidence (per worker instructions, PNGs are neither uploaded nor committed):

  • Baseline before this work, from the inherited binary: /private/tmp/t3-prompt-links-111/before.png
  • User copy action: /private/tmp/t3-prompt-links-111/copy-action.png
  • Palette entries: /private/tmp/t3-prompt-links-111/palette.png
  • New-thread link: /private/tmp/t3-prompt-links-111/new-thread.png
  • Missing repository view: /private/tmp/t3-prompt-links-111/missing-repository.png
  • Hidden-character warning and sanitized prompt: /private/tmp/t3-prompt-links-111/hidden.png
  • Replace confirmation: /private/tmp/t3-prompt-links-111/replace.png
  • After replacement: /private/tmp/t3-prompt-links-111/replaced-final.png
  • Existing thread link: /private/tmp/t3-prompt-links-111/thread-link.png
  • Copy success: /private/tmp/t3-prompt-links-111/copied.png

Remaining gaps:

  • Repository/PR discovery uses the currently connected environment. Searching all saved environments is not implemented (native currently connects one at a time); explicit thread links can switch to a saved environment.
  • Per-environment pullRequests.linkedThreads RPC lookups are not wired, so an older PR-linked thread absent from the local shell will not be found. The ordered pure lookup helper is ported/tested.
  • The missing-repository page does not implement Clone; users must clone/add the project separately or use without project.
  • An unlinked PR cannot launch the web's checkout/setup handoff yet. Use without project stages its URL and optional prompt instead.
  • The existing native shell decoder only supplies modern pullRequests; legacy single linkedPullRequest payloads are not handled by this slice.

Review runtime evidence (all local/offscreen, no server mutations):

  • Disconnected saved-destination link before/after: /private/tmp/native-111-review-evidence/disconnected-before.png, /private/tmp/native-111-review-evidence/disconnected-after.png
  • Hidden explicit destination rejection: /private/tmp/native-111-review-evidence/hidden-explicit.png
  • Hidden PR destination rejection: /private/tmp/native-111-review-evidence/hidden-pr.png
  • Draft preserved after rejection: /private/tmp/native-111-review-evidence/hidden-draft-preserved.png
  • Context-only row copy: /private/tmp/native-111-review-evidence/context-copied.png and its intercepted URL /private/tmp/native-111-review-evidence/context-copied.txt
  • Reproduction commands and local fixtures: /private/tmp/native-111-review-evidence/reproduce.sh, hidden.json, context.json. The copied smoke homes are <worktree>/.t3/native-review (connected) and <worktree>/.t3/native-disconnected (saved environment, no active connection).
  • Read-only smoke transcript: /private/tmp/native-111-review-evidence/probe.log

Not exercised: OS delivery of a registered scheme (intentionally prohibited), switching between multiple real environments, and the scratch-project fallback's server write. A disconnected client opening a saved smoke environment, both hidden destination paths, CLI/snapshot handling, matching-project placement and replacement were exercised.

Built with GPT-6.1 Sol in Codex

This was referenced Nov 3, 2026
@rynfar
rynfar force-pushed the nw/111-prompt-links branch from 85251e8 to 79b3da8 Compare November 3, 2026 08:44
@rynfar

rynfar commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Addressed all three verified P2 findings at 79b3da8324d14f1b3afcff1d1721419223168b9b, rebased onto fork/native at aff9199ee1.

  1. Explicit thread links and local PR-thread links share one navigation path. After select_thread applies the existing visibility policy, a core guard checks the actual selected environment/thread before returning any prompt for placement. Hidden/rejected destinations produce an error page and leave the home draft intact.
  2. Explicit links resolve/connect the saved destination before waiting for shell/config readiness. A newer link resets its connection-attempt state, and placement is scoped to the selected destination. The disconnected-client smoke capture now opens its saved thread rather than staying on Connect.
  3. User-row links flatten validated local context references into sanitized readable labels before checking length/building the URL, matching TimelineUserMessageRow.tsx. The context-only terminal case arrives as sendable prose with no referenced records.

The three regressions failed with the old behavior and pass after the fixes. All 1,087 native workspace tests, workspace/all-target Clippy, snapshot build/Clippy, theme/parity/conformance checks, and vp run check:changed fork/native passed. No server writes, paid turns, system URL registration, clipboard writes, or reserved #112/#74 file edits.

Local offscreen evidence, fixtures and reproduction commands: /private/tmp/native-111-review-evidence/ (reproduce.sh, hidden.json, context.json, disconnected-before.png, disconnected-after.png, hidden-explicit.png, hidden-pr.png, hidden-draft-preserved.png, context-copied.png, context-copied.txt, probe.log). Captures were inspected. Context clipboard output is https://app.t3.codes/new?prompt=Terminal+1+lines+4-9.

The deliberate gaps remain unchanged: clone, unlinked PR checkout, server PR lookup, discovery across saved environments and legacy single PR payloads. OS scheme delivery, switching between multiple real environments, and scratch-project writes were not exercised. The ledger stays partial.

@rynfar

rynfar commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Exact-head orchestrator gate GREEN at 79b3da8324d14f1b3afcff1d1721419223168b9b, trial-merged onto #114: Clippy, all 1,097 integrated native tests, theme, parity, conformance passed (exit 0). Independent Sol re-review confirms the three advertised-path bugs fixed and fixture hooks opt-in/snapshot-only. The noted explicit Replace action is intentionally unversioned: checked against web components/promptLinks/linkedPrompt.ts:23-45, which likewise captures the original target and writes on explicit Replace. This is existing web parity, not a new native regression; links do not silently overwrite a nonempty draft. Documented first-slice gaps and unverified OS delivery/multi-real-environment/scratch-write paths remain.

@rynfar
rynfar merged commit 96e3098 into native Nov 3, 2026
@rynfar

rynfar commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Primary post-merge integrated offscreen pass on96e30980a7: snapshot build and8captures exited0. Confirmed hidden destination leaves Keep this draft intact, a saved target opens from disconnected state with Review this thread staged, and context-only row copy yields portable prose Terminal 1 lines 4-9. The merged Diagnostics fixture also rendered in this pass. Evidence /private/tmp/native-factory-2f5f764a/integrated-shots/. No paid turns, server mutations, real-window input or clipboard writes were needed.

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