Commit Graph

355 Commits

Author SHA1 Message Date
Catriel Müller 8b5fd89708 refactor(cli): drop morphsdk compat layer and CJS build plugin
The compat re-export and the build's CJS-redirect plugin only existed to work
around the 'G9' crash that's actually a Bun --splitting bug (now fixed by
splitting:false). With splitting off the morphsdk ESM barrel bundles cleanly,
so import it directly in warpgrep.ts and remove the indirection.
2026-06-05 16:49:16 -03:00
Catriel Müller 4ca4700359 fix(cli): disable Bun code-splitting to fix baseline startup crash
The real cause of the 'Exported binding G9 needs to refer to a top-level
declared variable' SyntaxError is a Bun 1.3.14 --splitting codegen bug
(oven-sh/bun#25621), not @morphllm/morphsdk. With splitting:true Bun emits
invalid cross-chunk re-exports (import{vn as G9}) that crash the compiled
baseline binary at startup. Disabling splitting produces a valid binary;
verified the 'as G9' artifact is gone from the compiled output.
2026-06-05 16:35:18 -03:00
Catriel Müller d7df07a1eb fix(cli): resolve morphsdk client.cjs via exported subpath
The morphsdkCjsPlugin called require.resolve on the raw dist/.../client.cjs
path, which is not an exported subpath in the package's exports map, so Bun
aborted the release build with 'Cannot find module ...client.cjs'.

Resolve through the public specifier @morphllm/morphsdk/tools/warp-grep/client
instead — require.resolve uses the package's "require" condition, mapping it
straight to client.cjs.
2026-06-05 16:22:01 -03:00
Catriel Müller bd1e3e4a14 fix(cli): use build plugin to redirect morphsdk ESM barrel to CJS
The createRequire approach from #10955 did not prevent the Bun ESM
splitter from generating invalid output. Bun 1.3.14 with
`conditions: ["browser"]` resolves @morphllm/morphsdk via the "import"
condition (pre-split ESM barrel) even inside createRequire() calls,
pulling in 52 chunk-*.js files that cause:

  SyntaxError: Exported binding 'G9' needs to refer to a top-level declared variable.

Fix: add a morphsdkCjsPlugin in script/build.ts using Bun's onResolve
API to redirect the module specifier to the absolute path of client.cjs
before the ESM splitter is invoked. client.cjs is a self-contained
~2300-line CJS bundle with no chunk-*.js imports.

morphsdk.ts is simplified to a plain re-export — the CJS redirection
happens at build time, no source-level workaround needed.
2026-06-05 15:52:14 -03:00
Catriel Müller 78117d1a25 fix: validate CLI models snapshot before release builds 2026-06-05 09:28:40 -03:00
Josh Lambert 6cab5f18e7 fix(cli): isolate release target builds 2026-06-04 22:40:06 -04:00
Catriel Müller 0af454de08 fix(cli): preserve npm package metadata 2026-06-04 14:21:38 -03:00
Catriel Müller 1cdc39856f fix(cli): restore packaged console startup 2026-06-03 12:35:42 -03:00
Igor Šćekić 8aaa62c794 Session export capture (#10611)
* feat(session-export): scaffold module with config constants

* feat(session-export): add zstd compression wrapper

* feat(session-export): event and envelope type definitions

* feat(session-export): eligibility check with kill-switch

* feat(session-export): org signal collector with auth resolver

* feat(session-export): worker SQLite schema and storage helpers

* feat(session-export): content-addressed chunker with zstd dedup

* feat(session-export): client-side light scrubber

* feat(session-export): IPC contract and inbox with back-pressure

* feat(session-export): persist scrubbed events with chunked payloads

* feat(session-export): worker entry point with inbox drain loop

* feat(session-export): main-thread capture module

* feat(session-export): workspace baseline and delta fibers

* feat(session-export): sync subscriber and tool io chunking

* feat(session-export): bootstrap wiring and compaction hook

* feat(session-export): wire capture hooks into sessions

* feat(session-export): uploader and buffer cap

* chore(session-export): annotate shared session hooks

* changeset(session-export): add release note

* fix(session-export): keep bootstrap non-blocking without instance context

* feat(session-export): respawn worker after failures

* test(session-export): add performance budget assertions

* test(session-export): add worker end-to-end smoke test

* fix(session-export): strip identity and high-risk baseline paths

* test(session-export): gate perf assertions for stable sweeps

* fix(session-export): bundle worker in single-file builds

* fix(session-export): make capture envelopes cloneable

* fix(session-export): drain worker on CLI shutdown

* feat(session-export): capture workspace baseline and deltas

* fix(session-export): preserve request metadata

* test(session-export): cover request metadata capture

* feat(cli): send indexed session export batches

* feat(cli): authorize session export uploads

* fix(cli): flush session export shutdown uploads

* feat(cli): optimize session export replay payloads

* fix(cli): include session export surface metadata

* fix(session-export): decrement chunk refs after upload

decRefChunks was never called, so chunk ref_count stayed at 1 (or
higher with dedup) and DELETE FROM chunk WHERE ref_count <= 0 never
matched. Chunks accumulated in the local SQLite buffer until the 50 GB
cap. Call decRefChunks alongside markUploaded so deleteUploaded can
reclaim the rows.

* fix(session-export): add periodic uploader flush timer

flushIntervalMs and retryBackoffMaxMs were both defined in config and
neither was referenced anywhere; scheduleFlush only ran on inbound
events or reconnect. After a 5xx or network failure the row was backed
off for 1 s, but if no further event arrived the retry never fired and
the events stranded until the CLI restarted. Drive a periodic flush
from a setInterval, unref the handle so it doesn't pin the process, and
clear it from a new dispose() hook the worker calls on shutdown.

* fix(session-export): stop emitting absolute workspace root in baseline

CaptureMetadata.root was the literal absolute filesystem path
(/Users/<name>/Projects/<repo>), shipped in every
workspace_baseline_completed event and not stripped by handlers'
identity filter. The field was set but never read anywhere downstream
— file paths in the baseline are already relative, so the root added
no replay signal. Remove the field outright.

* fix(session-export): cap pendingEvents result set

The SELECT had no LIMIT clause, so under a backlog (network outage,
crashed receiver) it would materialize the full pending table into a
JavaScript array before the byte-limit truncation applied. With a
50 GB buffer cap that is hundreds of MB of heap inside the worker per
drain. Add LIMIT 500 — the drain loop already re-queries until empty,
so no events are missed.

* fix(session-export): exponential retry backoff up to retryBackoffMaxMs

Both the 5xx and network-error branches always retried after the floor
delay regardless of how many attempts had already failed, and
retryBackoffMaxMs was unreferenced. During a sustained outage every
session re-tried at roughly 1 Hz against the dead receiver. Surface
upload_attempts on EventRow and compute the next delay as
min * 2^attempts capped at max.

* fix(session-export): evict superseded workspace snapshots on remember

createWorkspaceProvider retained every captured snapshot — in-memory
and inside the persisted state file — even after the session moved on
to a newer one. For a 1k-file repo over a 100-turn session that is
~2 GB of unreachable heap plus a state file that grows monotonically.
Drop the previous snapshot for the session on remember() when no other
session still references it.

* fix(session-export): anchor aws_secret_key scrubber to key name

The bare 40-char base64 pattern matched every 40-character hex string,
including all git commit SHAs. Tool outputs, diffs, and conversation
messages were silently rewritten as <<REDACTED:aws_secret_key>>,
destroying lineage information in training data. Require the key name
context — naked secrets in unstructured text are rare and the .env /
.aws/credentials high-risk path strip already covers the common case.

* fix(session-export): preserve root linkage in SyncSubscriber events

SyncSubscriber hardcoded rootSessionId = sessionId on every tool,
permission, and feedback event, so sub-agent sessions lost their root
linkage and a future training pipeline could not reconstruct the
agent topology from these side-channel events. Expose the rootSessionId
mapping from Capture and plumb it through the same pattern as
getTurnId.

* fix(session-export): atomic chunk GC after upload

markUploaded + decRefChunks + deleteUploaded were three separate SQL
statements; a crash between markUploaded and decRefChunks would leave
events flagged uploaded (never retried) and chunks with stale
ref_count (never reclaimed by deleteUploaded). Bundle the three calls
into a single transactional commitUploaded helper so either all three
land or none of them do.

* fix(session-export): wait on transient sqlite locks

* fix(session-export): snapshot current workspace directory

* fix(cli): preserve Kilo model export metadata

* fix(cli): send anon id for session export

* fix(cli): fallback to telemetry anon id

* chore(cli): annotate session export config test

* chore: remove session export docs

* fix(cli): harden session export uploads

* fix(cli): preserve stream lifecycle for session export

* fix(kilo-docs): exclude session export ingest link

* fix(cli): restrict session export workspace sync to git repos

* chore: remove session export changeset

* fix(cli): tighten session export payload types

* fix(cli): type session export model payloads

* fix(cli): simplify session export cleanup

* fix(cli): avoid session export shutdown race

* refactor(cli): use drizzle for session export storage

* fix(cli): finalize session export sqlite statements

* fix(cli): link compaction exports to root sessions

* fix(cli): stop exporting raw stream parts

* fix(cli): prune stale workspace snapshots

* refactor(cli): clarify chunk ref counting

* test(cli): clarify dropped upload assertions

* ci: avoid visual path filter action failure

* fix(cli): preserve in-flight workspace snapshots

* fix(cli): stop uploading baseline start events

* fix(cli): trim redundant export metadata

* fix(cli): trim workspace export bookkeeping

* fix(cli): fold terminal outcome into tool exports

* fix(cli): dedupe request context in export batches

* fix(cli): normalize compaction export payloads

* fix(cli): avoid duplicate tool result exports

* test(cli): align session export expectations

* fix(cli): run secretlint during session export scrubbing

* fix(cli): keep retried export batches contiguous

* fix(cli): include agent info in session exports

* fix(cli): flush pending session exports on serve startup

* fix(cli): drop exports when scrubbing fails

* fix(cli): narrow secretlint value extraction

* fix(cli): limit exported agent info

* test(cli): remove brittle agent export source assertion

* fix(cli): ignore corrupt session export workspace state

* fix(cli): keep session export close best effort

* fix(cli): avoid following session export symlinks

* fix(cli): preserve session export chunk ref counts

* fix(cli): retry transient session export uploads

* fix(cli): validate session export ingest endpoint

* fix(cli): tolerate missing export token details

* fix(cli): fail closed on session export org lookup

* fix(cli): decode session export permission replies

* fix(cli): finalize session export on stream close

* fix(cli): bound session export baseline timeout

* fix(cli): avoid persisting workspace file contents

* fix(cli): bound workspace snapshot capture

* fix(cli): validate session export worker messages

* fix(cli): revoke stale session export eligibility

* fix(cli): scope session export workspaces

* fix(cli): extend session export shutdown flush

* fix(cli): infer free Kilo models for export

* fix(cli): avoid duplicate chunk refs

* fix(cli): throttle session export uploads

* fix(cli): harden session export capture

* feat: disclose free model data collection (#10767)

* feat: disclose free model data collection

* chore(cli): document free model footer sorting

* fix(vscode): add free model data translations

* fix: simplify free model data label

* fix: simplify data collection badges

* fix: remove duplicate model info disclosure

* fix: restore composer data tooltip

* fix: align jetbrains data collection indicator

* fix: align free model data indicators

* fix(vscode): show data collection in model preview

* fix: limit data indicators to kilo gateway

* test(cli): relax prompt cancel timeout

* test(cli): annotate prompt cancel timeout

* test(cli): classify prompt queue runtime test

* fix(cli): defer session export startup
2026-06-02 13:58:42 +00:00
marius-kilocode ece920c1cc Merge remote-tracking branch 'origin/main' into trial/kilo-opencode-v1.14.42
# Conflicts:
#	bun.lock
#	packages/opencode/src/cli/cmd/run.ts
#	packages/opencode/src/cli/cmd/tui/context/tui-config.tsx
#	packages/opencode/src/cli/cmd/tui/thread.ts
#	packages/opencode/src/cli/cmd/tui/ui/dialog-alert.tsx
#	packages/opencode/src/kilocode/server/httpapi/instance.ts
#	packages/opencode/src/kilocode/server/instance.ts
#	packages/opencode/src/server/routes/global.ts
#	packages/opencode/src/server/routes/instance/index.ts
#	packages/opencode/src/server/routes/ui.ts
#	packages/opencode/test/kilocode/global-config-refresh.test.ts
#	packages/opencode/test/kilocode/server/httpapi-public.test.ts
2026-06-02 10:42:14 +02:00
marius-kilocode 0f271a39d7 resolve merge conflicts 2026-06-01 15:20:54 +02:00
marius-kilocode 7cc6080646 refactor: kilo compat for v1.14.42 2026-06-01 12:51:31 +02:00
Catriel Müller cf85e0d51f feat: embedded kilo console 2026-05-29 21:01:45 -03:00
marius-kilocode 9fbd5479b0 fix(cli): isolate semantic indexing in a worker 2026-05-28 10:47:41 +02:00
Imanol Maiztegui b6523c0d91 resolve merge conflicts 2026-05-22 09:01:40 +02:00
Imanol Maiztegui f7816a9eeb refactor: kilo compat for v1.14.41 2026-05-21 14:48:36 +02:00
marius-kilocode 371b7e8ae6 fix(cli): resolve packaged tree-sitter wasm paths 2026-05-20 22:44:05 +02:00
Imanol Maiztegui e68fd6781d resolve merge conflicts 2026-05-15 13:13:17 +02:00
Imanol Maiztegui b7a7ecf449 refactor: kilo compat for v1.14.34 2026-05-15 09:25:13 +02:00
Mark IJbema a2bb05726f Merge remote-tracking branch 'origin/main' into markijbema/kilo-opencode-v1.14.33 2026-05-07 10:44:08 +02:00
Mark IJbema 5f5853a2e3 fix: align Kilo source/tests with v1.14.33 API renames
Mechanical follow-up to the v1.14.33 merge:

- src/server/routes/ui.ts: remove dead proxy fallback (proxy/createHash/csp were intentionally commented out by Kilo; the Effect/Promise paths still referenced them)
- src/kilocode/{plan-followup,session/prompt}.ts: pass Instance.current to Session.plan(input, instance)
- src/server/routes/instance/httpapi/handlers/session.ts: cast PromptPayload spread to PromptInput (readonly→mutable schema/runtime mismatch)
- src/plugin/index.ts: cast external @opencode-ai/plugin auth plugins through unknown to bridge to local @kilocode/plugin types
- script/build.ts: drop duplicate sourcemap key (Kilo's release-aware version wins)
- test/kilocode/indexing-{startup,worktree}.test.ts: switch from Instance.disposeAll/InstanceBootstrap-as-effect to disposeAllInstances/getBootstrapRunEffect
- test/kilocode/model-cache-org.test.ts: convert Instance.provide init from async fn to Effect
- test/kilocode/kilo-loader-auth.test.ts: drop ModelsDev.Data.reset() (no longer exists)
- test/kilocode/plan-exit-detection.test.ts, plan-followup.test.ts: pass Instance.current to Session.plan
- test/kilocode/{plan-followup,session-list}.test.ts: replace Session.list() with AppRuntime.runPromise(Session.Service.use((svc) => svc.list()))
2026-05-06 21:53:19 +02:00
Mark IJbema 1ea9ad2af0 resolve merge conflicts 2026-05-06 21:32:26 +02:00
Catriel Müller f40970557f refactor: renegare sdk 2026-05-06 14:26:06 -03:00
Mark IJbema a77843cbab refactor: kilo compat for v1.14.33 2026-05-06 12:13:06 +02:00
Catriel Müller 0de07760a7 ci: bump actions to Node 24 and surface flaky tests to the UI
- Bump all active workflows to action versions that natively target Node 24:
  checkout@v6, setup-node@v6, cache@v5, upload-artifact@v7, download-artifact@v8.
  Resolves the "Node.js 20 is deprecated" warning in CI logs. The kept
  `FORCE_JAVASCRIPT_ACTIONS_TO_NODE24` env stays as a no-op safety net (also
  in upstream OpenCode).
- test-runner: when running under GitHub Actions, emit a `::warning::`
  annotation per flaky file and append a markdown table to
  `$GITHUB_STEP_SUMMARY`. mikepenz/action-junit-report already surfaces
  failures from the JUnit XML, but flakies pass cleanly on retry and were
  invisible in the UI.
2026-05-05 12:53:03 -03:00
Catriel Müller 3f5ed52cd3 refactor: include quarantine on the same runner file 2026-05-05 12:53:03 -03:00
Catriel Müller c21a1b855f fix(cli): produce well-formed JUnit when bun emits nested testsuites
The per-file JUnit merge was walking `<testsuite>` tags by hand and closing
on the first `</testsuite>` it found. Bun's junit reporter nests one
`<testsuite>` per `describe` block inside an outer `<testsuite>` for the
file itself, so the inner close was matched and the outer one got dropped.
Every file contributed one unclosed `<testsuite>` to the merged output,
pushing XML depth up until mikepenz/action-junit-report's sax parser
failed with "Unexpected close tag" (and xmllint with "Excessive depth").

Switch to grabbing everything between the outer `<testsuites ...>` and
`</testsuites>` of each file's XML — nested structure is preserved
verbatim, no custom walking needed. Read aggregate counts from the root
`<testsuites>` attributes so nested `tests="..."` attrs don't get
double-counted either.

Validated locally: `xmllint --noout` passes on the merged output for a
mix of files with and without nested describes.
2026-05-05 12:53:03 -03:00
Catriel Müller 3d063eb47f test(cli): stabilize flaky unit test CI
- Lower default runner concurrency from `os.cpus().length` to `min(4, cpus)`.
  The bottleneck in CI is shared resources (OAuth callback ports, global
  filesystem like `~/.local/share/kilo`), not CPU, so eight parallel Bun
  processes were triggering port/FS races instead of going faster.
- Raise per-test timeout from 30s to 60s. Slow `spawn` on Windows was
  tripping the 30s limit on tests that were just slow, not broken
  (e.g. `session/prompt.test.ts` at ~86s, `provider/provider.test.ts` at ~54s).
- Retry failing files once and surface them as FLAKY in the summary plus a
  dedicated section. Bugs still fail on every attempt; contention recovers.
- Drop CI runners from 8vcpu to 4vcpu to match upstream OpenCode — with
  concurrency capped at 4, the extra cores bought us nothing.
2026-05-05 12:53:03 -03:00
marius-kilocode c0c982befd test(cli): allow explicit quarantined test runs 2026-05-05 13:47:34 +02:00
marius-kilocode 279a86c2b6 test(cli): quarantine flaky MCP OAuth browser tests 2026-05-05 13:43:00 +02:00
Imanol Maiztegui 6cd26f31c6 fix(cli): skip web UI embed when packages/app is missing
The upstream build script tries to bundle packages/app/ which was removed in #9845. Guard the embed step so the CLI build still works, and revert the --skip-embed-web-ui workaround from #9885 since it is no longer needed.
2026-05-05 10:10:03 +02:00
kiloconnect[bot] 325bdae8a4 chore(cli): annotate MCP OAuth fix 2026-05-04 14:29:05 +00:00
kiloconnect[bot] acc30a6458 feat(mcp): defer oauth callback server startup
Move the initialization of the MCP OAuth callback server from the layer setup to the point where browser authentication is actually required. This prevents unnecessary port binding when authentication is not needed.

Additionally, improve the test runner's XML parsing to correctly handle multiple testsuite attributes and ensure tags are matched accurately.

- Update `packages/opencode/src/mcp/index.ts` to call `McpOAuthCallback.ensureRunning` only upon `UnauthorizedError`.
- Refactor `packages/opencode/script/test-runner.ts` to use a more robust `open` and `sum` logic for test results.
- Add verification to `packages/opencode/test/mcp/oauth-auto-connect.test.ts` to ensure the callback server remains inactive when not needed.
2026-05-04 14:14:09 +00:00
Mark IJbema 3f7037549e resolve merge conflicts 2026-04-30 16:25:46 +02:00
Dax Raad 8ba374fefa ci: enable sourcemaps for beta releases
Generate linked sourcemaps when building beta releases to help users
debug issues with readable stack traces.
2026-04-30 00:42:22 -04:00
Mark IJbema 7d375b93ee refactor: kilo compat for v1.14.29 2026-04-29 17:24:20 +02:00
kiloconnect[bot] 6458b593c0 build(cli): shrink publish artifact to unblock build-vscode download
The kilo-cli artifact ballooned from ~1 GB to 1.83 GB after the codebase
indexing PR started emitting external sourcemaps and copying tree-sitter
wasms per target. The resulting 1.83 GB artifact triggered a silent
partial-extract in actions/download-artifact@v4 during build-vscode,
causing the 2026-04-29 publish run to fail with 'CLI binary not found'.

- Skip external sourcemaps in release builds (~620 MB saved across
  12 targets); dev builds still emit maps for local debugging.
- Exclude any stray .map files from the CI artifact and skip zstd
  compression on binaries (saves ~60 s on upload and reduces the
  chance of partial-extract bugs on the download side).

Refs: PR #6966 (commit f74d54c4), run 25096325401
2026-04-29 09:06:16 +00:00
Mark IJbema cbe55103b1 fix(cli): publish docker image to ghcr.io/kilo-org/kilocode
The image was still being pushed as ghcr.io/kilo-org/kilo, which GHCR
links to the archived Kilo-Org/kilo repo. Rename to kilocode so future
releases create a package under the active repo, and document the
one-time GHCR package-visibility/repo-link follow-up in RELEASING.md.
2026-04-28 17:29:31 +02:00
Marian Alexandru Alecu 5bd891cea0 Merge branch 'main' into feat/cli-local-run 2026-04-28 10:07:32 +03:00
Dax f25f1485d5 refactor: remove module barrels (#24554) 2026-04-27 14:33:33 -04:00
Josh Holmer f74d54c431 feat: implement codebase indexing (#6966)
* feat(core): implement codebase indexing

* feat(core): gate indexing behind experimental flag

* fix: improvements to slow provider startups and indexing init blocking the world

* test(cli): stabilize indexing startup tests

* test(cli): avoid indexing startup hang

* test(cli): avoid CI startup leaks

* test(cli): annotate provider test change

* fix(indexing): tighten dependency surface

* refactor(cli): move indexing logic into kilocode paths

* test(cli): skip flaky shell cancel prompt cases

* fix(cli): tolerate slow Windows worktree cleanup

* fix(vscode): authenticate indexing status fetch

---------

Co-authored-by: Marius <marius@kilocode.ai>
2026-04-27 17:43:27 +02:00
Alex Alecu 034f4d4e8d Merge remote-tracking branch 'origin/main' into feat/cli-local-run
# Conflicts:
#	package.json
2026-04-27 15:08:21 +03:00
Alex Alecu e04dd779e6 fix(cli): make dev-setup work from local builds and hide it in releases
The `Installation.isLocal()` gate in dev-setup rejected locally-built
binaries because KILO_CHANNEL bakes the git branch name, not "local".
`detectRepo()` also failed inside a Bun single-file executable where
`import.meta.url` resolves to a `/$bunfs/` virtual path.

Introduce a build-time `KILO_BUILD_KIND` flag (source/release) derived
from `Script.release`, guard dev-setup/dev-alias registration on it,
and rewrite `detectRepo()` to try KILO_DEV_REPO, `import.meta.url`
(skipping bunfs), `process.execPath`, then `process.cwd()`.
2026-04-24 19:02:05 +03:00
Imanol Maiztegui 5e519256d2 resolve merge conflicts 2026-04-24 16:58:05 +02:00
Imanol Maiztegui 5bd50c6fe2 refactor: kilo compat for v1.14.22 2026-04-24 14:18:25 +02:00
Imanol Maiztegui 7d1c046f10 resolve merge conflicts 2026-04-24 10:06:31 +02:00
Imanol Maiztegui 3f507b9427 refactor: kilo compat for v1.14.17 2026-04-23 15:22:41 +02:00
Imanol Maiztegui 9cde05f934 resolve merge conflicts 2026-04-23 11:25:43 +02:00
Imanol Maiztegui aeb800dd47 refactor: kilo compat for v1.4.9 2026-04-22 16:17:14 +02:00
Kit Langton ecc06a3d8f refactor(core): make Config.Info canonical Effect Schema (#23716) 2026-04-21 14:06:47 -04:00