Summary
GitWorkspaceScanTool and GitWorkspaceDiscoveryTool swallow all errors silently and
produce no observable output — no log messages, no result summary, no per-run status on
the tool-relationship entity. When the tool does not discover repositories there is no
way to determine whether it ran, what it scanned, what it skipped, or why it produced no
results.
Missing diagnostics
No logger
Neither GitWorkspaceScanTool nor GitWorkspaceDiscoveryTool accepts an
ILogger / ILoggerFactory. All exception paths and intermediate states are invisible.
Swallowed exceptions with no trace
GitWorkspaceScanTool.GetLocalFixedDriveRoots:
catch (IOException)
{
return []; // no log; caller cannot tell drives failed to enumerate
}
GitWorkspaceScanTool.EnumerateGitRepositories:
catch (Exception exception) when (exception is IOException or UnauthorizedAccessException)
{
continue; // no log; unknown how many directories were skipped
}
GitWorkspaceDiscoveryTool.DiscoverGitWorktreePaths:
catch (Exception exception) when (exception is UnauthorizedAccessException or DirectoryNotFoundException or IOException)
{
continue; // same problem
}
GitWorkspaceDiscoveryTool.GetGitMetadata:
catch (RepositoryNotFoundException) { return new GitMetadata(); }
catch (LibGit2SharpException) { return new GitMetadata(); }
// both silent; no indication which repo failed LibGit2 open
WorkspaceToolExecutionResult carries no summary
WorkspaceToolExecutionResult has no fields for:
- Repos found / skipped counts
- Directories scanned
- Errors encountered
- Scan roots actually used
The caller (ScheduledToolHost) has no data to surface to the user or persist on the
entity.
tool-relationship entity not updated with run outcome
ScheduledToolHost stamps last-started before the run but never writes a
last-result, last-error, or repositories-found field back to the entity after
completion. There is no way to inspect the outcome of the last run without attaching a
debugger.
Proposed fixes
-
Inject ILogger<GitWorkspaceScanTool> (and similarly for
GitWorkspaceDiscoveryTool). Log:
Information: scan roots resolved, scan started/completed, repo count
Warning: drive enumeration failed, individual directory access denied (once per
root, not per directory to avoid log spam)
Error: data layer write failure
-
Add result fields to WorkspaceToolExecutionResult:
public int RepositoriesFound { get; init; }
public int DirectoriesSkipped { get; init; }
public IReadOnlyList<string> ScanRootsUsed { get; init; }
public string? ErrorSummary { get; init; }
-
Persist run outcome on tool-relationship entity. After each run,
ScheduledToolHost writes the result summary to fields such as
last-result-repositories-found, last-result-error so it is visible in the UI and
queryable from the database.
-
Surface scan roots actually used in the result so operators can confirm the tool
is scanning the expected paths.
Affected files
Phantom.Workspaces/Tools/GitWorkspaceScanTool.cs
Phantom.Workspaces/Tools/GitWorkspaceDiscoveryTool.cs
Phantom.Workspaces/ScheduledTools/ScheduledToolHost.cs
Phantom.Workspaces.Data.Core/JsonSchemas/tool-relationship.json
Summary
GitWorkspaceScanToolandGitWorkspaceDiscoveryToolswallow all errors silently andproduce no observable output — no log messages, no result summary, no per-run status on
the
tool-relationshipentity. When the tool does not discover repositories there is noway to determine whether it ran, what it scanned, what it skipped, or why it produced no
results.
Missing diagnostics
No logger
Neither
GitWorkspaceScanToolnorGitWorkspaceDiscoveryToolaccepts anILogger/ILoggerFactory. All exception paths and intermediate states are invisible.Swallowed exceptions with no trace
GitWorkspaceScanTool.GetLocalFixedDriveRoots:GitWorkspaceScanTool.EnumerateGitRepositories:GitWorkspaceDiscoveryTool.DiscoverGitWorktreePaths:GitWorkspaceDiscoveryTool.GetGitMetadata:WorkspaceToolExecutionResultcarries no summaryWorkspaceToolExecutionResulthas no fields for:The caller (
ScheduledToolHost) has no data to surface to the user or persist on theentity.
tool-relationshipentity not updated with run outcomeScheduledToolHoststampslast-startedbefore the run but never writes alast-result,last-error, orrepositories-foundfield back to the entity aftercompletion. There is no way to inspect the outcome of the last run without attaching a
debugger.
Proposed fixes
Inject
ILogger<GitWorkspaceScanTool>(and similarly forGitWorkspaceDiscoveryTool). Log:Information: scan roots resolved, scan started/completed, repo countWarning: drive enumeration failed, individual directory access denied (once perroot, not per directory to avoid log spam)
Error: data layer write failureAdd result fields to
WorkspaceToolExecutionResult:Persist run outcome on
tool-relationshipentity. After each run,ScheduledToolHostwrites the result summary to fields such aslast-result-repositories-found,last-result-errorso it is visible in the UI andqueryable from the database.
Surface scan roots actually used in the result so operators can confirm the tool
is scanning the expected paths.
Affected files
Phantom.Workspaces/Tools/GitWorkspaceScanTool.csPhantom.Workspaces/Tools/GitWorkspaceDiscoveryTool.csPhantom.Workspaces/ScheduledTools/ScheduledToolHost.csPhantom.Workspaces.Data.Core/JsonSchemas/tool-relationship.json