Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions bin/claude-as
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,18 @@ check() {
printf ' FAIL not signed in: claude-as --add <email> signs one in, claude-as --tidy archives it\n'
problems=$((problems + 1))
fi
# A home meant to start Remote Control whose new sessions start in
# Code Mode instead drops out of other machines' ListAgents. A choice
# the person may have made, so a note, not a fault.
if remote_control_on "${home}" && code_mode_on "${home}"; then
if flag_on "$(code_mode_setting "${home}/settings.json")"; then
printf ' note new sessions here start in Code Mode, without Remote Control: setup.sh --no-code-mode turns it off\n'
else
# A session started while the settings turned it on passes
# it to its child shells, which keep it once it is removed.
printf ' note sessions started from this shell start in Code Mode, without Remote Control: CLAUDE_CODE_EXPERIMENTAL_CODE_MODE is set here (a session started while settings turned it on passes it down)\n'
fi
fi
if [[ ${home} != "${shared}" ]]; then
for name in ${CLAUDE_AS_SHARE:-${SHARE}}; do
src="${shared}/${name}"
Expand Down
4 changes: 3 additions & 1 deletion docs/how-to-use-multiple-accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ herdr pane `--check` runs in, so the pane keeps its own session.
`--add` and `--relink` record that answer, so a session started unattended
does not stop at it. A session started in Code Mode resumes in it, even once
Code Mode is off for new sessions, and without Remote Control, which does
not run in Code Mode.
not run in Code Mode. Where `remoteControlAtStartup` is on but Code Mode is
on too, `--check` notes it: those sessions never appear in other machines'
`ListAgents`, so `SendMessage` cannot reach them.
- `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `CLAUDE_CODE_OAUTH_TOKEN`,
`ANTHROPIC_PROFILE` and the cloud provider switches outrank every login.
`claude-as` warns when one is set.
Expand Down
35 changes: 35 additions & 0 deletions tests/claude-as.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2130,3 +2130,38 @@ filler() { head -c "$1" /dev/zero | tr '\0' 'x' | fold -w 1000 && echo; }
run "$SCRIPT" -r "${id}"
[[ ${output} == *"CODEMODE=unset"* ]]
}

# --- --check: Code Mode where Remote Control is meant to start ---------------

@test "--check notes a home whose new sessions start in Code Mode instead of Remote Control" {
two_accounts
rc_on
code_mode
run "$SCRIPT" --check
[ "$status" -eq 0 ]
[ "$(grep -c 'note new sessions here start in Code Mode, without Remote Control: setup.sh --no-code-mode turns it off' <<<"${output}")" -eq 2 ]
}

@test "--check says nothing of Code Mode when it is off, kept off, or Remote Control is not meant to start" {
two_accounts
code_mode
run "$SCRIPT" --check
[ "$status" -eq 0 ]
[[ ${output} != *"Code Mode"* ]]
rc_on
code_mode
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=0 run "$SCRIPT" --check
[[ ${output} != *"Code Mode"* ]]
code_mode 0
run "$SCRIPT" --check
[[ ${output} != *"Code Mode"* ]]
}

@test "--check names the environment when Code Mode comes from there alone" {
two_accounts
rc_on
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 run "$SCRIPT" --check
[ "$status" -eq 0 ]
[[ ${output} == *"note sessions started from this shell start in Code Mode, without Remote Control: CLAUDE_CODE_EXPERIMENTAL_CODE_MODE is set here (a session started while settings turned it on passes it down)"* ]]
[[ ${output} != *"setup.sh --no-code-mode"* ]]
}
Loading