GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): refresh the current branch when opening the picker by UtkarshUsername · Pull Request #22807 · pingdotgg/t3code

fix(web): refresh the current branch when opening the picker #22807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Yash-Singh1 merged 5 commits into pingdotgg:main from UtkarshUsername:fix/refresh-branch-picker-on-open
Oct 25, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix(web): refresh the current branch when opening the picker #22807

Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit Hold shift + click to select a range
9ce36eb
fix(web): refresh the current branch when opening the picker
UtkarshUsername Oct 21, 2026
a1503cb
fix(server): default omitted local refresh options
UtkarshUsername Oct 21, 2026
67123a6
fix(server): clear stale remote status after local branch changes
UtkarshUsername Oct 21, 2026
6584e01
fix(server): retain cached remote fields in local refresh responses
UtkarshUsername Oct 21, 2026
8cf88b8
chore: merge main into branch picker refresh
UtkarshUsername Oct 25, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

113 changes: 113 additions & 0 deletions 113 apps/server/src/vcs/VcsStatusBroadcaster.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,119 @@ function layerBackgroundPolicy(shouldRunScopeWork: (scope: BackgroundScope) => b
}

describe("VcsStatusBroadcaster", () => {
it.effect("publishes a terminal branch switch without reading remote status", () => {
const state = {
currentLocalStatus: baseLocalStatus,
currentRemoteStatus: remoteStatusWithPr,
localStatusCalls: 0,
remoteStatusCalls: 0,
localInvalidationCalls: 0,
remoteInvalidationCalls: 0,
};

return Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
yield* broadcaster.getStatus({ cwd: "/repo" });
const subscribed = yield* Deferred.make<void>();
const events = yield* broadcaster.streamStatus({ cwd: "/repo", includeRemote: false }).pipe(
Stream.tap((event) =>
event._tag === "snapshot" ? Deferred.succeed(subscribed, undefined) : Effect.void,
),
Stream.take(2),
Stream.runCollect,
Effect.forkScoped,
);
yield* Deferred.await(subscribed);

state.currentLocalStatus = { ...baseLocalStatus, refName: "main" };
const refreshed = yield* broadcaster.refreshStatus("/repo", { localOnly: true });
assert.equal(refreshed.refName, "main");
assert.isNull(refreshed.pr);
assert.equal(state.localInvalidationCalls, 1);
assert.equal(state.remoteStatusCalls, 1);
assert.equal(state.remoteInvalidationCalls, 1);
assert.deepStrictEqual((yield* Fiber.join(events))[1], {
_tag: "snapshot",
local: state.currentLocalStatus,
remote: null,
});
assert.isNull((yield* broadcaster.getStatus({ cwd: "/repo" })).pr);
const snapshot = yield* broadcaster
.streamStatus({ cwd: "/repo", includeRemote: false })
.pipe(Stream.take(1), Stream.runCollect);
assert.deepStrictEqual(snapshot[0], {
_tag: "snapshot",
local: state.currentLocalStatus,
remote: null,
});
}).pipe(Effect.provide(layerTestFor(state)));
});

it.effect(
"preserves cached remote status when a local-only refresh stays on the same branch",
() => {
const state = {
currentLocalStatus: baseLocalStatus,
currentRemoteStatus: { ...remoteStatusWithPr, aheadCount: 2, behindCount: 3 },
localStatusCalls: 0,
remoteStatusCalls: 0,
localInvalidationCalls: 0,
remoteInvalidationCalls: 0,
};

return Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
const initial = yield* broadcaster.getStatus({ cwd: "/repo" });
const refreshed = yield* broadcaster.refreshStatus("/repo", { localOnly: true });
assert.deepStrictEqual(refreshed, initial);
assert.deepStrictEqual(yield* broadcaster.getStatus({ cwd: "/repo" }), refreshed);
assert.equal(state.localInvalidationCalls, 1);
assert.equal(state.remoteInvalidationCalls, 0);
assert.equal(state.remoteStatusCalls, 1);
}).pipe(Effect.provide(layerTestFor(state)));
},
);

it.effect("clears the previous branch's remote status after an in-flight PR refresh", () => {
const remoteReadStarted = Deferred.makeUnsafe<void>();
const releaseRemoteRead = Deferred.makeUnsafe<void>();
const state = {
currentLocalStatus: baseLocalStatus,
currentRemoteStatus: remoteStatusWithPr,
localStatusCalls: 0,
remoteStatusCalls: 0,
localInvalidationCalls: 0,
remoteInvalidationCalls: 0,
beforeRemoteStatus: Effect.void,
};

return Effect.gen(function* () {
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
yield* broadcaster.getStatus({ cwd: "/repo" });
state.beforeRemoteStatus = Deferred.succeed(remoteReadStarted, undefined).pipe(
Effect.andThen(Deferred.await(releaseRemoteRead)),
);
const remoteRefresh = yield* broadcaster
.refreshPullRequestStatus("/repo")
.pipe(Effect.forkScoped);
yield* Deferred.await(remoteReadStarted);
state.currentLocalStatus = { ...baseLocalStatus, refName: "main" };
const localRefresh = yield* broadcaster
.refreshStatus("/repo", { localOnly: true })
.pipe(Effect.forkScoped);
yield* Deferred.succeed(releaseRemoteRead, undefined);
yield* Fiber.join(remoteRefresh);
yield* Fiber.join(localRefresh);

const status = yield* broadcaster.getStatus({ cwd: "/repo" });
assert.equal(status.refName, "main");
assert.isNull(status.pr);
assert.equal(status.aheadCount, 0);
assert.equal(status.behindCount, 0);
assert.equal(state.remoteStatusCalls, 2);
}).pipe(Effect.provide(layerTestFor(state)));
});

it.effect.skipIf(!symlinksSupported)(
"automatically pulls an enabled clean default branch when status detects it is behind",
() => {
Expand Down
23 changes: 21 additions & 2 deletions 23 apps/server/src/vcs/VcsStatusBroadcaster.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ export class VcsStatusBroadcaster extends Context.Service<
readonly refreshLocalStatus: (
cwd: string,
) => Effect.Effect<VcsStatusLocalResult, GitManagerServiceError>;
readonly refreshStatus: (cwd: string) => Effect.Effect<VcsStatusResult, GitManagerServiceError>;
readonly refreshStatus: (
cwd: string,
options?: { readonly localOnly?: boolean },
) => Effect.Effect<VcsStatusResult, GitManagerServiceError>;
readonly refreshPullRequestStatus: (
cwd: string,
) => Effect.Effect<VcsStatusRemoteResult | null, GitManagerServiceError>;
Expand Down Expand Up @@ -507,8 +510,24 @@ export const make = Effect.gen(function* () {

const refreshStatus: VcsStatusBroadcaster["Service"]["refreshStatus"] = Effect.fn(
"VcsStatusBroadcaster.refreshStatus",
)(function* (rawCwd) {
)(function* (rawCwd, options) {
const cwd = yield* withFileSystem(normalizeCwd(rawCwd));
if (options?.localOnly) {
return yield* withRemoteWriteLock(
cwd,
Effect.gen(function* () {
yield* workflow.invalidateLocalStatus(cwd);
const local = yield* workflow.localStatus({ cwd });
const previous = yield* getCachedStatus(cwd);
if (previous?.local?.value.refName !== local.refName) {
yield* workflow.invalidateRemoteStatus(cwd);
return yield* updateCachedStatus(cwd, local, null, { publish: true });
}
yield* updateCachedLocalStatus(cwd, local, { publish: true });
return mergeGitStatusParts(local, previous?.remote?.value ?? null);
}),
);
}
// invalidateStatus (not the two partial invalidations) so an explicit
// refresh also bypasses GitManager's slow PR-lookup cache.
return yield* withRemoteWriteLock(
Expand Down
3 changes: 2 additions & 1 deletion 3 apps/server/src/ws.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2799,7 +2799,8 @@ export const layerWsRpc = (
worktreeSetupTracker
.cancel(input.threadId)
.pipe(Effect.map((cancelled) => ({ cancelled }))),
[WS_METHODS.vcsRefreshStatus]: (input) => vcsStatusBroadcaster.refreshStatus(input.cwd),
[WS_METHODS.vcsRefreshStatus]: (input) =>
vcsStatusBroadcaster.refreshStatus(input.cwd, { localOnly: input.localOnly ?? false }),
[WS_METHODS.vcsPull]: (input) =>
gitWorkflow.pullCurrentBranch(input.cwd).pipe(
Effect.matchCauseEffect({
Expand Down
6 changes: 6 additions & 0 deletions 6 apps/web/src/components/BranchToolbarBranchSelector.tsx
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export function BranchToolbarBranchSelector({
const switchRef = useAtomCommand(vcsEnvironment.switchRef, {
reportFailure: false,
});
const refreshStatus = useAtomCommand(vcsEnvironment.refreshStatus, {
reportFailure: false,
});
const createRefMutation = useAtomCommand(vcsEnvironment.createRef, {
reportFailure: false,
});
Expand Down Expand Up @@ -507,6 +510,9 @@ export function BranchToolbarBranchSelector({

const handleOpenChange = (open: boolean) => {
setIsBranchMenuOpen(open);
if (open && !isBranchMenuOpen && branchCwd !== null) {
void refreshStatus({ environmentId, input: { cwd: branchCwd, localOnly: true } });
}
if (!open) {
setBranchQuery("");
}
Expand Down
5 changes: 4 additions & 1 deletion 5 packages/contracts/src/rpc.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,10 @@ const WsVcsPullRpc = Rpc.make(WS_METHODS.vcsPull, {
});

const WsVcsRefreshStatusRpc = Rpc.make(WS_METHODS.vcsRefreshStatus, {
payload: VcsStatusInput,
payload: Schema.Struct({
...VcsStatusInput.fields,
localOnly: Schema.optional(Schema.Boolean),
}),
success: VcsStatusResult,
error: Schema.Union([GitManagerServiceError, EnvironmentAuthorizationError]),
});
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.