• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive-studio / 25871810535

14 May 2026 04:25PM UTC coverage: 70.582% (-0.1%) from 70.689%
25871810535

push

github

web-flow
feat(playground): enable agents for everyone (#2256)

* feat(playground): enable agents for everyone

Remove the `agents` feature flag that gated the Agents sidebar link
and the AgentSelector in the chat input. The flag defaulted to false
and was not exposed in the Settings UI, so users had to call
`FeatureFlag.agents.enable()` from the dev console to try the feature.
Agents is shipped — drop the gating and the now-dead test branches.

The feature-flag infrastructure stays in place; it still backs
`META_OPTIMIZER`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test(playground): assert AgentSelector renders in chat input toolbar

Covers the always-visible AgentSelector after the agents feature flag
was removed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

5097 of 7813 branches covered (65.24%)

1 of 1 new or added line in 1 file covered. (100.0%)

11 existing lines in 1 file now uncovered.

7584 of 10745 relevant lines covered (70.58%)

116.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.76
/main/src/feature-flags/flags.ts
1
import Store from 'electron-store'
2
import log from '../logger'
3
import { featureFlagKeys } from '../../../utils/feature-flags'
4
import type { FeatureFlagKey, FeatureFlagOptions } from './types'
5
import { writeFeatureFlag } from '../db/writers/feature-flags-writer'
6
import { readFeatureFlag as readFeatureFlagFromDb } from '../db/readers/feature-flags-reader'
7

8
const FLAG_STORE_PREFIX = 'feature_flag_'
3✔
9

10
const featureFlagOptions: Record<FeatureFlagKey, FeatureFlagOptions> = {
3✔
11
  [featureFlagKeys.META_OPTIMIZER]: {
12
    // MCP Optimizer has been sunset. The flag is kept for one release to allow
13
    // the startup cleanup to detect if the user had it enabled before.
14
    isDisabled: true,
15
    defaultValue: false,
16
    isExperimental: true,
17
  },
18
}
19

20
// Kept for one-time reconciliation migration; remove after migration grace period
21
export const featureFlagStore = new Store<Record<string, boolean>>({
3✔
22
  name: 'feature-flags',
23
  defaults: {},
24
})
25

26
export function getFeatureFlag(key: FeatureFlagKey): boolean {
27
  const options = featureFlagOptions[key] ?? {}
5!
28

29
  if (options.isDisabled) {
5!
30
    return false
5✔
31
  }
32

UNCOV
33
  try {
×
UNCOV
34
    const dbValue = readFeatureFlagFromDb(`${FLAG_STORE_PREFIX}${key}`)
×
UNCOV
35
    if (dbValue !== undefined) {
×
UNCOV
36
      log.debug(`Getting feature flag ${key} from SQLite: ${dbValue}`)
×
UNCOV
37
      return dbValue
×
38
    }
39
  } catch (err) {
UNCOV
40
    log.error('[DB] SQLite read failed for feature flag:', err)
×
41
  }
42

UNCOV
43
  const defaultValue = options.defaultValue ?? false
×
44
  log.debug(`Getting feature flag ${key}: ${defaultValue}`)
5✔
45
  return defaultValue
5✔
46
}
47

48
export function enableFeatureFlag(key: FeatureFlagKey): void {
49
  const options = featureFlagOptions[key] ?? {}
1!
50

51
  if (options.isDisabled) {
1!
52
    log.warn(`Attempted to enable disabled feature flag: ${key}`)
1✔
53
    return
1✔
54
  }
55

UNCOV
56
  const storeKey = `${FLAG_STORE_PREFIX}${key}`
×
UNCOV
57
  try {
×
UNCOV
58
    writeFeatureFlag(storeKey, true)
×
59
  } catch (err) {
60
    log.error('[DB] Failed to write feature flag:', err)
×
61
  }
62

UNCOV
63
  log.info(`Enabled feature flag: ${key}`)
×
64
}
65

66
export function disableFeatureFlag(key: FeatureFlagKey): void {
67
  const storeKey = `${FLAG_STORE_PREFIX}${key}`
1✔
68

69
  try {
1✔
70
    writeFeatureFlag(storeKey, false)
1✔
71
  } catch (err) {
72
    log.error('[DB] Failed to write feature flag:', err)
×
73
  }
74

75
  log.info(`Disabled feature flag: ${key}`)
1✔
76
}
77

78
export function getAllFeatureFlags(): Record<
79
  FeatureFlagKey,
80
  FeatureFlagOptions & { enabled: boolean }
81
> {
82
  const flags: Record<string, FeatureFlagOptions & { enabled: boolean }> = {}
3✔
83

84
  Object.values(featureFlagKeys).forEach((key) => {
3✔
85
    const options = featureFlagOptions[key] ?? {}
3!
86
    flags[key] = {
3✔
87
      ...options,
88
      enabled: getFeatureFlag(key),
89
    }
90
  })
91

92
  return flags
3✔
93
}
94

95
export type { FeatureFlagKey, FeatureFlagOptions }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc