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: collapse the Claude posture wrappers and share the enforced-posture predicate

[._.]/ Adam Eivyedc3546ed9d5
diff --git a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
index 1a9fe221aa..c234e2c48b 100644
--- a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
+++ b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
@@ -35,12 +35,20 @@ const providerNames = (providers) => providers.map((p) => p.name || p.id).join('
// of them the server additionally wraps in the vendor's own OS sandbox, so a
// choice that relies on the disposable worktree alone is a visible one.
const actionsStageNote = (eligibleProviders) => {
- const sandboxed = eligibleProviders.filter((p) => enforcesPublicReviewPosture(p, PUBLIC_REVIEW_ACTIONS_POSTURE));
- const worktreeOnly = eligibleProviders.filter((p) => !sandboxed.includes(p));
+ const isSandboxed = (p) => enforcesPublicReviewPosture(p, PUBLIC_REVIEW_ACTIONS_POSTURE);
+ const sandboxed = eligibleProviders.filter(isSandboxed);
+ const worktreeOnly = eligibleProviders.filter((p) => !isSandboxed(p));
const isolation = worktreeOnly.length === 0
- ? 'Each runs headless inside its vendor\'s maintained OS sandbox.'
- : `${sandboxed.length > 0 ? `OS-sandboxed by the vendor's own recipe: ${providerNames(sandboxed)}. ` : ''}Headless with standard permissions, isolated by the disposable worktree only: ${providerNames(worktreeOnly)}.`;
- return `Sandboxed stage. Eligible on this install: ${providerNames(eligibleProviders)}. ${isolation} PortOS passes the selected provider, model, and thinking effort through, with no forge credential or configuration overlays; the deterministic coordinator owns comments, issue filing, CI triggers, and merges.`;
+ ? ['Each runs headless inside its vendor\'s maintained OS sandbox.']
+ : [
+ sandboxed.length > 0 && `OS-sandboxed by the vendor's own recipe: ${providerNames(sandboxed)}.`,
+ `Headless with standard permissions, isolated by the disposable worktree only: ${providerNames(worktreeOnly)}.`,
+ ].filter(Boolean);
+ return [
+ `Sandboxed stage. Eligible on this install: ${providerNames(eligibleProviders)}.`,
+ ...isolation,
+ 'PortOS passes the selected provider, model, and thinking effort through, with no forge credential or configuration overlays; the deterministic coordinator owns comments, issue filing, CI triggers, and merges.',
+ ].join(' ');
};
export default function PipelineStageConfig({ taskType, config, providers, onUpdate, updating, setUpdating }) {
diff --git a/server/lib/providerVendors.js b/server/lib/providerVendors.js
index 14a4530578..89348942cf 100644
--- a/server/lib/providerVendors.js
+++ b/server/lib/providerVendors.js
@@ -510,20 +510,14 @@ const CLAUDE_PUBLIC_REVIEW_ACTIONS_ARGS = [
...CLAUDE_PUBLIC_REVIEW_COMMON_ARGS,
];
-function claudePublicReviewSpawnArgs(provider, ctx) {
- return claudePublicReviewArgs(provider, ctx, CLAUDE_PUBLIC_REVIEW_NO_TOOL_ARGS);
-}
-
-function claudePublicReviewActionsSpawnArgs(provider, ctx) {
- return claudePublicReviewArgs(provider, ctx, CLAUDE_PUBLIC_REVIEW_ACTIONS_ARGS);
-}
+const claudePublicReviewSpawnArgsFor = (postureArgs) => (provider, ctx) => claudePublicReviewArgs(postureArgs, provider, ctx);
-function claudePublicReviewArgs(provider, {
+function claudePublicReviewArgs(postureArgs, provider, {
effectiveModel,
effort,
systemPromptFile,
tui = false,
-} = {}, postureArgs) {
+} = {}) {
const providerId = provider?.id || 'claude-code';
const args = [
...postureArgs,
@@ -547,6 +541,8 @@ function claudePublicReviewArgs(provider, {
};
}
+const matchClaudeBinary = (provider) => isDirectBinaryProvider(provider) && isClaudeCommand(provider?.command);
+
const CLAUDE = {
id: 'claude',
idFragment: null, // never matched by id.includes() — it's the outside-the-loop default
@@ -562,12 +558,12 @@ const CLAUDE = {
// matcher must positively identify the binary — an unknown command must
// never inherit claude's flag set.
[PUBLIC_REVIEW_NO_TOOL_POSTURE]: {
- spawnArgs: claudePublicReviewSpawnArgs,
- matchProvider: (provider) => isDirectBinaryProvider(provider) && isClaudeCommand(provider?.command),
+ spawnArgs: claudePublicReviewSpawnArgsFor(CLAUDE_PUBLIC_REVIEW_NO_TOOL_ARGS),
+ matchProvider: matchClaudeBinary,
},
[PUBLIC_REVIEW_ACTIONS_POSTURE]: {
- spawnArgs: claudePublicReviewActionsSpawnArgs,
- matchProvider: (provider) => isDirectBinaryProvider(provider) && isClaudeCommand(provider?.command),
+ spawnArgs: claudePublicReviewSpawnArgsFor(CLAUDE_PUBLIC_REVIEW_ACTIONS_ARGS),
+ matchProvider: matchClaudeBinary,
},
},
};
@@ -679,12 +675,8 @@ export function buildVendorSpawnConfig(provider, ctx) {
if (posture) {
const recipe = publicReviewRecipe(provider, posture);
if (recipe) return recipe.spawnArgs(provider, ctx);
- // The no-tool gate has no fallback: nothing but an enforced argv can hold
- // a model tool-free. The actions stage is different — its isolation is the
- // disposable worktree plus the stripped child environment (no forge
- // credential, no Claude settings overlay), and the deterministic coordinator
- // owns every GitHub mutation — so any enabled binary provider may run it
- // headless through its ordinary recipe when the vendor has no sandbox one.
+ // See supportsPublicReviewPosture for why the actions stage may fall
+ // through to the vendor's ordinary headless recipe and the gate may not.
if (!supportsPublicReviewPosture(provider, posture)) {
throw new Error(`Provider '${providerLabel(provider)}' has no enforced ${posture} public-review posture`);
}
@@ -709,17 +701,18 @@ export function publicReviewPosturesForProvider(provider) {
}
/**
- * The postures this provider runs through a maintained, vendor-enforced
- * recipe. A subset of `publicReviewPosturesForProvider`: the actions posture
- * is also runnable by a binary provider with no sandbox recipe (see
- * `supportsPublicReviewPosture`), and the schedule UI uses the difference to
- * say which choices are OS-sandboxed and which rely on the worktree alone.
+ * The subset of `publicReviewPosturesForProvider` backed by a vendor-enforced
+ * recipe; the schedule UI uses the difference to say which actions-stage
+ * choices are OS-sandboxed and which rely on the worktree alone.
*/
export function enforcedPublicReviewPosturesForProvider(provider) {
- if (!isDirectBinaryProvider(provider)) return [];
- return PUBLIC_REVIEW_POSTURES.filter((posture) => Boolean(publicReviewRecipe(provider, posture)));
+ return PUBLIC_REVIEW_POSTURES.filter((posture) => enforcesPublicReviewPosture(provider, posture));
}
+const enforcesPublicReviewPosture = (provider, posture) => (
+ isDirectBinaryProvider(provider) && Boolean(publicReviewRecipe(provider, posture))
+);
+
/**
* Vendor ids that declare a maintained recipe for `posture`, for naming what a
* user could install when nothing on their machine qualifies. Derived from the
@@ -741,9 +734,8 @@ export function publicReviewCapableVendorIds(posture) {
* binary to spawn and fail closed for both.
*/
export function supportsPublicReviewPosture(provider, posture) {
- if (!isDirectBinaryProvider(provider)) return false;
- if (posture === PUBLIC_REVIEW_ACTIONS_POSTURE) return true;
- return Boolean(publicReviewRecipe(provider, posture));
+ return enforcesPublicReviewPosture(provider, posture)
+ || (posture === PUBLIC_REVIEW_ACTIONS_POSTURE && isDirectBinaryProvider(provider));
}
/**
diff --git a/server/lib/providerVendors.publicReview.test.js b/server/lib/providerVendors.publicReview.test.js
index 4caf9bbac2..a4bc095c06 100644
--- a/server/lib/providerVendors.publicReview.test.js
+++ b/server/lib/providerVendors.publicReview.test.js
@@ -213,8 +213,6 @@ describe('public-review provider postures', () => {
expect(config.args).not.toContain('--dangerously-skip-permissions');
expect(config.args).not.toContain('--restricted');
expect(config.args).not.toContain('plan');
- // The local wrapper still gets the lean flags; `--bare` is never forced on
- // a cloud Claude because it disables OAuth/keychain auth.
expect(config.args).toContain('--bare');
const cloud = buildVendorSpawnConfig({ id: 'claude-code', type: 'cli', command: 'claude' }, {
safetyProfile: PUBLIC_REVIEW_ACTIONS_EXECUTION_PROFILE,