Repository navigation
Docs: Say what Claude Code's disable restores, and drop the fixed #1289 issue - #1675
Conversation
…soctl#1289 issue disable restores every value, but it writes the file again with sorted keys and a 2-space indent. Say so, and point to settings.json.bak for the original bytes. rossoctl#1343 fixed rossoctl#1289: disable now does not change a key that changed after enable. Remove it from Known issues and describe the new behaviour. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 57 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Fixes review: - settings.json.bak holds the file from before the first enable, not later edits - disable also splits arrays and escapes &, < and >, not only key order and indent - Codex docs and comment no longer name the closed rossoctl#1289 as the tracker Files: - cmd/agentop/cmd_codex.go - docs/agents/claude-code.md - docs/agents/codex.md Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
Summary
I checked the doc changes against the code at the head commit and they hold up. #1289 is closed as completed, fixed by #1343 (merged 2026-10-12, first released in v0.9.0). changedSinceEnable and printClaudeCodeLeft do what the new paragraph says. writeSettings uses json.MarshalIndent(doc, "", " "), so the output has sorted keys and a 2-space indent. TestClaudeCodeDisable_LeavesAKeyChangedSinceEnable and TestForwardProxy_Streaming_HeartbeatDeliveredWhileUpstreamOpen both exist. Nothing blocks merge. I left three suggestions inline: two caveats the new wording leaves out, and one about how far settings.json.bak can be trusted.
One follow-up outside this diff: docs/agents/codex.md (lines 72 and 81) still says the "did this change since enable" comparison "is tracked by #1289". That issue is now closed and the fix only covers Claude Code, so that page should name a new issue or say Codex does not have the check.
Author: huang195 (MEMBER — maintainer)
Areas reviewed: Docs (checked against cmd/agentop/cmd_claudecode.go, cmd_uninstall.go, setup_files.go, setup_step_claudecode.go)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes. Nit: the subject is 77 characters, over the 72 guideline.
CI status: DCO, pre-commit and PR-title checks pass. Some Go jobs are still pending, but this PR changes docs only.
| `~/.cortex/claude-code-state.json`. `disable` removes only the keys `enable` added, and | ||
| puts back any value it recorded. `agentop uninstall` runs the same `disable`. | ||
| puts back any value it recorded. It does not change a key whose value changed after | ||
| `enable`, and it names each key it did not change. `agentop uninstall` runs the same `disable`. |
There was a problem hiding this comment.
suggestion: This is true only when the record has Written. changedSinceEnable returns false (meaning "not changed") when there is no record, or when the record was written before #1343. In those cases disable still removes the key or restores Prior over the edit, which is the old #1289 behaviour. That covers a record from v0.8.x where neither enable nor setup --claude-code has run since the upgrade (topUpWritten only fills Written in on a no-change re-run), and also an install where writing the record failed. Consider adding something like: "This needs a record written by v0.9.0 or later; re-running enable adds it to an older one."
Nit: "names each key" is exact for configure claude-code disable, but agentop uninstall goes through claudeCodeLeftNote → someKeys, which names three keys and then prints ….
| puts back any value it recorded. It does not change a key whose value changed after | ||
| `enable`, and it names each key it did not change. `agentop uninstall` runs the same `disable`. | ||
|
|
||
| `disable` restores every value, but not the file's layout. It writes the keys in |
There was a problem hiding this comment.
suggestion: Two small accuracy points.
enablechanges the layout too, not onlydisable. Both go throughwriteSettings→json.MarshalIndent, so the file is already reformatted after the firstenable.- Key order and indent are not the only byte changes.
MarshalIndentescapes HTML characters, so&,<and>in any string come back as\u0026,\u003cand\u003e. That is common in Claude CodehooksandstatusLinecommands:a && b 2>/dev/nullbecomesa \u0026\u0026 b 2\u003e/dev/null. The values stay JSON-equal, so "restores every value" still holds, but a reader who sees that escaping would not expect it from this sentence. (Strictly, numbers also go throughfloat64, so1.50becomes1.5, and an emptied"env": {}is dropped rather than put back. These are edge cases and may not be worth mentioning.)
Suggested wording: "enable and disable keep every value but rewrite the file: keys in alphabetical order, a 2-space indent, and &, <, > written as \u0026-style escapes."
| `enable`, and it names each key it did not change. `agentop uninstall` runs the same `disable`. | ||
|
|
||
| `disable` restores every value, but not the file's layout. It writes the keys in | ||
| alphabetical order with a 2-space indent. For the original bytes, use `settings.json.bak`. |
There was a problem hiding this comment.
suggestion: backupOnce writes settings.json.bak on the first write ever and never refreshes it, even across later disable/enable cycles. So it holds the original bytes only if nothing else in settings.json changed after that first enable. Copying it back throws away every later change: new permissions, MCP servers, other env entries. Worth saying, e.g. "…use settings.json.bak, the file as it was before the first enable; copying it back also undoes any change made since."
Fixes review: the list of rewrites is not complete (numbers, non-ASCII, duplicate keys also change) Files: - docs/agents/claude-code.md Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
clawgenti
left a comment
There was a problem hiding this comment.
Summary
I re-reviewed at ce411a6. Two of my three earlier suggestions are addressed, and so is the codex.md follow-up. The rewrite list now names the array split and the \u0026-style escapes. The settings.json.bak sentence now says what the backup does and does not hold. docs/agents/codex.md and the applyCodexDisable comment no longer point at #1289. The codex wording ("Unlike Claude Code's disable, it does not check...") matches the code: the codex record has no Written.
I checked the main claims at the head commit:
- #1289 is fixed. I ran a probe: enable, hand-edit
HTTPS_PROXY, then disable.disablekept the edit, removed the other six keys, and printedLeaving these alone — changed since Cortex set them: HTTPS_PROXY. - What disable restores. A probe from
{"zeta":1.50,"hooks":{"cmd":"a && b 2>/dev/null"},"arr":[1,2],...}came back sorted, with a 2-space indent,[1, 2]split across lines,\u0026\u0026and\u003e, and1.5..bakheld the original bytes.
I left two suggestions inline. One is still open from the last review: with a pre-v0.9.0 record, a hand-edit is still removed, and I confirmed that with a probe. Neither blocks merge.
Author: huang195 (MEMBER — maintainer)
Areas reviewed: Docs, Go comment (checked against cmd_claudecode.go, cmd_uninstall.go, setup_files.go, setup_step_claudecode.go, cmd_codex.go)
Agent/IDE config (.claude/.vscode): none
Commits: 3 commits, all signed-off: yes. Nit: the first subject is 77 characters, over the 72 guideline.
CI status: all checks pass, except Go CI (core peerproc, macOS), which is still pending. This PR changes no code.
| `~/.cortex/claude-code-state.json`. `disable` removes only the keys `enable` added, and | ||
| puts back any value it recorded. `agentop uninstall` runs the same `disable`. | ||
| puts back any value it recorded. It does not change a key whose value changed after | ||
| `enable`, and it names each key it did not change. `agentop uninstall` runs the same `disable`. |
There was a problem hiding this comment.
suggestion (still open from the last review): This holds only when the record has Written. I ran a probe at ce411a6: enable, remove written from the state file (what a v0.8.x record looks like), hand-edit HTTPS_PROXY, then disable. The result was {}. The edit was removed with no Leaving these alone line, because changedSinceEnable returns false when nothing is recorded. An upgrade through install.sh tops Written up (claudeCodeStep.already → topUpWritten), so the gap is narrow. Still, with #1289 now gone from Known issues, nothing says it exists. One sentence would cover it, e.g. "This needs a record from v0.9.0 or later; re-running enable or agentop setup adds it to an older one."
Nit: "names each key" is exact for configure claude-code disable. agentop uninstall uses someKeys, which names three keys and then prints ….
| puts back any value it recorded. It does not change a key whose value changed after | ||
| `enable`, and it names each key it did not change. `agentop uninstall` runs the same `disable`. | ||
|
|
||
| `disable` restores every value, but not the file's text. For example, it sorts the keys, uses a |
There was a problem hiding this comment.
suggestion: Two small points about this paragraph.
enablerewrites the file the same way, through the samewriteSettings→json.MarshalIndent. So the reformatting a reader sees comes from the firstenable, not fromdisable. Saying "enableanddisablekeep every value but rewrite the file's text" would place it right. That also exposes a mismatch outside this diff: theenableprompt saysNothing else in the file changes; a copy is kept as …bak(cmd_claudecode.go:556). That is true of values but not of bytes. This could be a follow-up.- "Every value" has one exception: integers above 2^53 go through
float64. In a Go probe,9007199254740993came back as9007199254740992. That is very unlikely insettings.json, so it may not be worth a word here, beyond the "For example" you already have.
Closes #940.
What it does
docs/agents/claude-code.md:disablerestores every value, but not the file's layout. It writes the keys in alphabetical order with a 2-space indent. The doc now says so, and points tosettings.json.bakfor the original bytes.enable.disabledoes not change a key whose value changed afterenable(Fix: Keep a Claude Code env value changed since enable #1343). The doc now says so.TestClaudeCodeDisable_LeavesAKeyChangedSinceEnablecovers it.How #940's open items close
install.sh --claude-codeon 4 targetsTestForwardProxy_Streaming_HeartbeatDeliveredWhileUpstreamOpenshows that Cortex relays a ping while the upstream stays open. #926 stopped because of a gateway change, not a Cortex change.Assisted-By: Claude (Anthropic AI) [email protected]