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

refactor: name the provider label once and let the posture block own its category

[._.]/ Adam Eivy56b15bfb6dfa
diff --git a/server/lib/providerVendors.js b/server/lib/providerVendors.js
index af2d1740f2..708d81edc0 100644
--- a/server/lib/providerVendors.js
+++ b/server/lib/providerVendors.js
@@ -629,6 +629,11 @@ export function buildVendorCliArgs(provider, baseArgs, { model, effort }) {
return vendor.cliArgs(baseArgs, { model, effort, provider });
}
+/** How a provider names itself in an error a user has to act on. */
+function providerLabel(provider) {
+ return provider?.id || provider?.command || 'unknown';
+}
+
/**
* `buildCliSpawnConfig` (agentCliSpawning.js): full `{ command, args,
* stdinMode, streamFormat? }` shape per vendor. Requires `spawnArgs` to be
@@ -641,7 +646,7 @@ export function buildVendorSpawnConfig(provider, ctx) {
if (posture) {
const recipe = publicReviewRecipe(provider, posture);
if (!recipe) {
- throw new Error(`Provider '${provider?.id || provider?.command || 'unknown'}' has no enforced ${posture} public-review posture`);
+ throw new Error(`Provider '${providerLabel(provider)}' has no enforced ${posture} public-review posture`);
}
return recipe.spawnArgs(provider, ctx);
}
@@ -695,7 +700,7 @@ export function publicReviewProviderBlock(provider, posture, { tui = false } = {
if (!posture) return null;
if (supportsPublicReviewPosture(provider, posture, { tui })) return null;
return {
- reason: `Provider '${provider?.id || provider?.command || 'unknown'}' has no enforced ${posture} public-content review mode`,
+ reason: `Provider '${providerLabel(provider)}' has no enforced ${posture} public-content review mode`,
category: posture === PUBLIC_REVIEW_ACTIONS_POSTURE
? 'public-review-actions-provider-unsupported'
: 'public-review-provider-unsupported',
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index 9cc83188f4..c0a33fd070 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -467,13 +467,13 @@ async function runAgentSpawn(task) {
// so an ordinary task (posture `null`) passes straight through (#5830).
const postureBlock = publicReviewProviderBlock(provider, publicReviewPosture, { tui: isTui });
if (postureBlock) {
- const { reason } = postureBlock;
+ const { reason, category } = postureBlock;
await updateTask(task.id, {
status: 'blocked',
metadata: {
...task.metadata,
blockedReason: reason,
- blockedCategory: postureBlock.category,
+ blockedCategory: category,
blockedAt: new Date().toISOString(),
},
}, task.taskType || 'user').catch(() => {});
diff --git a/server/services/agentLifecycle.test.js b/server/services/agentLifecycle.test.js
index 41fc86c045..3cfd802331 100644
--- a/server/services/agentLifecycle.test.js
+++ b/server/services/agentLifecycle.test.js
@@ -330,7 +330,8 @@ describe('agentLifecycle — guard wiring', () => {
it('asks the posture helper for the provider gate rather than re-deriving it', () => {
expect(AGENT_LIFECYCLE_SRC).toContain('const postureBlock = publicReviewProviderBlock(provider, publicReviewPosture, { tui: isTui })');
expect(AGENT_LIFECYCLE_SRC).toMatch(/if \(postureBlock\) \{[\s\S]*?status: 'blocked'/);
- expect(AGENT_LIFECYCLE_SRC).toContain('blockedCategory: postureBlock.category');
+ // The helper owns the blocked category too, so the gate cannot pick its own.
+ expect(AGENT_LIFECYCLE_SRC).toContain('const { reason, category } = postureBlock;');
// The reason text belongs to the helper — building it here means the gate
// decided for itself whether the posture was supported.
expect(AGENT_LIFECYCLE_SRC).not.toContain('public-content review mode');