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

address review (claude): make detectForgeIssues author-filter fallback symmetric with the prompt-block resolver

[._.]/ Adam Eivy92863c5d6f16
diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.js
index 75891489ec..95ccd9cb5d 100644
--- a/server/services/perpetualWork.js
+++ b/server/services/perpetualWork.js
@@ -209,16 +209,21 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self' } =
if (!repoPath) return { actionable: false, count: 0, reason: 'no-repo-path' };
const args = [...cfg.listArgs];
- if (issueAuthorFilter === 'self') {
- const { author, error } = await cfg.resolveSelf(repoPath);
- // Transient: skip this dispatch and retry next tick rather than parking a full cadence.
- if (error) return { actionable: false, count: 0, reason: error, transient: true };
- args.push('--author', author);
- } else if (issueAuthorFilter !== 'any') {
+ // Resolve the author filter symmetrically with resolveIssueAuthorFilterBlock:
+ // 'any' = no filter; 'owner' = repo/project owner; everything else (the 'self'
+ // default plus any out-of-vocab value) = the @me security boundary. Transient
+ // resolver failures skip this dispatch and retry next tick rather than parking
+ // a full cadence.
+ if (issueAuthorFilter === 'any') {
+ // no --author filter
+ } else if (issueAuthorFilter === 'owner') {
const { owner, error } = await cfg.resolveOwner(repoPath);
- // Transient: skip this dispatch and retry next tick rather than parking a full cadence.
if (error) return { actionable: false, count: 0, reason: error, transient: true };
args.push('--author', owner);
+ } else {
+ const { author, error } = await cfg.resolveSelf(repoPath);
+ if (error) return { actionable: false, count: 0, reason: error, transient: true };
+ args.push('--author', author);
}
const res = await runCli(cfg.cli, args, repoPath);
diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.js
index d22d316bf6..0c73e3fa0a 100644
--- a/server/services/perpetualWork.test.js
+++ b/server/services/perpetualWork.test.js
@@ -183,6 +183,21 @@ describe('perpetualWork', () => {
// No `gh repo view` owner lookup is needed in self mode.
expect(spawn.mock.calls.some(([cmd, args]) => cmd === 'gh' && args[0] === 'repo')).toBe(false);
});
+
+ it('an out-of-vocab filter value collapses to the @me self boundary (safe default)', async () => {
+ // Defense-in-depth: callers feed sanitizeTaskMetadata-constrained values,
+ // but if an unknown one ever reaches here it must fall to the @me security
+ // boundary (matching resolveIssueAuthorFilterBlock), never to owner/any.
+ routeSpawn({
+ 'gh issue': { stdout: JSON.stringify([{ number: 1, title: 'mine', assignees: [], labels: [] }]) },
+ 'git branch': { stdout: 'main\n' },
+ 'gh pr': { stdout: '' }
+ });
+ const out = await detectGithubIssues(app, { issueAuthorFilter: 'bogus' });
+ expect(out.actionable).toBe(true);
+ const listCall = spawn.mock.calls.find(([cmd, args]) => cmd === 'gh' && args[0] === 'issue');
+ expect(listCall[1]).toContain('@me');
+ });
});
describe('detectGitlabIssues (spawn-mocked)', () => {