Skip to content

Commit 3155a68

Browse files
theo-learnerclaude
andcommitted
fix: show last tick suppressed count instead of cumulative history
Replace goal manager suppression badge (which grew unboundedly) with lastTickSuppressedCount — the number of candidates suppressed in the most recent tick. Stored in a module-level variable, exposed via the goal-manager API, and displayed in the dashboard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent eba648f commit 3155a68

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/app/api/goal-manager/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export async function GET(request: NextRequest) {
3535
dlq: state.dlq,
3636
candidates: state.candidates,
3737
suppression: state.suppression,
38+
lastTickSuppressedCount: state.lastTickSuppressedCount,
3839
});
3940
} catch (error) {
4041
const message = error instanceof Error ? error.message : 'Unknown error';

src/app/page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ interface GoalManagerStatusData {
274274
reasonCode: string;
275275
timestamp: string;
276276
}>;
277+
lastTickSuppressedCount?: number;
277278
}
278279

279280
interface RuntimeAutonomyPolicyData {
@@ -1700,7 +1701,7 @@ export default function Dashboard() {
17001701
</p>
17011702
<div className="flex items-center gap-2 text-[10px]">
17021703
<span className="bg-amber-100 text-amber-700 px-1.5 py-0.5 rounded font-bold">
1703-
suppression {goalManager?.suppression?.length || 0}
1704+
suppression {goalManager?.lastTickSuppressedCount ?? 0}
17041705
</span>
17051706
<span className="bg-red-100 text-red-700 px-1.5 py-0.5 rounded font-bold">
17061707
dlq {goalManager?.dlq?.length || 0}
@@ -1882,8 +1883,8 @@ export default function Dashboard() {
18821883
</button>
18831884
</div>
18841885

1885-
<p className="mt-2 text-[10px] text-gray-500">
1886-
planId: <span className="font-mono text-gray-700">{shortId(autonomousPlanId, 14)}</span> · operationId: <span className="font-mono text-gray-700">{shortId(autonomousOperationId, 14)}</span>
1886+
<p className="mt-2 text-[10px] text-gray-500 break-all">
1887+
planId: <span className="font-mono text-gray-700">{autonomousPlanId || '-'}</span> · operationId: <span className="font-mono text-gray-700">{autonomousOperationId || '-'}</span>
18871888
</p>
18881889
{autonomousPlanSteps && autonomousPlanSteps.length > 0 && (
18891890
<div className="mt-2 border border-gray-200 rounded-lg overflow-hidden">

src/lib/goal-manager.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import type { GoalDlqItem } from '@/types/goal-orchestrator';
2424
const DEFAULT_CANDIDATE_LIMIT = 6;
2525
const DEFAULT_QUEUE_LIMIT = 100;
2626

27+
/** Suppressed candidate count from the most recent tick (resets on process restart) */
28+
let _lastTickSuppressedCount = 0;
29+
2730
export interface GoalManagerConfig {
2831
enabled: boolean;
2932
dispatchEnabled: boolean;
@@ -179,6 +182,7 @@ export async function tickGoalManager(now: number = Date.now()): Promise<GoalMan
179182
});
180183
}
181184

185+
_lastTickSuppressedCount = prioritized.suppressed.length;
182186
await Promise.all(prioritized.queued.map((item) => store.upsertAutonomousGoalQueueItem(item)));
183187
await persistSuppressionRecords(prioritized.suppressed);
184188

@@ -204,6 +208,7 @@ export async function listGoalManagerState(limit: number = 50): Promise<{
204208
candidates: AutonomousGoalCandidate[];
205209
suppression: GoalSuppressionRecord[];
206210
dlq: GoalDlqItem[];
211+
lastTickSuppressedCount: number;
207212
}> {
208213
const safeLimit = Math.min(Math.max(limit, 1), 500);
209214
const store = getStore();
@@ -221,6 +226,7 @@ export async function listGoalManagerState(limit: number = 50): Promise<{
221226
candidates,
222227
suppression,
223228
dlq,
229+
lastTickSuppressedCount: _lastTickSuppressedCount,
224230
};
225231
}
226232

0 commit comments

Comments
 (0)