feat(ui): warn when the running worker predates the selected repo's merged HEAD
Stamps ClaudeDo.Worker's build with its exact git SHA (SourceRevisionId -> InformationalVersion) and exposes it via a new GetWorkerBuildInfo hub call. For the currently selected list, the shell compares that SHA against the list's git HEAD (GitService.IsAncestorAsync) and shows a persistent footer banner -- never auto-clearing, never shown on an unrelated repo or when the ancestry can't be determined -- so "verified against a merge" claims aren't silently made against a stale process. No auto-restart; the banner just offers the existing RestartWorkerCommand.
This commit is contained in:
@@ -35,4 +35,18 @@
|
||||
<InternalsVisibleTo Include="ClaudeDo.Worker.Tests" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Stamps this worker's exact commit into AssemblyInformationalVersion as "+{sha}" so a
|
||||
running instance can report which commit it was built from (see WorkerHub.GetWorkerBuildInfo).
|
||||
Independent of MinVer: MinVerVersionOverride (release builds) replaces the base version but
|
||||
doesn't touch SourceRevisionId, and the SDK appends it to InformationalVersion regardless. -->
|
||||
<Target Name="SetBuildRevisionFromGit" BeforeTargets="GetAssemblyVersion" Condition="'$(SourceRevisionId)' == ''">
|
||||
<Exec Command="git rev-parse HEAD"
|
||||
WorkingDirectory="$(MSBuildProjectDirectory)"
|
||||
ConsoleToMSBuild="true"
|
||||
StandardOutputImportance="low"
|
||||
ContinueOnError="WarnAndContinue">
|
||||
<Output TaskParameter="ConsoleOutput" PropertyName="SourceRevisionId" />
|
||||
</Exec>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -29,6 +29,10 @@ namespace ClaudeDo.Worker.Hub;
|
||||
|
||||
public record ActiveTaskDto(string Slot, string TaskId, DateTime StartedAt);
|
||||
|
||||
/// <summary>Git SHA the running worker was built from. Null when the build wasn't stamped
|
||||
/// (e.g. a local dev build without the SourceRevisionId target).</summary>
|
||||
public record WorkerBuildInfoDto(string? BuildSha);
|
||||
|
||||
public record AppSettingsDto(
|
||||
string DefaultClaudeInstructions,
|
||||
string DefaultModel,
|
||||
@@ -159,6 +163,20 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
private static readonly string Version =
|
||||
Assembly.GetExecutingAssembly().GetName().Version?.ToString(3) ?? "0.0.0";
|
||||
|
||||
// SourceRevisionId (set by ClaudeDo.Worker.csproj's git-rev-parse build target) is appended
|
||||
// by the SDK to InformationalVersion as "+{sha}" -- take the segment after the LAST '+' so
|
||||
// this stays correct even when MinVer's own pre-release metadata already contains a '+'.
|
||||
private static readonly string? BuildSha = ParseBuildSha(
|
||||
Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion);
|
||||
|
||||
internal static string? ParseBuildSha(string? informationalVersion)
|
||||
{
|
||||
if (string.IsNullOrEmpty(informationalVersion)) return null;
|
||||
var plusIndex = informationalVersion.LastIndexOf('+');
|
||||
if (plusIndex < 0 || plusIndex == informationalVersion.Length - 1) return null;
|
||||
return informationalVersion[(plusIndex + 1)..];
|
||||
}
|
||||
|
||||
private readonly QueueService _queue;
|
||||
private readonly IQueueWaker _waker;
|
||||
private readonly AgentFileService _agentService;
|
||||
@@ -325,6 +343,11 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
|
||||
public string Ping() => $"pong v{Version}";
|
||||
|
||||
/// <summary>Lets the UI detect a worker that's still running an older build than the code it's
|
||||
/// comparing against (e.g. a just-merged main) — a separate diagnostic rather than extending
|
||||
/// Ping's "pong vX.Y.Z" text, since that format isn't ours to break for any existing caller.</summary>
|
||||
public WorkerBuildInfoDto GetWorkerBuildInfo() => new(BuildSha);
|
||||
|
||||
public IReadOnlyList<ActiveTaskDto> GetActive()
|
||||
{
|
||||
return _queue.GetActive()
|
||||
|
||||
Reference in New Issue
Block a user