Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
48a13cb
improvement(knowledge): scan processing recovery per connector and pr…
waleedlatif1 Sep 26, 2026
5a69768
improvement(chat): stop reloading the full transcript on every turn a…
waleedlatif1 Sep 26, 2026
185650f
improvement(knowledge): maintain keyword projections only for search …
waleedlatif1 Sep 26, 2026
3945364
improvement(db): tag advisory lock statements by caller (#8331)
waleedlatif1 Sep 26, 2026
10282f2
improvement(billing): share the enterprise reporting usage read acros…
waleedlatif1 Sep 26, 2026
ce88d8a
fix(files): stop saving fetched URLs to Files and look names up by th…
waleedlatif1 Sep 26, 2026
e625a4c
fix(knowledge): count documents through the reader's access and only …
waleedlatif1 Sep 26, 2026
5b667d7
fix(api): prevent caching authenticated workflow variables (#8339)
waleedlatif1 Sep 26, 2026
d9b9e1d
fix(copilot): bound agent CLI grep matching (#8338)
waleedlatif1 Sep 26, 2026
7a36d74
fix(slack-search): stop recovered tool failures from flagging the who…
TheodoreSpeaks Sep 26, 2026
ec0f474
fix(api): constrain workflow response headers (#8341)
waleedlatif1 Sep 26, 2026
65af161
improvement(db): drop unusable date slot and redundant prefix indexes…
waleedlatif1 Sep 26, 2026
c2cce49
feat(databricks): add Genie agent operations to the Databricks block …
waleedlatif1 Sep 26, 2026
954012c
fix(execution): bound reference and context processing (#8344)
waleedlatif1 Sep 26, 2026
affbc6d
fix(desktop): wait for native update staging and verify installation …
waleedlatif1 Sep 26, 2026
c479a5a
improvement(knowledge): serve date tag filters from an index (#8348)
waleedlatif1 Sep 26, 2026
045788f
feat(snowflake): add Cortex Analyst operations to the Snowflake block…
waleedlatif1 Sep 26, 2026
6a6a882
feat(search): expand live providers and discussion reads (#8340)
waleedlatif1 Sep 26, 2026
eeaa57b
improvement(knowledge): walk connector reconciliation by id so seen s…
waleedlatif1 Sep 26, 2026
bccc722
fix(chat): use hostname brand icons for inline sources (#8350)
waleedlatif1 Sep 27, 2026
2aed9b5
feat(chat): add shared find menu (#8351)
waleedlatif1 Sep 27, 2026
5c446f1
fix(function): omit oversized display code instead of failing the exe…
waleedlatif1 Sep 28, 2026
bf2594c
fix(search): validate Notion search terms before dispatch (#8358)
waleedlatif1 Sep 28, 2026
e1124ff
fix(search): let cancelled live reads stop instead of reporting parti…
waleedlatif1 Sep 28, 2026
4fe45a0
fix(billing): key the usage email claim on the exact period start and…
waleedlatif1 Sep 28, 2026
635d275
fix(chat): keep find stable across footnotes and pending chats, and m…
waleedlatif1 Sep 28, 2026
3896437
fix(databricks): send workspace tokens only to Databricks workspace h…
waleedlatif1 Sep 28, 2026
a763b4a
test(knowledge): accept either ordered index in the scale window chec…
waleedlatif1 Sep 28, 2026
9070d1b
refactor(db): require a transaction for advisory lock helpers (#8364)
waleedlatif1 Sep 28, 2026
dbeb732
fix(knowledge): resume the member resurrection walk from a persisted …
waleedlatif1 Sep 28, 2026
8f3eb3a
fix(search): validate a new provider server before the approval trans…
waleedlatif1 Sep 28, 2026
a657493
fix(knowledge): serve list totals when a request omits the count flag…
waleedlatif1 Sep 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .agents/skills/memory-load-check/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Read these when doing a deeper pass:
- dispatch concrete chunks (`workspaceIds`, retention, label) instead of one giant scope
- prefer Trigger.dev queue/concurrency keys when available
- execute inline fallback chunks sequentially, not with unbounded `Promise.all`
- File parse pattern in `apps/sim/lib/internal/file/parser.ts` and `apps/sim/lib/uploads/contexts/workspace/fetch-external-url.ts`
- File parse pattern in `apps/sim/lib/internal/file/parser.ts` and `apps/sim/lib/uploads/utils/fetch-external-url.server.ts`
- cap downloads and parsed output separately
- preserve partial results when a later item exceeds the cap
- never read untrusted response bodies without a byte cap
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ Raw local file bytes are never exposed through the preload bridge and cannot be

- `electron-updater` reads the deployment's `/api/desktop/update` feed; production resolves stable releases from `simstudioai/sim`, while dev/staging resolve prereleases from `simstudioai/sim-desktop-releases`. Artifact downloads go directly to GitHub and deltas use `.zip.blockmap`. Sim validates every candidate before starting its download. Developer ID builds installed under `/Applications` use a prompt (Restart and update / Later; Later installs on quit); other packaged builds offer a validated installer download — never forced mid-session. A staged or offered update keeps being re-checked on the normal cadence, and a newer release replaces it, so a shell left running across several releases installs the latest build in one restart instead of the stale one followed by another prompt.
- Streams: production follows stable `X.Y.Z` releases, dev follows `-dev.N`, and staging follows `-staging.N`. The feed still recognizes legacy `-alpha.N`/`-beta.N` releases during migration.
- Restart becomes available only after Squirrel confirms native staging. Replacing a staged update returns the UI to downloading; a failed transfer can retain the previous staged build, but a failure after the native feed is replaced requires a retry. Diagnostics record `update_downloaded` after native staging, `update_install` when an explicit restart is committed, and `update_install_result` on the next launch with the expected and installed versions. The staging checkpoint also covers updates installed on a normal quit.
- `bun run test:e2e e2e/updater.spec.ts` exercises the real Electron process, MacUpdater, downloads, retries, and installation checkpoints. Native verification and bundle replacement are simulated. Set `DESKTOP_UPDATER_REPORT_PATH` to choose the JSON report path; by default it is included in Playwright's test results and uploaded by CI on failure.
- Staged rollout: after publishing, edit `stagingPercentage: 10` into the release's `latest-mac.yml`, then raise as crash metrics stay clean.
- Rollback: a pulled release must be superseded by a **higher** version — users on the broken build will not reinstall an equal one. (A blocked-versions kill-switch was removed as unwired dead code; reintroduce it in `updater.ts` if a remote config source ever exists to feed it.)
- Ship the DMG and tell users to install to `/Applications` — App Translocation breaks Squirrel.Mac updates from quarantined paths.
Expand Down
83 changes: 83 additions & 0 deletions apps/desktop/e2e/fixtures/updater.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { writeFileSync } from 'node:fs'
import { homedir } from 'node:os'
import { join, relative } from 'node:path'
import type { DesktopUpdateState } from '@sim/desktop-bridge'
import { app, autoUpdater as nativeUpdater, net } from 'electron'
import { MacUpdater } from 'electron-updater'
import { initUpdater } from '@/main/updater'

declare global {
var desktopUpdaterFixture: {
check(): void
install(): void
finishStaging(): void
failStaging(): void
read(): {
state: DesktopUpdateState
nativeArchive: string | null
installed: string[]
events: { name: string; data: unknown }[]
}
}
}

const directory = process.env.SIM_UPDATER_FIXTURE_DIR
const origin = process.env.SIM_UPDATER_FIXTURE_ORIGIN
if (!directory || !origin) throw new Error('Updater fixture configuration is missing')
app.setPath('userData', join(directory, 'user-data'))

void app.whenReady().then(() => {
const configPath = join(directory, 'updater.yml')
const cache = relative(join(homedir(), 'Library', 'Caches'), join(directory, 'cache'))
Comment thread
waleedlatif1 marked this conversation as resolved.
writeFileSync(configPath, `updaterCacheDirName: ${JSON.stringify(cache)}\n`)

let feed: Electron.FeedURLOptions | undefined
let nativeArchive: string | null = null
const installed: string[] = []
const events: { name: string; data: unknown }[] = []

/** Native verification and installation are simulated; MacUpdater and both HTTP transfers run. */
nativeUpdater.setFeedURL = (options) => {
feed = options
nativeArchive = null
}
nativeUpdater.checkForUpdates = () => {
void (async () => {
if (!feed) throw new Error('Native feed was not configured')
const response = await net.fetch(feed.url, { headers: feed.headers })
const manifest: { url: string } = await response.json()
const archive = await net.fetch(manifest.url)
nativeArchive = await archive.text()
})().catch((error) => nativeUpdater.emit('error', error))
}
nativeUpdater.quitAndInstall = () => {
if (nativeArchive === null) throw new Error('Cannot install before native staging')
installed.push(nativeArchive)
}

const updater = new MacUpdater()
updater.forceDevUpdateConfig = true
updater.disableDifferentialDownload = true
updater.updateConfigPath = configPath
updater.setFeedURL({ provider: 'generic', url: origin })
const handle = initUpdater({
getWindow: () => null,
events: { filePath: '', record: (name, data) => events.push({ name, data }) },
appOrigin: () => origin,
loadAutoUpdater: () => updater,
canSelfUpdate: async () => true,
probeOriginFeed: async () => false,
installStatePath: join(directory, 'update-install.json'),
})

globalThis.desktopUpdaterFixture = {
check: () => handle.check(),
install: () => handle.install(),
finishStaging: () => {
if (nativeArchive === null) throw new Error('Native transfer has not finished')
nativeUpdater.emit('update-downloaded', {}, '', nativeArchive, new Date(), '')
},
failStaging: () => nativeUpdater.emit('error', new Error('Native verification failed')),
read: () => ({ state: handle.getState(), nativeArchive, installed, events }),
}
})
209 changes: 209 additions & 0 deletions apps/desktop/e2e/updater.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
import { createHash } from 'node:crypto'
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { createServer } from 'node:http'
import { tmpdir } from 'node:os'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { _electron as electron, expect, test } from '@playwright/test'
import { getErrorMessage } from '@sim/utils/errors'
import { build } from 'esbuild'

const DESKTOP_DIR = fileURLToPath(new URL('..', import.meta.url))

test('the real MacUpdater waits for native staging, replaces old builds, and retries failed staging', async () => {
test.skip(process.platform !== 'darwin', 'Squirrel.Mac lifecycle')
const directory = mkdtempSync(join(tmpdir(), 'sim-updater-e2e-'))
const reportPath =
process.env.DESKTOP_UPDATER_REPORT_PATH ?? test.info().outputPath('updater.json')
let app: Awaited<ReturnType<typeof electron.launch>> | undefined
let offeredVersion = '2.0.0'
const requests: { path: string; status: number }[] = []
const checks: {
name: string
status: 'passed' | 'failed'
durationMs: number
error?: string
}[] = []
const check = async (name: string, run: () => Promise<void>) => {
const started = Date.now()
try {
await run()
checks.push({ name, status: 'passed', durationMs: Date.now() - started })
} catch (error) {
checks.push({
name,
status: 'failed',
durationMs: Date.now() - started,
error: getErrorMessage(error),
})
throw error
}
}
let snapshot: unknown
const server = createServer((request, response) => {
const path = new URL(request.url ?? '/', 'http://127.0.0.1').pathname
requests.push({ path, status: 200 })
if (path === '/latest-mac.yml') {
const archive = Buffer.from(offeredVersion)
response.end(
`version: ${offeredVersion}\nfiles:\n - url: Sim-${offeredVersion}-universal.zip\n sha512: ${createHash('sha512').update(archive).digest('base64')}\n size: ${archive.length}\n`
)
} else {
response.end(/^\/Sim-(.+)-universal.zip$/.exec(path)?.[1] ?? '')
}
})

try {
await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve))
const address = server.address()
if (!address || typeof address === 'string') throw new Error('Missing fixture address')
mkdirSync(join(directory, 'user-data'))
writeFileSync(
join(directory, 'package.json'),
JSON.stringify({ name: 'sim-updater-fixture', version: '1.0.0', main: 'main.cjs' })
)
await build({
entryPoints: [join(DESKTOP_DIR, 'e2e/fixtures/updater.ts')],
outfile: join(directory, 'main.cjs'),
bundle: true,
platform: 'node',
format: 'cjs',
external: ['electron'],
tsconfig: join(DESKTOP_DIR, 'tsconfig.json'),
plugins: [
{
name: 'approve-fixture-restart',
setup(builder) {
builder.onResolve({ filter: /^@\/main\/dialogs$/ }, () => ({
path: 'dialog',
namespace: 'fixture',
}))
builder.onLoad({ filter: /.*/, namespace: 'fixture' }, () => ({
contents:
'export async function showShellDialog() { return { response: 1, checkboxChecked: false } }',
}))
},
},
],
})
app = await electron.launch({
args: [directory, '--use-mock-keychain'],
env: {
...process.env,
SIM_UPDATER_FIXTURE_DIR: directory,
SIM_UPDATER_FIXTURE_ORIGIN: `http://127.0.0.1:${address.port}`,
},
})
const shell = app
const read = () => shell.evaluate(() => globalThis.desktopUpdaterFixture.read())
await expect
.poll(() => shell.evaluate(() => Boolean(globalThis.desktopUpdaterFixture)))
.toBe(true)

await check('first download waits for native staging', async () => {
await shell.evaluate(() => globalThis.desktopUpdaterFixture.check())
await expect.poll(async () => (await read()).nativeArchive).toBe('2.0.0')
expect((await read()).state).toEqual({
status: 'downloading',
version: '2.0.0',
percent: 100,
})
await shell.evaluate(() => globalThis.desktopUpdaterFixture.install())
expect((await read()).installed).toEqual([])
await shell.evaluate(() => globalThis.desktopUpdaterFixture.finishStaging())
expect((await read()).state).toEqual({ status: 'ready', version: '2.0.0' })
})

await check('replacement cannot restart into stale native update', async () => {
offeredVersion = '2.1.0'
await shell.evaluate(() => globalThis.desktopUpdaterFixture.check())
await expect.poll(async () => (await read()).nativeArchive).toBe('2.1.0')
expect((await read()).state).toEqual({
status: 'downloading',
version: '2.1.0',
percent: 100,
})
await shell.evaluate(() => globalThis.desktopUpdaterFixture.install())
expect((await read()).installed).toEqual([])
await shell.evaluate(() => globalThis.desktopUpdaterFixture.failStaging())
expect((await read()).state).toEqual({ status: 'error', version: '2.1.0' })
})

await check('cached retry installs only the verified replacement', async () => {
await shell.evaluate(() => globalThis.desktopUpdaterFixture.check())
await expect
.poll(async () => (await read()).state)
.toEqual({ status: 'downloading', version: '2.1.0', percent: 100 })
await expect.poll(async () => (await read()).nativeArchive).toBe('2.1.0')
await shell.evaluate(() => globalThis.desktopUpdaterFixture.finishStaging())
expect((await read()).state).toEqual({ status: 'ready', version: '2.1.0' })
await shell.evaluate(() => globalThis.desktopUpdaterFixture.install())
await expect.poll(async () => (await read()).installed).toEqual(['2.1.0'])
})
snapshot = await read()
await check(
'the next process distinguishes an incomplete update from a successful install',
async () => {
const checkpoint = readFileSync(join(directory, 'update-install.json'), 'utf8')
await app?.close()
app = await electron.launch({
args: [directory, '--use-mock-keychain'],
env: {
...process.env,
SIM_UPDATER_FIXTURE_DIR: directory,
SIM_UPDATER_FIXTURE_ORIGIN: `http://127.0.0.1:${address.port}`,
},
})
await expect
.poll(() => app?.evaluate(() => globalThis.desktopUpdaterFixture?.read().events))
.toContainEqual({
name: 'update_install_result',
data: { expected: '2.1.0', installed: '1.0.0', success: false },
})
await app.close()
writeFileSync(join(directory, 'update-install.json'), checkpoint)
writeFileSync(
join(directory, 'package.json'),
JSON.stringify({ name: 'sim-updater-fixture', version: '2.1.0', main: 'main.cjs' })
)
app = await electron.launch({
args: [directory, '--use-mock-keychain'],
env: {
...process.env,
SIM_UPDATER_FIXTURE_DIR: directory,
SIM_UPDATER_FIXTURE_ORIGIN: `http://127.0.0.1:${address.port}`,
},
})
await expect
.poll(() => app?.evaluate(() => globalThis.desktopUpdaterFixture?.read().events))
.toContainEqual({
name: 'update_install_result',
data: { expected: '2.1.0', installed: '2.1.0', success: true },
})
}
)
} finally {
if (!snapshot && app)
snapshot = await app
.evaluate(() => globalThis.desktopUpdaterFixture?.read())
.catch(() => undefined)
mkdirSync(dirname(reportPath), { recursive: true })
writeFileSync(
reportPath,
JSON.stringify(
{
passed: checks.length === 4 && checks.every((check) => check.status === 'passed'),
checks,
requests,
snapshot,
},
null,
2
)
)
await app?.close()
server.closeAllConnections()
await new Promise<void>((resolve) => server.close(() => resolve()))
rmSync(directory, { recursive: true, force: true })
}
})
1 change: 1 addition & 0 deletions apps/desktop/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ function main(): void {
updater = initUpdater({
getWindow: getMainWindow,
events,
installStatePath: join(userDataPath, 'update-install.json'),
appOrigin,
autoDownload: () => config.get('autoDownloadUpdates') ?? true,
setRelaunchPending: (pending) => {
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/main/observability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export type DesktopEventName =
| 'update_check'
| 'update_feed'
| 'update_downloaded'
| 'update_install'
| 'update_install_result'
| 'update_error'
| 'update_blocked_version'
| 'update_manual_mode'
Expand Down
Loading
Loading