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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: report no-authored-issues instead of no-open-issues when an author filter hides open issues
Adam Eivy9fa5413e7420
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 0baa4446ee..b1d27b42d8 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -36,6 +36,7 @@## Fixed+- **claim-issue no longer reports "no open issues" when an author filter is hiding a full queue.** The perpetual `claim-issue` / `claim-issue-gitlab` work-detector runs `gh`/`glab issue list` with an author filter (`self`→`@me`, or `owner`→the repo owner), and an empty *filtered* result was flattened to the reason `no-open-issues` — so a repo with open issues that simply don't match the filter parked for a full recheck cadence claiming there was nothing to do. The two failure modes this hid: `owner` resolves to an **org** (e.g. a GHE repo owned by a team), which is never an issue author, so the filter matches nothing; and `self`/`@me` is the wrong identity when the forge session differs from whoever filed the issues. The detector now re-probes without the author filter when the filtered list is empty, and if open issues exist it parks with a new `no-authored-issues` reason carrying the real open count. The on-demand "Run" toast now says *"open issues exist, but none match the author filter — set it to \"any\" (0 of N open)"* instead of the misleading "no open issues", pointing the user at the fix. A genuinely empty repo still reports `no-open-issues`, and the `any` filter is unaffected (no wasted re-probe). New private helper `countOpenIssuesUnfiltered`; covered by `perpetualWork.test.js` and `useOnDemandTaskToast.test.jsx`.- **Retry lazy route chunks before failing on flaky mobile networks.** Lazy-loaded pages fetch their JS chunk on demand, and on a weak cellular/Wi-Fi link that fetch can fail on a transient blip ("Importing a module script failed" on Safari, "Failed to fetch dynamically imported module" on Chrome) even though the chunk still exists — a page reload can't fix a network hiccup, so once the one-shot stale-chunk reload was spent for a build, the next blip stranded the user on the error screen. `lazyWithReload` now retries the dynamic import twice with a short backoff before treating the failure as terminal, so a transient mobile-network failure recovers silently without a jarring reload; a genuinely stale chunk (renamed by a rebuild) still 404s on each quick retry and falls through to the existing reload-once path. New `importWithRetry` helper with unit coverage.- **[issue-2643] De-flake the Wiki vault-default test under full-suite load.** `Wiki.test.jsx`'s "defaults to the first vault" (and the sibling "restores the selected vault") assertions checked `scanNotesVault` synchronously right after `await waitFor(...)` on the rendered vault id. That mock call is fired by a *separate* `useEffect` keyed on the selected vault, so the committed overview render can land before the passive effect flushes — reliably true in isolation, but on a CPU-saturated full client run the bare assertion raced ahead of the effect and failed (`expected vi.fn() to be called with arguments`). The two mock-call assertions now sit inside their own `waitFor`, awaiting the async side-effect instead of sampling it. Test-only change (no `test.retry` or timeout inflation) — no runtime behavior change.diff --git a/client/src/hooks/useOnDemandTaskToast.js b/client/src/hooks/useOnDemandTaskToast.jsindex eaf351ddf2..46a2dcb7ad 100644--- a/client/src/hooks/useOnDemandTaskToast.js+++ b/client/src/hooks/useOnDemandTaskToast.js@@ -11,6 +11,7 @@ import { formatLiReason } from '../utils/layeredIntelligenceReasons';const PARK_REASON_LABELS = {'no-actionable-issues': 'no claimable issues','no-open-issues': 'no open issues',+ 'no-authored-issues': 'open issues exist, but none match the author filter — set it to "any"','no-in-flight-branches': 'no branches in flight','no-zombie-issues': 'no stale issues to reconcile','no-actionable-plan-items': 'no unblocked PLAN items',diff --git a/client/src/hooks/useOnDemandTaskToast.test.jsx b/client/src/hooks/useOnDemandTaskToast.test.jsxindex e7055c38db..185efd07c7 100644--- a/client/src/hooks/useOnDemandTaskToast.test.jsx+++ b/client/src/hooks/useOnDemandTaskToast.test.jsx@@ -46,3 +46,36 @@ describe('useOnDemandTaskToast — idle outcome', () => {expect(toastSpy.mock.calls[0][0]).toMatch(/nothing to do right now/);});});++describe('useOnDemandTaskToast — parked outcome', () => {+ beforeEach(() => { handlers.clear(); toastSpy.mockClear(); });+ afterEach(cleanup);++ it('renders a bare "no open issues" when the repo is genuinely empty', () => {+ renderHook(() => useOnDemandTaskToast());+ fire({+ taskType: 'claim-issue', appName: 'aix-university', outcome: 'parked',+ parkReason: 'no-open-issues', counts: { open: 0, inFlight: 0, filtered: 0 },+ parkedUntil: new Date(Date.now() + 23 * 3600 * 1000).toISOString()+ });+ const [msg] = toastSpy.mock.calls[0];+ expect(msg).toMatch(/no open issues/);+ // open === 0 ⇒ no "(0 of N open)" breakdown.+ expect(msg).not.toMatch(/0 of/);+ });++ it('explains the author-filter trap (not "no open issues") when open issues exist but none match the filter', () => {+ renderHook(() => useOnDemandTaskToast());+ fire({+ taskType: 'claim-issue', appName: 'aix-university', outcome: 'parked',+ parkReason: 'no-authored-issues', counts: { open: 10, inFlight: 0, filtered: 10 },+ parkedUntil: new Date(Date.now() + 23 * 3600 * 1000).toISOString()+ });+ const [msg] = toastSpy.mock.calls[0];+ // The actionable reason + the real open count — NOT the misleading "no open issues".+ expect(msg).toMatch(/none match the author filter/);+ expect(msg).toMatch(/set it to "any"/);+ expect(msg).toMatch(/0 of 10 open/);+ expect(msg).not.toMatch(/re-checked now — no open issues/);+ });+});diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.jsindex 4f762e4c7d..2f9dbe0d96 100644--- a/server/services/perpetualWork.js+++ b/server/services/perpetualWork.js@@ -194,6 +194,27 @@ const FORGE_ISSUE_CONFIG = {}};+/**+ * Best-effort count of ALL open issues in a repo, ignoring the author filter.+ * Used to disambiguate an empty *author-filtered* list: a repo whose only open+ * issues were filed by someone else must not be reported as "no open issues".+ * Any probe failure (list error / bad JSON / non-array) returns 0 so the caller+ * falls back to the definitive `no-open-issues` result rather than inventing a+ * phantom count. Reuses `cfg.listArgs`, which is the base list WITHOUT the+ * `--author` filter (the filter is appended separately in detectForgeIssues).+ */+async function countOpenIssuesUnfiltered(cfg, repoPath) {+ const res = await runCli(cfg.cli, [...cfg.listArgs], repoPath);+ if (res.code !== 0) return 0;+ let raw;+ try {+ raw = JSON.parse(res.stdout || '[]');+ } catch {+ return 0;+ }+ return Array.isArray(raw) ? raw.length : 0;+}+/*** Shared claim-issue detector for both forges (config in FORGE_ISSUE_CONFIG).* Counts open issues that pass the same skip-list the claim agent applies,@@ -214,16 +235,19 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = '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.+ let authorApplied = false;if (issueAuthorFilter === 'any') {// no --author filter} else if (issueAuthorFilter === 'owner') {const { owner, error } = await cfg.resolveOwner(repoPath);if (error) return { actionable: false, count: 0, reason: error, transient: true };args.push('--author', owner);+ authorApplied = true;} else {const { author, error } = await cfg.resolveSelf(repoPath);if (error) return { actionable: false, count: 0, reason: error, transient: true };args.push('--author', author);+ authorApplied = true;}const res = await runCli(cfg.cli, args, repoPath);@@ -235,7 +259,33 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self' } =return { actionable: false, count: 0, reason: cfg.parseFail, transient: true };}if (!Array.isArray(raw)) return { actionable: false, count: 0, reason: cfg.parseFail, transient: true };- if (raw.length === 0) return { actionable: false, count: 0, total: 0, inFlightCount: 0, filteredCount: 0, reason: 'no-open-issues' };+ if (raw.length === 0) {+ // An empty *filtered* list is ambiguous: the repo may truly have no open+ // issues, OR it has open issues that just don't match the author filter —+ // the common trap being `owner`, which resolves to an ORG (never an issue+ // author, so the filter matches nothing), or `self`/@me when the server's+ // forge session is a different identity than whoever filed the issues.+ // Reporting a flat "no open issues" there hid a claimable queue behind a+ // full recheck park (the aix-university "10 open but parked" report).+ // Re-probe WITHOUT the author filter; if issues exist, park with the+ // actionable `no-authored-issues` reason + the real open count so the user+ // is told to widen the filter, not that there is nothing to do.+ if (authorApplied) {+ const openCount = await countOpenIssuesUnfiltered(cfg, repoPath);+ if (openCount > 0) {+ return {+ actionable: false,+ count: 0,+ total: openCount,+ inFlightCount: 0,+ filteredCount: openCount,+ reason: 'no-authored-issues',+ authorFilter: issueAuthorFilter+ };+ }+ }+ return { actionable: false, count: 0, total: 0, inFlightCount: 0, filteredCount: 0, reason: 'no-open-issues' };+ }const inFlight = await inFlightIssueNumbers(repoPath, cfg.inFlightForge);const issues = cfg.normalize(raw);diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.jsindex 3c027d74ef..9c0cf621c2 100644--- a/server/services/perpetualWork.test.js+++ b/server/services/perpetualWork.test.js@@ -185,6 +185,82 @@ describe('perpetualWork', () => {expect(out).toMatchObject({ actionable: false, reason: 'no-open-issues', total: 0, inFlightCount: 0 });});+ it('reports no-authored-issues (not no-open-issues) when the author filter hides an otherwise non-empty queue', async () => {+ // The author-filtered probe finds nothing (e.g. self/@me is the wrong forge+ // identity); the unfiltered re-probe sees 3 open. Must NOT flatten to+ // "no open issues" — surface the real count + the actionable reason.+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'gh' && args[0] === 'issue') {+ const filtered = args.includes('--author');+ return fakeChild(filtered ? '[]' : JSON.stringify([+ { number: 1, title: 'a', assignees: [], labels: [] },+ { number: 2, title: 'b', assignees: [], labels: [] },+ { number: 3, title: 'c', assignees: [], labels: [] }+ ]));+ }+ return fakeChild('');+ });+ const out = await detectGithubIssues(app, { issueAuthorFilter: 'self' });+ expect(out).toMatchObject({+ actionable: false, count: 0, total: 3, filteredCount: 3, inFlightCount: 0,+ reason: 'no-authored-issues', authorFilter: 'self'+ });+ // Exactly two `gh issue` calls: the filtered probe + the unfiltered re-probe.+ const issueCalls = spawn.mock.calls.filter(([cmd, a]) => cmd === 'gh' && a[0] === 'issue');+ expect(issueCalls.some(([, a]) => a.includes('--author'))).toBe(true);+ expect(issueCalls.some(([, a]) => !a.includes('--author'))).toBe(true);+ });++ it('owner filter that resolves to an org (never an issue author) reports no-authored-issues with the real open count', async () => {+ // The exact aix-university trap: `gh repo view` owner is the ORG, so+ // `--author <org>` matches nothing even though the repo has open issues.+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'gh' && args[0] === 'repo') return fakeChild('AcmeOrg\n'); // owner login → org+ if (cmd === 'gh' && args[0] === 'issue') {+ const filtered = args.includes('--author');+ return fakeChild(filtered ? '[]' : JSON.stringify([+ { number: 5, title: 'x', assignees: [], labels: [] }+ ]));+ }+ return fakeChild('');+ });+ const out = await detectGithubIssues(app, { issueAuthorFilter: 'owner' });+ expect(out).toMatchObject({ reason: 'no-authored-issues', total: 1, authorFilter: 'owner' });+ });++ it('still reports no-open-issues when the repo is genuinely empty under an author filter', async () => {+ // Both the filtered probe AND the unfiltered re-probe are empty → truly nothing.+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'gh' && args[0] === 'issue') return fakeChild('[]');+ return fakeChild('');+ });+ const out = await detectGithubIssues(app, { issueAuthorFilter: 'self' });+ expect(out).toMatchObject({ actionable: false, reason: 'no-open-issues', total: 0 });+ });++ it('does not run a fallback re-probe under the "any" filter (no author was applied)', async () => {+ let issueCalls = 0;+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'gh' && args[0] === 'issue') { issueCalls++; return fakeChild('[]'); }+ return fakeChild('');+ });+ const out = await detectGithubIssues(app, { issueAuthorFilter: 'any' });+ expect(out.reason).toBe('no-open-issues');+ expect(issueCalls).toBe(1); // no second, unfiltered probe+ });++ it('falls back to no-open-issues when the unfiltered re-probe itself fails (safe, not a phantom count)', async () => {+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'gh' && args[0] === 'issue') {+ if (args.includes('--author')) return fakeChild('[]', 0); // filtered: clean empty+ return fakeChild('', 1); // unfiltered re-probe errors+ }+ return fakeChild('');+ });+ const out = await detectGithubIssues(app, { issueAuthorFilter: 'self' });+ expect(out.reason).toBe('no-open-issues');+ });+it('reports a transient failure when gh exits non-zero', async () => {routeSpawn({ 'gh issue': { stdout: '', code: 1 } });const out = await detectGithubIssues(app, { issueAuthorFilter: 'any' });@@ -267,5 +343,18 @@ describe('perpetualWork', () => {const out = await detectGitlabIssues(app, { issueAuthorFilter: 'self' });expect(out).toMatchObject({ actionable: false, reason: 'glab-unavailable', transient: true });});++ it('self mode reports no-authored-issues when the author filter hides a non-empty queue', async () => {+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'glab' && args[0] === 'api') return fakeChild('octo\n'); // glab api user+ if (cmd === 'glab' && args[0] === 'issue') {+ const filtered = args.includes('--author');+ return fakeChild(filtered ? '[]' : JSON.stringify([{ iid: 10, title: 'x', assignees: [], labels: [] }]));+ }+ return fakeChild('');+ });+ const out = await detectGitlabIssues(app, { issueAuthorFilter: 'self' });+ expect(out).toMatchObject({ actionable: false, reason: 'no-authored-issues', total: 1, authorFilter: 'self' });+ });});});