Scalability Issues & Missing Dependency
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues
Operating System
Windows 11 version 25H2
Kiro Version
v0.8.86
Bug Description
The Kiro IDE agent chat panel randomly becomes unresponsive and displays a gray screen. The extension host becomes unresponsive, and the console logs show multiple errors related to missing modules and file read failures.
The root cause appears to be a combination of:
- Missing dependency: The is-electron module is missing from the win-ca package, causing setupCa to fail
- Scalability issue: The kiro.kiroagent storage directory accumulates an extremely large number of small files (150,000+ in my case, with only 6-8 active projects), causing significant I/O overhead
Steps to Reproduce
- Use Kiro IDE normally across multiple projects (6-8 workspaces in my case)
- Conduct multiple agent chat sessions over several weeks
- Open two Kiro windows simultaneously
- Observe the agent chat panel becoming gray/unresponsive
- Check the browser console (Help > Toggle Developer Tools) for errors
Expected Behavior
- The agent chat panel should remain responsive regardless of chat history size
- The extension should load without missing module errors
- Multiple Kiro windows should be usable concurrently without performance degradation
Conversation ID
No response
Additional Context
Console Errors Observed
[Extension Host] Failed to setup CA: Error: Cannot find module 'is-electron'
Require stack:
- ...\extensions\kiro.kiro-agent\node_modules\win-ca\lib\index.js
[Extension Host] rejected promise not handled within 1 second: Error: command 'kiro.reloadConfig' not found
[Extension Host] rejected promise not handled within 1 second: Error: command 'kiro.updateModelsList' not found
INFO Extension host (LocalProcess pid: 25988) is unresponsive.
ERR Unable to read file 'vscode-userdata:/.../kiro.kiroagent/.../.<hash>.json.tmp'
WARN UNRESPONSIVE extension host: 'kiro.kiroagent' took 89.56% of 478.742ms
This "file-per-key" storage pattern causes:
- Slow directory enumeration on startup
- High I/O overhead when reading/writing chat data
- NTFS performance degradation with large directory sizes
- The "Unable to read file" errors when temp files are created/deleted rapidly
- Suggested Architectural Improvement
Consider replacing the file-per-key storage strategy with an embedded database, such as:
- SQLite - Battle-tested, single-file storage
- DuckDB - Excellent for analytical queries on chat history
- LevelDB/RocksDB - Optimized for key-value workloads
- SynaDB - Rust-based, append-only log with compaction [disclaimer: this is my project]
An embedded database would:
- Consolidate 150k files into a single database file
- Provide O(1) key lookups via in-memory indexing
- Support compaction to reclaim space from deleted conversations
- Dramatically improve startup time and responsiveness
Environment Path: C:\Users<user>\AppData\Roaming\Kiro\User\globalStorage\kiro.kiroagent CPU Profile saved: C:\Users<user>\AppData\Local\Temp\exthost-d98d6d.cpuprofile exthost-d98d6d.cpuprofile
Update:
I've gone deeper into the Kiro.agent extension to identify the exact code paths causing these performance issues. To me, a lot of the overall performance issues reported are due to the following architectural choices.
StorageManager Class Location
File: kiro.kiro-agent/dist/extension.js
Class: StorageManager (lines 829621-829975)
Singleton: var Storage = new StorageManager(); (line 829999)
Key Storage Architecture
The StorageManager uses VS Code's filesystem API with a hierarchical key structure:
// Workspace ID generation (line 829648)
hash(data) {
return createHash("sha256").update(data).digest("hex").substring(0, 32);
}
// Initialization (line 829634)
initialize({ global, workspace }) {
this._globalUri = global;
this._currentWorkspace = workspace;
this.workspaceId = this.hash(workspace.fsPath); // SHA-256 truncated
mkdirSync(path.join(global.fsPath, this.workspaceId), { recursive: true });
}
Result: Each workspace gets a folder named with a 32-char hex hash. Within each workspace folder, individual conversations are stored as separate .chat files with hashed filenames.
Root Cause #1: O(n) Directory Enumeration
The critical bottleneck is in readFolderObjects (lines 829880-829894):
async readFolderObjects(options) {
const contents = await this.readFolder(options); // <- BLOCKS on ALL files
const objects = {};
for (const [name, data] of Object.entries(contents)) {
if (!name.endsWith(".json")) continue;
try {
objects[name] = JSON.parse(data); // <- Parses EVERY file
} catch {
throw new JsonParseError();
}
}
return objects;
}
And readFolder (lines 829861-829874) does:
async readFolder(options) {
const entries = await vscode.workspace.fs.readDirectory(fullPath);
const contents = {};
for (const [name, type] of entries) {
if (type === vscode.FileType.File) {
const data = await vscode.workspace.fs.readFile(filePath); // <- Sequential reads!
contents[name] = Buffer.from(data).toString("utf8");
}
}
return contents;
}
Impact: With 1,915 .chat files in my workspace folder, every call to readFolderObjects sequentially:
- Enumerates the directory (NTFS MFT scan)
- Opens each file
- Reads contents into memory
- Parses as JSON
This is O(n) where n = number of conversations, and it blocks the extension host.
Root Cause #2: Atomic Write Temp File Accumulation
The writeFile method (lines 829669-829686) uses an atomic write pattern:
async writeFile(path, data) {
const uriPath = this.getFullUri(path);
const tempPath = Uri.joinPath(uriPath, '..', `.${uriPath.path.split("/").pop()}.tmp`);
try {
await this.withRetries(async () => {
await this.verifyDirectory(uriPath);
await vscode.workspace.fs.writeFile(tempPath, Buffer.from(data)); // Write to .tmp
await vscode.workspace.fs.rename(tempPath, uriPath, { overwrite: true }); // Atomic rename
});
} catch (error) {
try {
await vscode.workspace.fs.delete(tempPath); // Cleanup on failure
} catch {} // <- Silent fail!
throw this.classifyFileWriteError(error, path);
}
}
Problem: If the process crashes between writeFile and rename, or if the cleanup in the catch block fails silently, orphan .tmp files accumulate. When readFolder encounters these during enumeration, it triggers the errors:
ERR Unable to read file 'vscode-userdata:/.../.<hash>.json.tmp'
Storage Analysis
C:\Users\...\globalStorage\kiro.kiroagent\
├── index/
│ ├── index.sqlite -> 2,412,662,784 bytes (2.4 GB!)
│ ├── index.sqlite-shm -> 32,768 bytes
│ ├── index.sqlite-wal -> 64,626,352 bytes
│ └── autocompleteCache.sqlite -> 3,018,752 bytes
│
├── sessions/
│ ├── sessions.json -> 8,773 bytes (49 session entries)
│ └── {uuid}.json -> 146 bytes each (x50 files)
│
└── e765b9b9350b0314944ec7ef9bf9b980/ <- ONE workspace
├── *.chat -> 1,915 files (!!)
└── Average size -> ~250 KB each
Key Observation: The index/ folder already uses SQLite with WAL mode. Kiro knows how to use databases - the conversation storage just wasn't given the same treatment.
@AnilMaktala, I know you closed it, but I think I found where the performance issues are coming from!