stablyai/orca · warning

advertised-url-watcher.ts no longer contains \`${marker}\`

Error message

advertised-url-watcher.ts no longer contains \`${marker}\`

What it means

Thrown by the advertised-url-watcher benchmark as a drift guard: it asserts three exact source-string markers still exist in src/main/ports/advertised-url-watcher.ts before timing. The benchmark mirrors that file's hot-path logic (PER_PTY_BUFFER_LIMIT comparisons, mayContainHttpUrl/stripTerminalControls calls); if the production source changed shape, the benchmark's model is stale and would report misleading numbers.

Source

Thrown at config/scripts/advertised-url-watcher-benchmark.mjs:40

      if (existsSync(fileURLToPath(candidate))) {
        return { url: candidate.href, shortCircuit: true }
      }
    }
    return nextResolve(specifier, context)
  }
})

const source = readFileSync(
  new URL('../../src/main/ports/advertised-url-watcher.ts', import.meta.url),
  'utf8'
)
for (const marker of [
  "return mayContainHttpUrl(finalized) ? stripTerminalControls(finalized) : ''",
  'if (chunk.length >= PER_PTY_BUFFER_LIMIT)',
  'this.raw.length + chunk.length > PER_PTY_BUFFER_LIMIT'
]) {
  if (!source.includes(marker)) {
    throw new Error(`advertised-url-watcher.ts no longer contains \`${marker}\``)
  }
}

const { AdvertisedUrlWatcher, extractUrlCandidates, stripTerminalControls } = await import(
  new URL('../../src/main/ports/advertised-url-watcher.ts', import.meta.url).href
)

const BUFFER_LIMIT = 4096
const ITERATIONS = Number(process.env.ORCA_ADVERTISED_URL_BENCH_ITERATIONS ?? '10000')
const ROUNDS = Number(process.env.ORCA_ADVERTISED_URL_BENCH_ROUNDS ?? '12')
const WARMUP = Number(process.env.ORCA_ADVERTISED_URL_BENCH_WARMUP ?? '1000')

for (const [name, value] of [
  ['ORCA_ADVERTISED_URL_BENCH_ITERATIONS', ITERATIONS],
  ['ORCA_ADVERTISED_URL_BENCH_ROUNDS', ROUNDS],
  ['ORCA_ADVERTISED_URL_BENCH_WARMUP', WARMUP]
]) {
  if (!Number.isSafeInteger(value) || value <= 0) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Re-read src/main/ports/advertised-url-watcher.ts and update the three marker strings in config/scripts/advertised-url-watcher-benchmark.mjs to match the current source.
  2. Confirm the benchmark's mirrored BeforePtyBuffer / BeforeWatcher classes still model the pre-fix behavior you intend to measure against the new source.
  3. If the marker changed because of a real behavior change, re-baseline expected results so the comparison stays honest.
  4. Add a one-line comment near each production marker reminding editors to update the benchmark.

Example fix

// before — production source changed '>= PER_PTY_BUFFER_LIMIT' to '> PER_PTY_BUFFER_LIMIT'
// throw new Error('advertised-url-watcher.ts no longer contains `if (chunk.length >= PER_PTY_BUFFER_LIMIT)`')

// after — update the marker to match current source
// for (const marker of [
//   'if (chunk.length > PER_PTY_BUFFER_LIMIT)',
//   ...
// ])
Defensive patterns

Strategy: validation

Validate before calling

const { readFileSync } = require('node:fs')

function assertWatcherMarkersPresent(markers) {
  const src = readFileSync(new URL('../../src/main/ports/advertised-url-watcher.ts', import.meta.url), 'utf8')
  const missing = markers.filter((m) => !src.includes(m))
  if (missing.length) {
    throw new Error(`Benchmark out of sync — update markers: ${missing.join(' | ')}`)
  }
}
// assertWatcherMarkersPresent([...MARKERS]) at benchmark start

Prevention

When it happens

Trigger: A refactor of advertised-url-watcher.ts renamed a method, changed a comparison operator, or restructured the early-return conditional; the buffer limit constant was renamed; the function was split or its body rewritten.

Common situations: Performance work or a bug fix touched the watcher's ingest path; someone extracted stripTerminalControls into a helper; the PER_PTY_BUFFER_LIMIT guard was reworded (>= vs >) — each of these legitimately changes the marker text.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/441e1d339bae537f. Report an issue: GitHub.