Skip to content

Commit b0b24bc

Browse files
fix(server): preserve repository URL provenance on thread links
1 parent 3b532ca commit b0b24bc

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/Orchestrator.ts‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ function legacyPullRequestLink(
569569
linkedAt: DateTime.formatIso(now),
570570
snapshot: null,
571571
stack: null,
572+
...(existing?.repositoryWebUrl !== undefined && {
573+
repositoryWebUrl: existing.repositoryWebUrl,
574+
}),
572575
...(existing?.endedWatch && { endedWatch: existing.endedWatch }),
573576
},
574577
existing?.watch,
@@ -3065,10 +3068,20 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
30653068
command.source !== "stack-dismissed";
30663069
if (existing && !undismisses) return thread;
30673070
const link = existing
3068-
? { ...existing, source: command.source, url: command.url }
3071+
? {
3072+
...existing,
3073+
source: command.source,
3074+
url: command.url,
3075+
...(command.repositoryWebUrl !== undefined && {
3076+
repositoryWebUrl: command.repositoryWebUrl,
3077+
}),
3078+
}
30693079
: {
30703080
...key,
30713081
url: command.url,
3082+
...(command.repositoryWebUrl !== undefined && {
3083+
repositoryWebUrl: command.repositoryWebUrl,
3084+
}),
30723085
source: command.source,
30733086
linkedAt: DateTime.formatIso(now),
30743087
snapshot: null,
@@ -3162,6 +3175,11 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
31623175
{
31633176
...key,
31643177
url: command.link.url,
3178+
...((command.link.repositoryWebUrl ?? dismissed?.repositoryWebUrl) !==
3179+
undefined && {
3180+
repositoryWebUrl:
3181+
command.link.repositoryWebUrl ?? dismissed?.repositoryWebUrl,
3182+
}),
31653183
source: command.link.source,
31663184
linkedAt: startedAt,
31673185
snapshot: null,

‎packages/contracts/src/orchestrationV2.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2688,6 +2688,7 @@ export const OrchestrationV2Command = Schema.Union([
26882688
...ThreadPullRequestKey.fields,
26892689
url: TrimmedNonEmptyString,
26902690
source: ThreadPullRequestLinkSource,
2691+
repositoryWebUrl: Schema.optional(TrimmedNonEmptyString),
26912692
}),
26922693
Schema.Struct({
26932694
type: Schema.Literal("thread.pull-request.unlink"),
@@ -2710,7 +2711,11 @@ export const OrchestrationV2Command = Schema.Union([
27102711
...ThreadPullRequestKey.fields,
27112712
watching: Schema.Boolean,
27122713
link: Schema.optional(
2713-
Schema.Struct({ url: TrimmedNonEmptyString, source: ThreadPullRequestLinkSource }),
2714+
Schema.Struct({
2715+
url: TrimmedNonEmptyString,
2716+
source: ThreadPullRequestLinkSource,
2717+
repositoryWebUrl: Schema.optional(TrimmedNonEmptyString),
2718+
}),
27142719
),
27152720
}),
27162721
Schema.Struct({

‎packages/contracts/src/threadPullRequest.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ export type ThreadPullRequestWatch = typeof ThreadPullRequestWatch.Type;
101101
export const ThreadPullRequestLink = Schema.Struct({
102102
...ThreadPullRequestKey.fields,
103103
url: TrimmedNonEmptyString,
104+
/** An actual browser or clone URL; older agent display URLs may be synthesized. */
105+
repositoryWebUrl: Schema.optional(TrimmedNonEmptyString),
104106
source: ThreadPullRequestLinkSource,
105107
linkedAt: IsoDateTime,
106108
snapshot: Schema.NullOr(ThreadPullRequestSnapshot),

0 commit comments

Comments
 (0)