Skip to content

feat(mobile): bring GitLab and Bitbucket code review up to the GitHub workflow (part 2/2) - #6021

Draft
iscekic wants to merge 1 commit into
kwf/bring-mobile-gitlab-and-bitb-3792-l1from
kwf/bring-mobile-gitlab-and-bitb-3792-l30
Draft

feat(mobile): bring GitLab and Bitbucket code review up to the GitHub workflow (part 2/2)#6021
iscekic wants to merge 1 commit into
kwf/bring-mobile-gitlab-and-bitb-3792-l1from
kwf/bring-mobile-gitlab-and-bitb-3792-l30

Conversation

@iscekic

@iscekic iscekic commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Changelog for users

  • The review inbox and detail view now cover GitLab merge requests and Bitbucket pull requests: files, diffs, discussions, checks, and merges, in provider wording.
  • GitLab supports personal and organization contexts, including self-managed instances; Bitbucket Cloud is organization-only and explains that in a personal context.
  • New sessions select a repository and a branch per provider, and the chosen branch reaches the real session checkout.
  • Recents, drafts, viewed-file sets, and pending comments stay separate across providers, owners, GitLab instances, and same-named repositories.
  • Merges and comments fence on the exact head and diff anchor; a moved head or stale revision never redirects or misposts.
  • Auto-merge appears as an explicit capability: GitLab merges when its pipeline succeeds, and Bitbucket explains that its API has none.
  • Badges, pasted URLs, shared links, deep links, and recents now open GitLab and Bitbucket reviews in-app.
  • When one provider's inbox fails, the other providers' rows stay visible, and the footer retry reloads only the failed provider's page.

Changelog for maintainers

  • Start at the new provider review layout: it validates every route segment, publishes the provider scope (ref plus organization) in context, and hosts the comment, review-submit, merge, and file-navigator sheets.
  • One identity module and one URL resolver own provider identity; malformed deep links never reach a query, and the GitLab instance hint stays display-only while the server re-derives the instance.
  • Provider reads go through the providerReview procedures via pure normalizers; provider writes mirror the server's fingerprint fields, so field names carry the dedupe contract.
  • Provider merge results normalize onto the GitHub result shape, so the never-celebrate gate holds; every provider merge sends the head SHA fence.
  • Viewed files, recents, and pending-review drafts key on the collision-free provider ref; GitHub keeps its legacy storage bytes and runs no migration.
  • The expo-router fork patch ranks the static /merge sheet ahead of the catch-all identity route; universal links add ** tail rows before the GitHub row, and the AASA adds both provider paths.
  • Hermes lacks toSorted and toReversed; the diff replaces both with copy-then-sort or copy-then-reverse.
  • Open device finding: the new-session branch-unavailable guidance clips to an ellipsis (finding 1). E2E proof below is stack-wide, captured on the tip build.

E2E proof

[e1] shared GitLab link opens the provider review in-app — iOS simctl openurl https://app.kilo.ai/pr-review/gitlab/igor352/kilo-e2e-personal/1 handed off to Kilo; digest and e1-review-screen.png show Merge request !1, E2E review fixture, Overview/Files/Discussion.

e1-gitlab-handoff.mp4.trim.mp4

[checks-loading] GitLab MR Overview CHECKS loading skeleton then empty — prior/checks-frame-28.png

[checks-loading] GitLab MR Overview CHECKS loading skeleton then empty — prior/checks-frame-29.png

[e2] ux-check: New session GitHub branch row + transcript images — prior/e2-load-img.png

[e1] needs:seed GitLab inline comment creates a real diff thread: from a seeded connected GitLab account, open PR Review, tap the open merge request, open Files, open a changed file, tap the line's… — prior/e1-expand-file.png

[e3] ux-check: Bitbucket in personal context: new-session Bitbucket card states organizations-only; opening a Bitbucket PR link shows the org-only explanation with no retry; selecting an organization… — prior/e3-personal-bitbucket-card.png

E2E proof — log excerpts

[e1] ux-check: Merge with a moved head on the provider -> pass :: Live providerReview.mergePullRequest on igor352/kilo-e2e-personal!1 with expectedHeadSha 0oldsha returned mergePullRequest-stale status=409 CONFLICT message The merge request changed since it was loaded. Reload the merge request and try again.; getPullRequest-after stayed state-after=open headSha-after=cec7e53fc74c7b8e5f9a150f244bd09ad5cbe92c with no merge. Web has no merge sheet.
/Users/igor/.local/share/kwf/sections/bring-mobile-gitlab-and-bitb-3792/e2e-web/e1-stale-head.log
after-goto url=http://localhost:6700/users/sign_in?fakeUser=e2e-mobile-bring-mobile-gitlab-and-bitb-3792-ios%40example.com&callbackPath=%2Fprofile
no signed-in path; url=http://192.168.1.10:6700/users/sign_in?callbackPath=%2Faccount-verification
<redacted>
listInbox status=200
listInbox body={"result":{"data":{"items":[{"ref":{"platform":"gitlab","projectPath":"igor352/kilo-e2e-personal","mrIid":1,"instanceHint":"https://gitlab.com"},"title":"E2E review fixture","author":{"
listInbox count=1
using projectPath=igor352/kilo-e2e-personal mrIid=1
getPullRequest-before status=200
getPullRequest-before body={"result":{"data":{"ref":{"platform":"gitlab","projectPath":"igor352/kilo-e2e-personal","mrIid":1,"instanceHint":"https://gitlab.com"},"title":"E2E review fixture","body":"F
headSha=cec7e53fc74c7b8e5f9a150f244bd09ad5cbe92c state=open
mergePullRequest-stale status=409
mergePullRequest-stale body={"error":{"message":"The merge request changed since it was loaded. Reload the merge request and try again.","code":-32009,"data":{"code":"CONFLICT","httpStatus":409,"stack
hasStaleReason=true hasConflictMarker=true
getPullRequest-after status=200
getPullRequest-after body={"result":{"data":{"ref":{"platform":"gitlab","projectPath":"igor352/kilo-e2e-personal","mrIid":1,"instanceHint":"https://gitlab.com"},"title":"E2E review fixture","body":"Fi
state-after=open headSha-after=cec7e53fc74c7b8e5f9a150f244bd09ad5cbe92c
Owner request for the stack

Deliver the work described below as reviewed, CI-green pull requests assigned to @iscekic. Do not merge them. Prove the behaviour on a live build, not with mocks alone. Prefer an existing component, library, or contract over a new one. Do not weaken an existing permission, authorization, or access check. The only text size that matters is the default size. Do not test larger text or themes.

Bring mobile GitLab and Bitbucket up to the level of the existing GitHub workflows. Do not regress GitHub.

Support:

  • GitLab in Personal and organization contexts, including existing self-managed instances with their real host and full nested project path.
  • Bitbucket Cloud in organization context only, with an understandable state in Personal context.

The whole workflow, per provider:

  • Connect, and reach a usable workflow from the integration status entry point.
  • Discover and select a repository. Get the default branch from that provider. Select a branch.
  • Send the selected branch into the real session checkout, not only the payload.
  • Launch an agent with the existing managed server-side credentials.
  • Open an inbox and a detail view of pull or merge requests.
  • Show files, diffs, expanded context where supported, discussions, build or check state, and merge restrictions.
  • Comment, hold inline discussions, and take the supported review and merge actions.
  • Express auto-merge and review-status differences as explicit capabilities.
  • Open a session-linked review, a pasted URL, a shared link, a deep link, and a notification in the app.
  • Use the provider's own wording: pull request or merge request.

Identity rules:

  • Carry provider, owner, integration, instance, and repository identity through discovery, selection, pagination, and navigation.
  • Two same-named repositories must never cross a provider, owner, integration, or instance boundary.
  • A repository or owner change must drop an incompatible selected branch.
  • A stale revision or a moved head must never redirect a comment or a merge.
  • Caches, recents, drafts, pending comments, and retry keys must not collide across providers.
  • Derive credentials and host identity on the server. Never trust a client-supplied host or owner.
  • An unsupported action needs a clear explanation. Missing code is not a reason to call a requested feature unsupported.

Reuse one mobile presentation. Do not copy the GitHub screen tree per provider. Use disposable, authorized fixtures for merge and write evidence.

Verification protocol:

  • The current build's static gate is the only source of current failure truth. Run the static gate (surface typechecks plus the Vitest/Jest run over the changed and sibling test files) on the current tree first, repair its actual failures, and only then start fresh device verification.
  • A device-repair task may only be created from a device verdict produced against the current build; verdict files are archived before each round so a stored verdict never outlives the build it describes. The earlier vr3 and vr4 device-repair tasks are superseded: no device verifier ran in the 16:31 and 16:49 rounds, and their device-failure premise is void.
  • Changes made solely to work around obsolete device evidence are undone unless current evidence independently requires them. This removes vr4's uncommitted credential-service transport-retry workaround (git-token-service-request.ts, git-token-service-request.test.ts, and the user-token-client.ts / credential-broker-client.ts call-site changes). All legitimate provider work already delivered stays.
  • Historical evidence — the .toSorted failures, the Page-not-found state, and the credential-service outage — is not a current failure unless it reproduces on the current build.

PR stack (merge bottom to top)

This was referenced Sep 9, 2026
@kilo-code-bot

kilo-code-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 2
SUGGESTION 1
Issue Details (click to expand)

CRITICAL

File Line Issue
apps/mobile/src/app/(app)/pr-review/[platform]/[...identity]/_layout.tsx 116 Provider stack never registers index

WARNING

File Line Issue
patches/expo-router@57.0.15.patch 1 Patch newly deletes ExpoRouterModule.kt
apps/mobile/src/lib/pr-review/use-provider-inbox.ts 241 GitHub inbox always queried when unconnected

SUGGESTION

File Line Issue
apps/mobile/src/app/(app)/agent-chat/repo-picker.tsx 201 Bitbucket org-only note keyed on section
Files Reviewed (4 files)
  • apps/mobile/src/app/(app)/pr-review/[platform]/[...identity]/_layout.tsx - 1 issue
  • patches/expo-router@57.0.15.patch - 1 issue
  • apps/mobile/src/lib/pr-review/use-provider-inbox.ts - 1 issue
  • apps/mobile/src/app/(app)/agent-chat/repo-picker.tsx - 1 issue

Fix these issues in Kilo Cloud

Previous Review Summary (commit 35421e1)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 35421e1)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • apps/mobile/src/lib/intl-cache-hermes-surface.test.ts

Reviewed by grok-4.6 · Input: 433.4K · Output: 29.5K · Cached: 1.8M

Review guidance: REVIEW.md from base branch kwf/bring-mobile-gitlab-and-bitb-3792-l1

@iscekic
iscekic marked this pull request as draft September 9, 2026 17:32
@iscekic iscekic changed the title feat(mobile): bring GitLab and Bitbucket pull request review to GitHub parity test(mobile): raise the Hermes Intl surface guard timeout to 30s (part 2/2) Sep 9, 2026
@iscekic
iscekic changed the base branch from kwf/bring-mobile-gitlab-and-bitb-3792-l29 to kwf/bring-mobile-gitlab-and-bitb-3792-l1 September 9, 2026 18:13
@iscekic
iscekic added this pull request to stack #6022 September 9, 2026 18:13
@iscekic
iscekic force-pushed the kwf/bring-mobile-gitlab-and-bitb-3792-l30 branch from 35421e1 to fc000dc Compare September 9, 2026 18:58
@iscekic iscekic changed the title test(mobile): raise the Hermes Intl surface guard timeout to 30s (part 2/2) feat(mobile): bring GitLab and Bitbucket code review up to the GitHub workflow (part 2/2) Sep 9, 2026
@iscekic
iscekic force-pushed the kwf/bring-mobile-gitlab-and-bitb-3792-l30 branch from 8d3940d to 2c804a5 Compare September 10, 2026 01:35
@iscekic
iscekic marked this pull request as ready for review September 10, 2026 01:49
{/* The three write sheets (s6) are siblings of the GitHub route's
sheets: they mount inside this layout, so they see the provider
scope and this PR's single `PendingReviewProvider` queue. */}
<Stack.Screen name="comment-composer" options={sheetOptions} />

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.

CRITICAL: Provider stack never registers index, so GitLab/Bitbucket reviews open the comment composer

The GitHub sibling layout registers index first because unregistered routes sort after registered ones — without that, the initial screen is the comment-composer formSheet. This layout only registers the four sheets, so navigating to a provider PR/MR (inbox, badge, paste, deep link) can present the composer instead of the overview.

Register <Stack.Screen name="index" /> before the sheet screens, matching apps/mobile/src/app/(app)/pr-review/[owner]/[repo]/[number]/_layout.tsx.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@@ -1,4 +1,36 @@
diff --git a/android/src/main/java/expo/modules/router/ExpoRouterModule.kt b/android/src/main/java/expo/modules/router/ExpoRouterModule.kt

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.

WARNING: Patch newly deletes ExpoRouterModule.kt with a truncated diff header

This deletion is not in the base patch. There is no ---/+++ hunk, so apply may fail the whole patch (losing the catch-all ranking fork and the existing linking fix) or delete Expo Router's Android native module. Keep the getStateFromPath-forks.js ranking fork; drop the Kotlin deletion header.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

const gitlabStatus = useGitLabStatus(scope);
const bitbucketReadiness = useBitbucketReadiness(scope);

const github = usePrInbox(enabled);

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.

WARNING: GitHub inbox is always queried, so an unconnected GitHub account poisons the merged list

GitLab and Bitbucket are gated on connected === true. GitHub is not: usePrInbox(enabled) always runs. githubPrReview.listInbox throws PRECONDITION_FAILED when there is no user token. The entry route is a connect-gate pass-through so GitLab-only users can paste links.

When GitLab has rows, GitHub's first-page error becomes laterPageError and the footer shows "couldn't load more" forever. When GitLab is also disconnected, allFailed is true and the empty state is the GitHub reconnect notice.

Gate GitHub the same way as the other providers (treat not-connected as enabled: false, not an error).


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

if (search.trim() || !bridge) {
return null;
}
if (bridge.sections.some(section => section.key === 'bitbucket')) {

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.

SUGGESTION: Org-only Bitbucket note is keyed on a provider section, so recents-only Bitbucket still shows it

buildRepoSections only emits key: 'bitbucket' for non-recent Bitbucket rows. An org whose Bitbucket repos all sit under Recently used has no bitbucket section, so this still renders "Bitbucket is available for organizations only" under real Bitbucket recents. The same predicate fires in an org with zero Bitbucket rows.

Suppress the note when any listed row (including recents) is Bitbucket, or when the session already has an organization.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@iscekic
iscekic marked this pull request as draft September 10, 2026 02:11
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