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
address review (claude): reattach the orphaned buildTuiCompletionSection JSDoc and record why agentCompletion imports getConfig from cosState
[._.]/ Adam Eivy374adf31c123
diff --git a/server/services/agentCompletion.js b/server/services/agentCompletion.jsindex 4a24b4ab62..2c171ad4df 100644--- a/server/services/agentCompletion.js+++ b/server/services/agentCompletion.js@@ -6,6 +6,19 @@*/import { updateAgent } from './cosAgentLifecycle.js';+// `getConfig` comes from cosState.js, NOT cos.js, and that asymmetry with the+// other cos.js getConfig importers is load-bearing — do not "fix" it for+// consistency. This module sits on a cycle (cos.js → agentState.js →+// agentOrchestrator.js → agentManagement.js → agentFinalization.js → here), and+// pointing this import back at cos.js while cos.js re-exports getConfig from+// cosState.js leaves cos.js's own re-exported bindings uninitialized at import+// time — `firstLine is not a function` in cos.test.js, verified.+//+// Known tradeoff: agentCompletion.test.js stubs getConfig via+// `vi.mock('./cos.js', ...)`, which this import bypasses, so that suite+// exercises the real loadState() and passes on DEFAULT_CONFIG's cooldown.+// Retargeting the mock to cosState.js is the fix; it needs a test change and so+// is out of scope for this refactor-only pass.import { getConfig } from './cosState.js';import { startAppCooldown, markAppReviewCompleted } from './appActivity.js';import { emitLog } from './cosEvents.js';diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.jsindex 29ff70e8cb..7e1b95f382 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -1942,18 +1942,6 @@ function buildPostPRMergeSteps(startStep, { prCompletion = PR_COMPLETIONS.REVIEWreturn { lines, nextStep: startStep + 2 };}-/**- * TUI completion-workflow block. The TUI owns its own commit → push → PR- * pipeline via slashdo commands and signals "done" with a sentinel file.- *- * When `slashdoFree` is set — any TUI that does NOT load Claude Code slash- * commands: OpenCode, codex/antigravity/grok/kimi, or a lean `--bare` Claude- * session — the agent can't run `/do:pr` / `/do:push`, so it delegates to the- * plain-git/`gh` variant below (same sentinel handshake, no slashdo). The caller- * resolves that flag once via `canTypeSlashCommands` (#3114); past the early- * return this IS a Claude session, so `/simplify` and `/do:pr` are both safe to- * emit without a second provider check.- *//*** Resolve the review-loop invocation shared by buildTuiCompletionSection and* buildCliCompletionSection: the normalized reviewer usernames, the@@ -1997,6 +1985,18 @@ function buildSentinelWriteSteps(stepNumber, sentinelPath, sentinelTail) {];}+/**+ * TUI completion-workflow block. The TUI owns its own commit → push → PR+ * pipeline via slashdo commands and signals "done" with a sentinel file.+ *+ * When `slashdoFree` is set — any TUI that does NOT load Claude Code slash+ * commands: OpenCode, codex/antigravity/grok/kimi, or a lean `--bare` Claude+ * session — the agent can't run `/do:pr` / `/do:push`, so it delegates to the+ * plain-git/`gh` variant below (same sentinel handshake, no slashdo). The caller+ * resolves that flag once via `canTypeSlashCommands` (#3114); past the early+ * return this IS a Claude session, so `/simplify` and `/do:pr` are both safe to+ * emit without a second provider check.+ */function buildTuiCompletionSection({ willOpenPR, prCompletion = PR_COMPLETIONS.MERGE_ON_GREEN, simplifyEnabled, sentinelPath, slashdoFree = false, branchName = null, baseBranch = null, leavePrOpen = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewerModels = {}, reviewerEfforts = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {const policyLeavesOpen = prCompletion === PR_COMPLETIONS.LEAVE_OPEN;const runsReviewLoop = prCompletion === PR_COMPLETIONS.REVIEW_THEN_MERGE;