feat: open useful USER_TYPE-gated features to all users (#644)

* feat: open useful USER_TYPE-gated features to all users

Remove 13 process.env.USER_TYPE === 'ant' gates that restricted useful
features to Anthropic employees. These features work without Anthropic
infrastructure and are now available to all open-build users.

Features opened:
- Agent nesting (sub-agents can spawn sub-agents)
- Effort 'max' persistence in settings
- Plan mode interview phase (controlled by feature flags)
- Sandbox disabled commands (via ~/.claude/feature-flags.json)
- All tips visible to all users (plan mode, feedback, shift-tab)

Simplified:
- Fullscreen defaults to off (use /config to enable)
- Explore agent always uses haiku model
- Plan mode tool uses conservative prompt for all users

Continues the USER_TYPE cleanup from #637 (dead code) and builds
on #639 (local feature flags).

* fix: address Copilot review comments — remove residual dead code

1. bridgeConfig.ts: ungate bridge override functions — return env vars
   directly instead of hardcoded undefined
2. bridgeMain.ts + initReplBridge.ts: ungate sessionIngressUrl — read
   CLAUDE_BRIDGE_SESSION_INGRESS_URL without USER_TYPE check
3. tools.ts: remove dead ConfigTool/TungstenTool imports, narrow
   eslint-disable scope, stub REPLTool/SuggestBackgroundPRTool to null
4. readOnlyValidation.ts: remove orphaned ANT_ONLY_COMMAND_ALLOWLIST
   and unused GH_READ_ONLY_COMMANDS import
5. insights.ts: remove entire remote collection plumbing (types,
   functions, options, display logic)
6. osc.ts: hardcode supportsTabStatus() to false (internal-only feature)
7. state.ts: simplify addSlowOperation/getSlowOperations to no-ops,
   remove dead constants

* fix: address Copilot review on PR #644

1. settings/types.ts: allow 'max' effort level for all users in Zod
   schema — was still gated behind USER_TYPE=ant, causing 'max' to be
   silently dropped on settings reload
2. shouldUseSandbox.ts: defensively normalize disabledCommands from
   feature flag config with Array.isArray() guards

* fix: address second round of Copilot review on PR #644

1. shouldUseSandbox.ts: validate top-level shape of disabledCommands
   before accessing properties (handles null/primitive from feature flag)
2. fullscreen.ts: update JSDoc to reflect removal of USER_TYPE default
3. osc.ts: update JSDoc — "Ant-only" → "Currently disabled"
This commit is contained in:
Nourrisse Florian
2026-04-14 13:08:54 +02:00
committed by GitHub
parent 658d076909
commit c1beea9867
17 changed files with 75 additions and 539 deletions

View File

@@ -143,7 +143,7 @@ export function parseEffortValue(value: unknown): EffortValue | undefined {
/**
* Numeric values are model-default only and not persisted.
* 'max' is session-scoped for external users (ants can persist it).
* 'max' can now be persisted by all users.
* Write sites call this before saving to settings so the Zod schema
* (which only accepts string levels) never rejects a write.
*/
@@ -153,15 +153,15 @@ export function toPersistableEffort(
if (value === 'low' || value === 'medium' || value === 'high') {
return value
}
if (value === 'max' && process.env.USER_TYPE === 'ant') {
if (value === 'max') {
return value
}
return undefined
}
export function getInitialEffortSetting(): EffortLevel | undefined {
// toPersistableEffort filters 'max' for non-ants on read, so a manually
// edited settings.json doesn't leak session-scoped max into a fresh session.
// toPersistableEffort validates 'max' on read, so a manually
// edited settings.json with an invalid level doesn't leak into a fresh session.
return toPersistableEffort(getInitialSettings().effortLevel)
}

View File

@@ -107,15 +107,15 @@ export function _resetTmuxControlModeProbeForTesting(): void {
/**
* Whether fullscreen (flicker-free) mode is enabled. Env var takes highest
* precedence, then the `flickerFreeMode` config setting, then the internal-only
* default. External users can enable via `/config` instead of setting the env.
* precedence, then the `flickerFreeMode` config setting, then defaults to off.
* Users can enable via `/config` instead of setting the env.
*
* Priority order:
* CLAUDE_CODE_NO_FLICKER=0 → always off
* CLAUDE_CODE_NO_FLICKER=1 → always on (overrides tmux -CC guard too)
* tmux -CC detected → off (corrupts terminal state)
* config flickerFreeMode → on/off per user preference
* USER_TYPE=ant → on by default for internal users
* default → off
*/
export function isFullscreenEnvEnabled(): boolean {
// Explicit env opt-out always wins.
@@ -137,7 +137,7 @@ export function isFullscreenEnvEnabled(): boolean {
// `/config` without having to set an env var.
const configValue = getGlobalConfig().flickerFreeMode
if (configValue !== undefined) return configValue
return process.env.USER_TYPE === 'ant'
return false
}
/**

View File

@@ -45,12 +45,9 @@ export function getPlanModeV2ExploreAgentCount(): number {
/**
* Check if plan mode interview phase is enabled.
*
* Config: ant=always_on, external=tengu_plan_mode_interview_phase gate, envVar=true
* Config: tengu_plan_mode_interview_phase gate, envVar=true
*/
export function isPlanModeInterviewPhaseEnabled(): boolean {
// Always on for ants
if (process.env.USER_TYPE === 'ant') return true
const env = process.env.CLAUDE_CODE_PLAN_MODE_INTERVIEW_PHASE
if (isEnvTruthy(env)) return true
if (isEnvDefinedFalsy(env)) return false

View File

@@ -714,11 +714,7 @@ export const SettingsSchema = lazySchema(() =>
'enabled automatically for supported models.',
),
effortLevel: z
.enum(
process.env.USER_TYPE === 'ant'
? ['low', 'medium', 'high', 'max']
: ['low', 'medium', 'high'],
)
.enum(['low', 'medium', 'high', 'max'])
.optional()
.catch(undefined)
.describe('Persisted effort level for supported models.'),