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: correct stale comments and the unnamed-app error in the goal-fidelity follow-up

[._.]/ Adam Eivyb6d6e327d6d6
diff --git a/server/lib/goalFidelityFollowUp.js b/server/lib/goalFidelityFollowUp.js
index 1bb6e5a57c..52f57050b3 100644
--- a/server/lib/goalFidelityFollowUp.js
+++ b/server/lib/goalFidelityFollowUp.js
@@ -216,11 +216,11 @@ const truncateTitle = (text, max) => (text.length > max
export function buildGoalFidelityIssue({ task, review, fingerprint }) {
const subject = firstLine(task?.description) || 'a CoS agent task';
const title = truncateTitle(`Goal-fidelity ${review?.verdict || 'finding'}: ${subject}`, GOAL_FIDELITY_ISSUE_LIMITS.titleChars);
- // The marker sits in the SECOND paragraph, not the last: a reader of this
- // issue gets it from a truncated body just as reliably as from a whole one,
- // and the open-issue fallback scan reads bodies the forge lister has already
- // capped at 8k. A marker parked at the bottom would drop out of exactly the
- // long issues most likely to be re-filed.
+ // The marker sits in the SECOND paragraph, not the last. The dedup reads it
+ // back out of a tracker listing, and a listing is free to cap the body it
+ // returns; a marker parked at the bottom would drop out of exactly the long
+ // issues most likely to be re-filed. It is also the first thing a human
+ // opening the issue needs, since it is what explains why the issue exists.
const body = truncate([
`A goal-fidelity review of a finished agent run returned **${review?.verdict}** — the change that shipped does not match what the task asked for.`,
`Filed automatically by the PortOS goal-fidelity review. Re-filing is suppressed while an issue carrying this key exists: \`${goalFidelityIssueMarker(fingerprint)}\``,
diff --git a/server/lib/textUtils.js b/server/lib/textUtils.js
index d156edc426..cd45594e76 100644
--- a/server/lib/textUtils.js
+++ b/server/lib/textUtils.js
@@ -180,17 +180,6 @@ export function escapeRegExp(value) {
return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
-/**
- * Lowercase + kebab-case a string, ASCII-only, collapsing runs of anything else
- * to a single `-` and trimming leading/trailing hyphens.
- *
- * Lives here, beside `escapeRegExp`, for the same reason: it was private to
- * `planIds.js` (PLAN.md `[slug]` ids) and the next caller that needed the same
- * transform — `normalizePlannerId`, which slugs a model id into a `planner:`
- * label — could only re-inline the regex chain. Non-string input returns the
- * empty string rather than being coerced, so a caller distinguishes "nothing to
- * slug" from a real slug without a separate guard.
- */
/**
* First non-empty line of a string, trimmed.
*
@@ -203,6 +192,17 @@ export function escapeRegExp(value) {
*/
export const firstLine = (text) => String(text ?? '').split('\n').map(line => line.trim()).find(Boolean) || '';
+/**
+ * Lowercase + kebab-case a string, ASCII-only, collapsing runs of anything else
+ * to a single `-` and trimming leading/trailing hyphens.
+ *
+ * Lives here, beside `escapeRegExp`, for the same reason: it was private to
+ * `planIds.js` (PLAN.md `[slug]` ids) and the next caller that needed the same
+ * transform — `normalizePlannerId`, which slugs a model id into a `planner:`
+ * label — could only re-inline the regex chain. Non-string input returns the
+ * empty string rather than being coerced, so a caller distinguishes "nothing to
+ * slug" from a real slug without a separate guard.
+ */
export function kebabCase(text) {
if (typeof text !== 'string') return '';
return text
diff --git a/server/services/goalFidelityFollowUp.js b/server/services/goalFidelityFollowUp.js
index 7f906acdb8..aa41f5f0c6 100644
--- a/server/services/goalFidelityFollowUp.js
+++ b/server/services/goalFidelityFollowUp.js
@@ -22,15 +22,17 @@
*
* DUPLICATE SUPPRESSION is the load-bearing part, because the producer is a
* scheduled unattended loop: a perpetual task that keeps drifting the same way
- * would otherwise file the same issue every cadence, forever. Three guards, all
+ * would otherwise file the same issue every cadence, forever. Two guards, both
* keyed on the one fingerprint `lib/goalFidelityFollowUp.js` derives:
*
- * 1. an all-states marker search on the tracker, so a CLOSED issue for the
- * same finding is not re-filed;
- * 2. an open-issue rescan, because forge full-text indexes lag by minutes and
- * two runs of the same schedule inside that window are ordinary;
- * 3. the shared investigation-task fingerprint dedup + circuit breaker on the
- * queued task, via `fileInvestigationTask`.
+ * 1. the issue side lists this feature's own marker LABEL across every issue
+ * STATE and reads the fingerprint back out of the rows. A label is a direct
+ * field filter — no index lag (a full-text search has minutes of it on both
+ * GitHub and JIRA, which is exactly when a schedule re-runs), every state
+ * (so an issue a human CLOSED is not re-filed), and a page bounded by our
+ * own issues rather than by the repo's whole backlog;
+ * 2. the queued task goes through `fileInvestigationTask`, inheriting the
+ * shared fingerprint dedup, circuit breaker, and loop policy.
*
* FAIL-CLOSED on the issue side, on purpose and against the usual convention: a
* tracker we could not read is NOT "nothing is filed". That is exactly how a
@@ -273,7 +275,10 @@ function trackerRefusal({ app, target, tracker }) {
*/
async function fileFollowUpIssue({ task, review, fingerprint }) {
const app = await resolveFollowUpRepo(task);
- if (!app) return { issue: null, error: `app '${task?.metadata?.app}' has no configured repository` };
+ // Named, not interpolated blind: a task with no `metadata.app` is PortOS's
+ // own work, and `app 'undefined' has no configured repository` is not a
+ // sentence anyone can act on.
+ if (!app) return { issue: null, error: `app '${task?.metadata?.app || PORTOS_APP_ID}' has no configured repository` };
const { tracker, target } = await resolveAppForgeTarget(app).catch(() => ({ tracker: null, target: null }));
const refusal = trackerRefusal({ app, target, tracker });