@@ -180,6 +180,56 @@ fn run_auth_with_stdin(input: &str) -> Output {
180180 child. wait_with_output ( ) . expect ( "openclaudia auth must run" )
181181}
182182
183+ #[ test]
184+ fn legacy_repl_login_reads_status_without_nesting_a_runtime ( ) {
185+ let cwd = tempfile:: tempdir ( ) . expect ( "cwd tempdir" ) ;
186+ let home = tempfile:: tempdir ( ) . expect ( "home tempdir" ) ;
187+ write_local_provider_config ( & cwd) ;
188+ write_claude_oauth_credentials ( & home. path ( ) . join ( ".claude" ) ) ;
189+
190+ let mut child = isolated_command ( & cwd, & home)
191+ . args ( [
192+ "--tui-mode" ,
193+ "--dangerously-skip-permissions" ,
194+ "--target" ,
195+ "local" ,
196+ "--model" ,
197+ "local-test-model" ,
198+ ] )
199+ . stdin ( Stdio :: piped ( ) )
200+ . stdout ( Stdio :: piped ( ) )
201+ . stderr ( Stdio :: piped ( ) )
202+ . spawn ( )
203+ . expect ( "legacy REPL must spawn" ) ;
204+ child
205+ . stdin
206+ . take ( )
207+ . expect ( "legacy REPL stdin" )
208+ . write_all ( b"/login\n /exit\n " )
209+ . expect ( "legacy REPL should accept slash commands" ) ;
210+
211+ let output = child. wait_with_output ( ) . expect ( "legacy REPL must exit" ) ;
212+ let combined = format ! (
213+ "{}{}" ,
214+ String :: from_utf8_lossy( & output. stdout) ,
215+ String :: from_utf8_lossy( & output. stderr)
216+ ) ;
217+ assert ! (
218+ output. status. success( ) ,
219+ "legacy REPL should exit cleanly after /login; got {combined:?}"
220+ ) ;
221+ assert ! (
222+ combined. contains( "Authenticated via Claude Code credentials" )
223+ && combined. contains( "Type: max" )
224+ && combined. contains( "Tier: max" ) ,
225+ "/login should report synchronous credential status; got {combined:?}"
226+ ) ;
227+ assert ! (
228+ !combined. contains( "panicked" ) && !combined. contains( "Cannot start a runtime" ) ,
229+ "/login must not attempt to nest a Tokio runtime; got {combined:?}"
230+ ) ;
231+ }
232+
183233fn readme_cli_command_invocations ( ) -> Vec < String > {
184234 let readme = include_str ! ( "../README.md" ) ;
185235 let section = readme
@@ -2707,6 +2757,17 @@ fn init_refuses_overwrite_unless_force_and_creates_documented_tree() {
27072757 config. contains( "OpenClaudia Configuration" ) && !config. contains( "sentinel" ) ,
27082758 "init --force must replace the previous config contents"
27092759 ) ;
2760+
2761+ let output = isolated_command ( & cwd, & home)
2762+ . arg ( "config" )
2763+ . output ( )
2764+ . expect ( "openclaudia config must run after init" ) ;
2765+ assert ! (
2766+ output. status. success( ) ,
2767+ "the generated config must load without edits; stdout={:?} stderr={:?}" ,
2768+ String :: from_utf8_lossy( & output. stdout) ,
2769+ String :: from_utf8_lossy( & output. stderr)
2770+ ) ;
27102771}
27112772
27122773#[ cfg( unix) ]
0 commit comments