Skip to content

fix(cli): restore question tool availability in code mode#9869

Merged
catrielmuller merged 7 commits into
mainfrom
catrielmuller/fix-9823
May 4, 2026
Merged

fix(cli): restore question tool availability in code mode#9869
catrielmuller merged 7 commits into
mainfrom
catrielmuller/fix-9823

Conversation

@catrielmuller
Copy link
Copy Markdown
Contributor

@catrielmuller catrielmuller commented May 4, 2026

Resolve #9856
Resolve #9823

Summary

When the build agent was renamed to code in patchAgents(), the permission ruleset was being rebuilt from scratch using only defaults (which denies question) plus semantic_search: "allow". This discarded the question: "allow", suggest: "allow", and plan_enter: "allow" that the original build agent had, causing the question and ask_followup_question tools to be denied in code mode.

The fix merges agents.build.permission into the new permission set so all original allows are preserved before adding the Kilo-specific semantic_search: "allow".

Comment thread packages/opencode/src/kilocode/agent/index.ts
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 4, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/agent/index.ts 288 semantic_search allow is merged after user permissions, so it overrides explicit user denies in code mode.
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (5 files)
  • .changeset/fix-code-mode-question-tool.md - 0 issues
  • packages/opencode/src/cli/cmd/tui/config/tui-migrate.ts - 0 issues
  • packages/opencode/src/cli/cmd/tui/context/local.tsx - 0 issues
  • packages/opencode/src/kilocode/agent/index.ts - 1 carried-forward issue
  • packages/opencode/src/util/filesystem.ts - 0 active issues; previous temp-file collision finding is resolved by the random suffix

Fix these issues in Kilo Cloud


Reviewed by gpt-5.5-20260423 · 684,608 tokens

export async function write(p: string, content: string | Buffer | Uint8Array, mode?: number): Promise<void> {
try {
// kilocode_change start - atomic write via temp-file + rename to avoid partial reads on concurrent saves
const tmp = `${p}.${process.pid}.${Date.now()}.tmp`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Temp file names can collide during concurrent writes

This temp path only uses the target path, process id, and millisecond timestamp. Two writes to the same file from the same process in the same millisecond will share tmp; one write can overwrite the other's temp content, and the second rename can fail with ENOENT after the first rename moves the shared temp file. Since this helper is meant to make concurrent saves safer, add a unique component such as a random suffix or monotonic counter.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have existing ENOENT issues so if this is true we should fix it

@catrielmuller catrielmuller merged commit 1bb2042 into main May 4, 2026
17 checks passed
@catrielmuller catrielmuller deleted the catrielmuller/fix-9823 branch May 4, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants