Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: keep the transient-probe streak helpers module-private (#9182)

[._.]/ Adam Eivy7533374cb125
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index d79da23d2e..bbdbb7a7ed 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -2121,7 +2121,7 @@ const transientStreakKey = (taskType, appId) => `${taskType}:${appId || 'global'
*
* @returns {number} the new consecutive-transient count.
*/
-export function noteTransientProbe(taskType, appId) {
+function noteTransientProbe(taskType, appId) {
const key = transientStreakKey(taskType, appId);
const count = (transientStreaks.get(key) || 0) + 1;
transientStreaks.set(key, count);
@@ -2129,7 +2129,7 @@ export function noteTransientProbe(taskType, appId) {
}
/** Reset the consecutive-transient streak — the probe stopped being transient. */
-export function clearTransientProbeStreak(taskType, appId) {
+function clearTransientProbeStreak(taskType, appId) {
transientStreaks.delete(transientStreakKey(taskType, appId));
}
diff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.js
index 86f1c163ef..e7ca32613b 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -76,8 +76,6 @@ import {
emitOnDemandEmpty,
applyOnDemandConsent,
isConfiguredApprovalRequired,
- noteTransientProbe,
- clearTransientProbeStreak,
PERPETUAL_TRANSIENT_ESCALATION_THRESHOLD,
buildJiraTicketTask,
buildClaimWorkTask,
@@ -1257,27 +1255,7 @@ describe('emitOnDemandEmpty', () => {
expect(ghHealth).not.toHaveBeenCalled();
});
- it('noteTransientProbe counts CONSECUTIVE transient probes for the same taskType+app', () => {
- expect(noteTransientProbe('claim-issue', 'app-streak')).toBe(1);
- expect(noteTransientProbe('claim-issue', 'app-streak')).toBe(2);
- expect(noteTransientProbe('claim-issue', 'app-streak')).toBe(3);
- expect(noteTransientProbe('claim-issue', 'app-streak')).toBe(4);
- });
-
- it('clearTransientProbeStreak restarts the count, so a recovered probe resets the escalation clock', () => {
- noteTransientProbe('claim-issue', 'app-streak-2');
- noteTransientProbe('claim-issue', 'app-streak-2');
- clearTransientProbeStreak('claim-issue', 'app-streak-2');
- expect(noteTransientProbe('claim-issue', 'app-streak-2')).toBe(1);
- });
-
- it('noteTransientProbe keys the streak by taskType+app, so one app never inherits another\'s count', () => {
- noteTransientProbe('claim-issue', 'app-streak-a');
- noteTransientProbe('claim-issue', 'app-streak-a');
- expect(noteTransientProbe('claim-issue', 'app-streak-b')).toBe(1);
- expect(noteTransientProbe('pr-watcher', 'app-streak-a')).toBe(1);
- });
-
+ // The streak counter itself is exercised through prepare in cosTaskGenerator.providerPin.test.js.
it('the escalation threshold is exported and applyPerpetualWorkGate levels its skip log against it, persisting a stall once escalated', () => {
const start = GEN_SRC.indexOf('async function applyPerpetualWorkGate');
const gate = GEN_SRC.slice(start, GEN_SRC.indexOf('\n}', start));