[Bug]: Kimi integration rewrites the whole config.toml, dropping comments and reshaping `[[hooks]]` into an inline array
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start by tracing the Kimi integration's read and write path that uses Bun.TOML.parse and renderToml; inspect the before and after snapshots in integrations/snapshots/kimi/. Check how the DSH integration uses sourcePreservingYaml for comparison. Done means Kimi overwrite and disable operations update only OpenCodex-owned keys while preserving comments, [[hooks]] tables, and the rest of the file.
Written by the indexing model from the issue text.
Description
Environment
- OpenCodex 2.100.8 (macOS 27.2.1)
- Kimi Code CLI 2.8.0
- Orca 1.4.277 manages a hooks block in the same
~/.kimi-code/config.toml
What happened
Each Kimi overwrite or disable operation (both appear in ~/.opencodex/integrations/journal.jsonl) reads config.toml with Bun.TOML.parse and writes the whole document back with renderToml. The rewrite has three side effects:
- All comments are lost, including the
# >>> orca-managed-kimi-hooks … >>>/<<<markers that another tool uses to find the block it owns. - Arrays of tables are flattened.
renderTomltreats any non-record value as a scalar, so the 9[[hooks]]tables become one top-level inline array:hooks = [{ event = "SessionStart", … }, …]. That is still valid TOML, but no other tool would expect that layout. - Key order and formatting change throughout the file, not just in the
providers.opencodex/models."opencodex/…"entries the integration owns.
The integration's own pre-write snapshots in integrations/snapshots/kimi/ show the before and after: the snapshot before the overwrite has the marker block and 9 [[hooks]] tables; the snapshot before the disable (taken 4 seconds later) has an inline hooks = [...] line and no comments.
Downstream effect: Orca no longer finds its markers, reinstalls its hooks block, and the file ends up with hooks defined twice. Kimi then fails to load the config (Cannot mutate immutable namespace ('hooks',)), and every Kimi call fails until someone fixes the file by hand. This happened twice in four days (one overwrite, then one overwrite + disable).
Expected
Edit only the keys the integration owns and preserve everything else byte for byte. The DSH integration already does this through sourcePreservingYaml; Kimi's TOML could use the same approach:
- Use a format-preserving TOML edit (a comment- and layout-preserving TOML library, or targeted text splicing of the
[providers.opencodex]table and the[models."opencodex/…"]tables). - At minimum,
renderTomlshould emit arrays of tables as[[name]]sections rather than inline arrays, and keep top-level comments.
Repro
- Put a comment and an array of tables in
~/.kimi-code/config.toml:
# keep me
default_model = "kimi-code/k3.1-pro"
[[hooks]]
event = "Stop"
command = "echo hi"
timeout = 10
- Enable, refresh, or disable the Kimi integration in OpenCodex.
- The comment is gone and the hook is now
hooks = [{ event = "Stop", command = "echo hi", timeout = 10 }].
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.3k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 814
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lidge-jun/opencodex
-
bug gui platform
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
lidge-jun/opencodex#9172 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Feature]: Include provider, model and account label in the `upstream failure` service.log linePossibly taken @EnesKartal claimed this 4 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lidge-jun/opencodex#9057 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offersPossibly taken @sedoll claimed this 6 days ago. Opencatalog provider provider-compatibility
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
lidge-jun/opencodex#9037 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
bug cli
Difficulty 4/5 3-5 days Newbie friendliness 52/100
lidge-jun/opencodex#9171 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
account-pool enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
All issues in lidge-jun/opencodex
Similar issues
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 64/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
ranxianglei/billion-context#7860 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
agent-oc-find-bugs api complexity → simple payment-methods recurring contributions reviewed stripe
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
opencollective/opencollective#9177 ·