Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mms/bots/sandbox/mousseRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export function heldToolEnv(toolHome: string | undefined): Array<readonly [strin
if (!toolHome) return []
const at = (name: string) => posix.join(toolHome, name)
return [
['GH_CONFIG_DIR', at('gh')], ['GIT_CONFIG_GLOBAL', at('gitconfig')], ['XDG_CONFIG_HOME', at('config')], ['XDG_CACHE_HOME', at('cache')],
['GH_CONFIG_DIR', posix.join(toolHome, 'gh')], ['GIT_CONFIG_GLOBAL', at('gitconfig')], ['XDG_CONFIG_HOME', at('config')], ['XDG_CACHE_HOME', at('cache')],
['npm_config_cache', at('npm')], ['npm_config_userconfig', at('npmrc')], ['PIP_CACHE_DIR', at('pip')], ['PIP_CONFIG_FILE', '/dev/null']
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/mms/harness/pi/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,7 @@ export class PiRpcEngine implements ProviderAdapter {
}
const turn = new PiTurn(key, host.bridge?.turnToken ?? key, input, sink, ctl, host, tools, builtins)
// A bot whose `bash` is held: its commands join its own sandbox network, started now (none: each its own).
if (host.bot?.sandbox.policy.kind === 'held' && builtins.includes('bash')) {
if (host.bot?.sandbox?.policy.kind === 'held' && builtins.includes('bash')) {
try {
turn.localNetwork = await host.bot.sandbox.localNetwork?.(host.bot.sandbox.policy)
} catch {
Expand Down
3 changes: 2 additions & 1 deletion src/shared/bots/personal/localServers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ export function forwardChangeProblem(value: unknown): string | undefined {
*/
export function forwardUrl(forward: Pick<BotLocalForward, 'id' | 'hostPort' | 'browser'>): string {
if (!forward.browser) return `http://127.0.0.1:${forward.hostPort}/`
return `http://f${forward.id.replace(/[^0-9a-z]/gi, '').slice(0, 8).toLowerCase()}.localhost:${forward.hostPort}/`
const host = `f${forward.id.replace(/[^0-9a-z]/gi, '').slice(0, 8).toLowerCase()}.localhost`
return `http://${host}:${forward.hostPort}/`
}

/** A forward's row in the dialog: its title and where it goes. */
Expand Down
6 changes: 5 additions & 1 deletion src/shared/bridge/deviceActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ const DEVICE_ACCESS: Phrase = phrase('Changed what a device may do here', 'chang
const DEVICE_BLOCK: Phrase = phrase('Blocked or unblocked a device', 'blocked or unblocked a device', 'blocked or unblocked devices {n} times')
const DEVICE_REMOVE: Phrase = phrase('Removed a device', 'removed a device', 'removed {n} devices')
const DEVICE_WORK: Phrase = phrase('Changed whether your other devices may work here', 'changed whether your other devices may work here', 'changed whether your other devices may work here {n} times')
const SECRET_SHARE: Phrase = phrase('Shared secrets with a thread', 'shared secrets with a thread', 'shared secrets with threads {n} times')
const SECRET_REVOKE: Phrase = phrase('Revoked shared secrets', 'revoked shared secrets', 'revoked shared secrets {n} times')
const OTHER: Phrase = phrase('Made a change', 'made a change', 'made {n} other changes')

/** A change that is a notice to the owner, not a thing to count. */
Expand Down Expand Up @@ -354,7 +356,9 @@ const PHRASES: Record<string, Phrase> = {
'devices.policy': DEVICE_ACCESS,
'devices.block': DEVICE_BLOCK,
'devices.remove': DEVICE_REMOVE,
'devices.workOnThreads': DEVICE_WORK
'devices.workOnThreads': DEVICE_WORK,
'secrets.share': SECRET_SHARE,
'secrets.shares.revoke': SECRET_REVOKE
}

/** Every method the owner audits as a change that has words of its own; the test checks it against the routed table. */
Expand Down
6 changes: 4 additions & 2 deletions tests/bots/botFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ export function botFixture(options: Pick<BotEngineHost, 'spawnWatcher' | 'platfo
automationRuns.close()
store.close()
runDb.close()
// On Windows a stopped background command's shell and runner can hold its folder a moment after the command itself ends.
rmSync(base, { recursive: true, force: true, maxRetries: 20, retryDelay: 50 })
// On Windows a stopped background command's shell can still hold its folder a moment after the command ends,
// and Node's rmSync throws EPERM without retrying.
try { rmSync(base, { recursive: true, force: true, maxRetries: 20, retryDelay: 50 }) }
catch (error) { if ((error as NodeJS.ErrnoException).code !== 'EPERM') throw error }
}
return fixture
}
Expand Down
5 changes: 4 additions & 1 deletion tests/bots/botHelloCeiling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ import { disposeFixtures, memoryFixture } from './memory/memoryFixture'
// Codex and Pi has it without a lookup) adds about 650: the chat lane on Codex and Pi says hello in about 62,665 characters.
// Thread links carrying their computer (#2516, remote_thread_not_found and remote_thread_gone explanations in REMOTE_REACH)
// add about 566 across the core thread tools: the chat lane on Codex and Pi says hello in about 63,231 characters.
const CEILING = { codexPi: 63_300, claude: 26_700 } as const
// Continuing an owner ask under assigned work (#2546), `#` thread tags (#2535), local server asks (#2538), Keep allowing
// allowances and public web tools (#2536), and `/secform` guidance (#2539) bring the chat lane on Codex and Pi to about
// 64,186 characters.
const CEILING = { codexPi: 64_300, claude: 26_700 } as const

let fx: DelegationFixture | undefined
afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion tests/bots/botSubagentDelegations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ describe('a bot\'s work subagents as delegations', () => {
expect(shape(run)).toEqual(shape(previous))
run.close()
const bots = new DatabaseSync(paths.botsDb)
bots.exec(`DROP TABLE bot_file_access; DELETE FROM run_schema_migrations WHERE version = 20; DROP TABLE bot_sandbox; DELETE FROM run_schema_migrations WHERE version = 19; DROP TABLE bot_owner_ask_launches; DROP TABLE bot_owner_asks;
bots.exec(`DELETE FROM run_schema_migrations WHERE version IN (21, 22); DROP TABLE bot_file_access; DELETE FROM run_schema_migrations WHERE version = 20; DROP TABLE bot_sandbox; DELETE FROM run_schema_migrations WHERE version = 19; DROP TABLE bot_owner_ask_launches; DROP TABLE bot_owner_asks;
DROP INDEX bot_jobs_open_by_owner_ask; ALTER TABLE bot_jobs DROP COLUMN owner_ask_id;
ALTER TABLE bot_reminders DROP COLUMN owner_asks_json; DELETE FROM run_schema_migrations WHERE version = 18;
ALTER TABLE bot_reminders DROP COLUMN device_json; ALTER TABLE bot_actions DROP COLUMN answered_from_json;
Expand Down
4 changes: 2 additions & 2 deletions tests/ptyLiveness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ describe('thread switching terminal lifecycle', () => {
expect(appSource).toMatch(/Keep terminal PTYs and browser guests mounted/)
const mainPane = appSource.match(/<KeepMounted as="main"[\s\S]*?<\/KeepMounted>/)?.[0]
expect(mainPane).toBeDefined()
// Active while the panel is open in the projects layout, and while it slides out after closing.
expect(appSource).toMatch(/const panelOpen = mainAreaOpen && layoutMode === 'projects'/)
// Active while the panel is open, and while it slides out after closing.
expect(appSource).toMatch(/const panelOpen = mainAreaOpen && panelAvailable/)
expect(appSource).toMatch(/const panelShown = panelOpen \|\| panelClosing/)
expect(mainPane).toMatch(/active=\{panelShown\}[^>]*\bpreserveLayout\b/)
expect(mainPane).toMatch(/<MainViewPanel\b[^>]*\/>/)
Expand Down
3 changes: 2 additions & 1 deletion tests/renderer/keyboardFocusFill.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ const TEXT_FIELD_BORDERS = new Set([
'.start-from-pr-input:focus',
'.scheduled-input:focus-visible',
'.thread-filter-field:focus-visible',
'.threads-sidebar-rename-input:focus'
'.threads-sidebar-rename-input:focus',
'.secform-name:focus'
])

const where = (rule: FocusRule) => `${rule.file}:${rule.line} ${rule.selectors.join(', ')}`
Expand Down
2 changes: 1 addition & 1 deletion tests/renderer/remoteBots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ describe('the chat of a bot of another computer', () => {
fake.chats['n_laptop:b_inbox'] = [message(1, { author: 'owner', text: 'Hi' }), message(2, { text: 'Hello!' })]
await open(remote({ lives: { ...LAPTOP, level: 'full' } }), fake.chats['n_laptop:b_inbox'])
await type(box()!, '/')
expect(options().length).toBe(10)
expect(options().length).toBe(11)
expect(options().filter((option) => option.getAttribute('aria-disabled') === 'true')).toEqual([])
await press('Escape')
await run('/clear')
Expand Down
4 changes: 4 additions & 0 deletions tests/renderer/subagentOptimisticWorking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { LineageSection } from '../../src/renderer/components/sideCard/LineageSection'
import { findSubagentEntry, isSubagentStartingOptimistically } from '../../src/renderer/components/subagentStatus'
import { isNewEmptyThread } from '../../src/renderer/lib/newThread'
import { setSidePanelSettings } from '../../src/renderer/lib/sidePanelSettings'
import { useAppStore } from '../../src/renderer/stores/appStore'
import { getDefaultSettings } from '../../src/shared/settings'
import type { SubagentSummary } from '../../src/shared/subagents'
Expand Down Expand Up @@ -163,6 +164,8 @@ describe('clicking a starting subagent in Nest', () => {
}

beforeEach(() => {
// Subagent opening here exercises the full-pane OrchestratorChat view; side-panel opening is covered in sideChatsPanel.test.ts.
setSidePanelSettings({ openBotThreadsInSidePanel: true, openSubagentsInSidePanel: false })
vi.stubGlobal('ResizeObserver', class { observe() {} unobserve() {} disconnect() {} })
window.matchMedia = ((query: string) => ({
matches: false,
Expand Down Expand Up @@ -199,6 +202,7 @@ describe('clicking a starting subagent in Nest', () => {
afterEach(() => {
act(() => root.unmount())
host.remove()
setSidePanelSettings({ openBotThreadsInSidePanel: true, openSubagentsInSidePanel: true })
useAppStore.setState(useAppStore.getInitialState())
vi.unstubAllGlobals()
})
Expand Down
2 changes: 1 addition & 1 deletion tests/startupAppearance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ it('reads saved appearance from the active default profile without rewriting eit
writeFileSync(join(profileRoot, 'mousse.conf'), config)
const shared = JSON.stringify({ settings: { appearance: fallback } })
writeFileSync(join(directory, 'mousse.conf'), shared)
expect(readStartupAppearance(directory, fallback)).toEqual({ ...saved, renderMath: true, replyPacing: true, threadProjectColors: 'off', replyPreviews: false, threadPathInTitleBar: true, interfaceFont: { source: 'default' }, codeFont: { source: 'default' }, animationSpeed: 'normal', turnChangedFiles: 'summary', chatWidth: 'normal', frostedComposer: false, frostedComposerOpacity: 60, frostedComposerBlur: 6, frostedComposerSaturation: 1.12, contextRingInComposer: false, userThemes: [], userTheme: '' })
expect(readStartupAppearance(directory, fallback)).toEqual({ ...saved, renderMath: true, replyPacing: true, threadProjectColors: 'off', replyPreviews: false, threadPathInTitleBar: true, interfaceFont: { source: 'default' }, codeFont: { source: 'default' }, animationSpeed: 'normal', turnChangedFiles: 'summary', chatWidth: 'normal', frostedComposer: false, frostedComposerOpacity: 60, frostedComposerBlur: 6, frostedComposerSaturation: 1.12, contextRingInComposer: false, openBotThreadsInSidePanel: true, openSubagentsInSidePanel: true, userThemes: [], userTheme: '' })
expect(readFileSync(join(profileRoot, 'mousse.conf'), 'utf8')).toBe(config)
expect(readFileSync(join(directory, 'mousse.conf'), 'utf8')).toBe(shared)
})
Expand Down
1 change: 1 addition & 0 deletions tests/themeSelectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const PERMISSION_MODE_REVIEWED: Record<string, string> = {
'src/renderer/components/ComposerEffortPicker.tsx': 'hosts the menu; the choices are ComposerPermissionPicker',
'src/renderer/components/OrchestratorChat.tsx': 'the handler, no control',
'src/renderer/components/sideChats/SideChatsPanel.tsx': 'a side chat\'s handler, no control; the menu is ComposerPermissionPicker',
'src/renderer/components/sideChats/SideThreadColumn.tsx': 'a side thread\'s handler, no control; the menu is ComposerPermissionPicker',
'src/renderer/components/settings/GeneralSettings.tsx': 'Settings → General, guarded with the page',
'src/renderer/components/automations/AutomationDetail.tsx': 'only on the Automations page, guarded with it',
'src/renderer/components/automations/inbox/EditDetailsPane.tsx': 'only on the Automations page, guarded with it'
Expand Down
Loading