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

fix(cos): count skip causes on a null-prototype map so a cause named after an Object.prototype key is not corrupted

Adam Eivy1826ae50185a
diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.js
index 0f47ea7b9d..ae597b67f4 100644
--- a/server/services/perpetualWork.js
+++ b/server/services/perpetualWork.js
@@ -773,7 +773,10 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self', is
// bare "78 filtered". `inFlightCount` already accounts for the in-flight
// skips separately, so `in-flight` here is informational only — the counts
// sum to `total` only when the queue holds no malformed records.
- const skipCauses = {};
+ // Null-prototype: a configured exclude label named `constructor` (or any
+ // other Object.prototype key) must count as a cause, not inherit the
+ // inherited property and corrupt the counter.
+ const skipCauses = Object.create(null);
if (actionable.length === 0 && total > 0) {
for (const issue of issues) {
const cause = issueSkipCause(issue, inFlight, excludeSet, currentLogin);
diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.js
index 184f041afb..ddbedfdfa1 100644
--- a/server/services/perpetualWork.test.js
+++ b/server/services/perpetualWork.test.js
@@ -423,6 +423,22 @@ describe('perpetualWork', () => {
expect(out.skipCauses).toEqual({ 'needs-input': 1, assigned: 1, 'in-flight': 1, 'good first issue': 1 });
});
+ it('counts a cause named after an Object.prototype key (a configured exclude label named "constructor")', async () => {
+ routeSpawn({
+ 'gh issue': { stdout: JSON.stringify([
+ { number: 1, title: 'reserved', assignees: [], labels: [{ name: 'constructor' }] }
+ ]) },
+ 'git branch': { stdout: 'main\n' },
+ 'gh pr': { stdout: '' }
+ });
+ const out = await detectGithubIssues(app, { issueAuthorFilter: 'any', issueExcludeLabels: ['constructor'] });
+ expect(out).toMatchObject({ actionable: false, count: 0, reason: 'no-actionable-issues' });
+ // A plain-object counter would read the inherited `constructor` and
+ // produce a garbage string the formatter's Number.isFinite filter
+ // silently drops — the park would explain nothing.
+ expect(out.skipCauses).toEqual({ constructor: 1 });
+ });
+
it('keeps an issue assigned to the authenticated account claimable', async () => {
spawn.mockImplementation((cmd, args = []) => {
if (cmd === 'git' && args[0] === 'remote') return fakeChild('[email protected]:acme/widget.git\n');