-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Problem
Heroshot currently detects which issue a cluster is working on by parsing logs:
// heroshot/src/zeroshot.ts
export function getIssueMarkerFromCluster(clusterId: string): number | null {
const out = runZeroshot(['logs', clusterId, '-n', '200']);
const m = out.match(/# GitHub Issue #(\d+)/);
if (!m) return null;
return Number(m[1]);
}This is fragile, slow, and unnecessary - zeroshot already has the issue number, it just doesn't persist it.
Root Cause
The issue number is already available at cluster start:
// orchestrator.js:784
inputData = await provider.fetchIssue(input.issue, settings);
// inputData.number = 1157 <-- WE HAVE IT
// orchestrator.js:873 - Published to message bus
topic: 'ISSUE_OPENED',
content: { data: { issue_number: inputData.number } }But _saveClusters() doesn't persist it to clusters.json, and listClusters() doesn't return it.
Solution
Store inputData.number in cluster state (like autoPr and modelOverride).
Changes Required (~15 lines)
1. Store issue in cluster object (orchestrator.js, in startCluster):
// After line 766
cluster.issue = inputData?.number || null;2. Persist to clusters.json (orchestrator.js, in _saveClusters):
existingClusters[clusterId] = {
// ... existing fields ...
autoPr: cluster.autoPr || false,
modelOverride: cluster.modelOverride || null,
issue: cluster.issue || null, // ADD THIS
};3. Include in listClusters output (orchestrator.js):
return {
id: cluster.id,
state: state,
createdAt: cluster.createdAt,
issue: cluster.issue || null, // ADD THIS
agentCount: cluster.agents.length,
messageCount: cluster.messageBus.getAll(cluster.id).length,
};4. Load on resume (orchestrator.js, in _loadSingleCluster):
cluster.issue = clusterData.issue || null;No New CLI Flag Needed
Originally proposed - not needed. The issue number comes from the input (--issue <number> flagcovibes/covibes#1157), which is already parsed by the issue provider.
Acceptance Criteria
-
cluster.issueset frominputData.numberat start - Issue number persisted to
clusters.json -
zeroshot list --jsonincludesissuefield - Issue survives cluster restart/resume
- Works for all input types (GitHub URL, org/repo#123, bare number)
- Text/file inputs have
issue: null
Related
- heroshot/heroshot#3 - Blocked by this for proper cluster detection (can remove log parsing after this ships)