Skip to content

fix(ios): open workspace file links from agent messages - #186

Open
coreybain wants to merge 2 commits into
mainfrom
fix/apple-workspace-file-links
Open

coreybain wants to merge 2 commits into
mainfrom
fix/apple-workspace-file-links

Conversation

@coreybain

@coreybain coreybain commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

What Changed

Tapping an agent's link to a workspace file on iPhone previously did nothing: Markdown rendered a clickable link, but the client sent the environment's filesystem path to iOS as an ordinary URL. File links now open Pathway's existing file viewer through the message's environment and workspace.

The handler supports absolute and relative paths, encoded filenames, Windows paths, and line references. It keeps website, mail, telephone, and product links on their existing handlers. Files outside the thread's workspace show an explanation.

Why

An agent's [Design and verification notes](/Users/.../docs/plans/report-a-bug.md) link looked usable on the phone but could not open. Reusing the workspace viewer provides remote access through the existing transport and workspace checks, with Done returning to the conversation.

Verification

  • 30 focused native tests passed across file links, Markdown images, workspace operations, and workspace scope checks.

  • The six file-link regression tests passed again after the final telephone-link handling adjustment.

  • Regression coverage includes the exact reported Markdown link and its projects.readFile request, URL encoding, line references, Windows paths, ordinary external links, and workspace boundaries.

  • Native iPhone test build and git diff --check passed.

  • Rebased onto the latest main; this PR is independent of the bug-report feature.

  • After the final rebase, all 26 targeted bug-report, issue-data, and Markdown file-link native tests passed.

UI Changes

A focused native UI test reproduced the no-op tap on main and passed with the fix: tap opens the expected document; Done returns to the conversation. Captured on iPhone 17 Pro / iOS 26.3 using fixture conversation and environment data.

Before: tap leaves the conversation unchanged After: file opens

Tap/open/return recording · Capture details

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for UI changes
  • I included a video for interaction changes

Model: GPT-6. Harness: Codex.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-19T23:24:57.385505Z ac86235 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac86235604

ℹ️ 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 +31 to +33
appModel.cloud.threads.filter {
$0.threadId == context.threadID && $0.companyId == context.model.thread.companyId
&& $0.environmentId == context.model.thread.environmentId && $0.shell.deletedAt == nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve file links from projected child threads

When a provider-native subagent message supplies its child threadId, or the user opens that child through makeChildModel, the child is loaded from orchestration.getThreadProjection and need not exist in appModel.cloud.threads. This lookup then returns nil and always shows “File unavailable” despite the live child model and environment connection, so file links do not work in those conversations. Resolve the child from the current model when its ID matches, and otherwise load its projection instead of requiring a cloud-discovery row.

AGENTS.md reference: AGENTS.md:L71-L75

Useful? React with 👍 / 👎.

Comment on lines +34 to +36
if !isFileURL, !windowsDrive, let scheme = url.scheme {
// A bare "file.swift:42" also parses as a URL scheme. Numeric tel/mailto URLs do not identify files.
guard line != nil, path == scheme, path.contains(".") else { return nil }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept line links to extensionless root files

When an agent links a root-level extensionless file with a conventional line suffix, such as [Dockerfile](Dockerfile:12) or [Makefile](Makefile:8), Foundation interprets the filename as the URL scheme. This guard then rejects it solely because the parsed path has no dot, so the modifier forwards the URL to iOS instead of opening the workspace file. Handle common extensionless filenames, or otherwise disambiguate valid numeric line references without requiring an extension.

Useful? React with 👍 / 👎.

Comment on lines +29 to +31
} else if let fragment = url.fragment?.removingPercentEncoding,
fragment.range(of: #"^[Ll]\d+(?:[Cc]\d+)?$"#, options: .regularExpression) != nil {
line = Int(fragment.dropFirst().prefix(while: \.isNumber))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support range-style line anchors

When an agent emits a GitHub-style range anchor such as src/App.swift#L42-L50, this exact fragment match rejects the range suffix. The fragment has already been removed from the file path, so the file still opens but line remains nil and the viewer stays at the top, making the documented line-navigation behavior fail for a common citation format. Accept range anchors and use their first line as the scroll target.

Useful? React with 👍 / 👎.

.background(.yellow.opacity(0.2)).id(initialLine)
if initialLine < lines.count { Text(lines.dropFirst(initialLine).joined(separator: "\n")) }
}
} else { Text(contents) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle line targets beyond the preview limit

When a valid line target lies after the first 1 MiB of a file, projects.readFile returns only its truncated prefix, making initialLine greater than lines.count; this fallback then displays that prefix from the top without highlighting or explaining that the requested location was omitted. Large-file links therefore fail their core navigation behavior. Add a bounded read around the requested line rather than increasing the entire WebSocket payload, or explicitly report that the target is outside the preview.

AGENTS.md reference: AGENTS.md:L11-L13

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Sep 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant