README Source History Refs Reviews Compare Notes Search Review guide CI runs fix(harness): runtime config carries the auth store directory; tests never read a developer's credentials
85675a83c3e8439c782285ad7c24c46c1c0b19f6
Oliver Jan Krylow <oliver@bugabinga.net > · 26 Sep 2026
unsigned
Browse files Compare with HEAD
Changed files (3) Diff layout Auto Unified Split
smith-cli/src/main.rs Modified +2 / −0 text lines
346 346 workdir: dir.clone (), workdir: dir.clone (),347 347 session_path: dir.join ("eval.smh" ), session_path: dir.join ("eval.smh" ),348 348 api_key: None , api_key: None ,
349 + auth_dir: smith::config::auth_dir(),350 351 let mut agent = build_agent (& config)? ; let mut agent = build_agent (& config)? ;351 352 let outcome = { let outcome = {387 388 workdir: dir.clone (), workdir: dir.clone (),388 389 session_path: dir.join ("rpc.smh" ), session_path: dir.join ("rpc.smh" ),389 390 api_key: None , api_key: None ,
391 + auth_dir: smith::config::auth_dir(),391 393 let mut state = RpcState::new(build_agent (& config)? ); let mut state = RpcState::new(build_agent (& config)? );392 394 let (input_tx, input_rx) = std::sync::mpsc::channel(); let (input_tx, input_rx) = std::sync::mpsc::channel();smith-harness/src/runtime.rs Modified +21 / −9 text lines
77 77 pub session_path: PathBuf, pub session_path: PathBuf,79 79 pub api_key: Option <String >, pub api_key: Option <String >,
82 + pub auth_dir: PathBuf,82 85 impl RuntimeConfig {impl RuntimeConfig {85 88 pub fn mock (workdir: impl Into <PathBuf>, script: Vec <Vec <smith::stream::StreamEvent>>) -> Self { pub fn mock (workdir: impl Into <PathBuf>, script: Vec <Vec <smith::stream::StreamEvent>>) -> Self {86 89 let workdir = workdir.into (); let workdir = workdir.into ();87 90 let session_path = workdir.join ("session.smh" ); let session_path = workdir.join ("session.smh" );
91 + let auth_dir = workdir_auth (& workdir);89 93 provider: RuntimeProvider::Mock(script), provider: RuntimeProvider::Mock(script),91 95 session_path, session_path,92 96 api_key: None , api_key: None ,
103 + fn workdir_auth (workdir: & Path) -> PathBuf {104 + workdir.join ("auth" )97 107 impl RuntimeProvider {impl RuntimeProvider {122 132 let opened = open_session (Path::new(& config.session_path), smith_config)? ; let opened = open_session (Path::new(& config.session_path), smith_config)? ;123 133 let tools = ToolSession::with_session(config.workdir.clone (), opened.session, opened.writer); let tools = ToolSession::with_session(config.workdir.clone (), opened.session, opened.writer);124 134 let (sink, drain) = smith::provider::record_channel(); let (sink, drain) = smith::provider::record_channel();125 - let stream = resolve_stream (& config.provider, config.api_key.clone (), sink)? ;135 + let stream = resolve_stream (137 + config.api_key.clone (),138 + & AuthStore::at(& config.auth_dir),126 141 Ok (Agent::with_provider_records( Ok (Agent::with_provider_records(134 149 fn resolve_stream (fn resolve_stream (135 150 provider: & RuntimeProvider, provider: & RuntimeProvider,136 151 api_key: Option <String >, api_key: Option <String >,137 153 records: RecordSink, records: RecordSink,138 154 ) -> Result <StreamFn> {) -> Result <StreamFn> {139 155 match provider { match provider {144 160 let kind = provider.vendor_kind (); let kind = provider.vendor_kind ();145 161 let api_key = match api_key { let api_key = match api_key {146 162 Some (explicit) => explicit, Some (explicit) => explicit,147 - None => resolve_credential (kind)? ,163 + None => resolve_credential_from (store, kind)? ,149 165 Ok (transport (VendorEndpoint { Ok (transport (VendorEndpoint {168 - pub fn resolve_credential (kind: ProviderKind) -> Result <String > {169 - resolve_credential_from (& AuthStore::at_default(), kind)173 - fn resolve_credential_from (store: & AuthStore, kind: ProviderKind) -> Result <String > {184 + pub fn resolve_credential_from (store: & AuthStore, kind: ProviderKind) -> Result <String > {174 185 match store.load (kind) { match store.load (kind) {175 186 Ok (Some (secret)) => Ok (secret), Ok (Some (secret)) => Ok (secret),176 187 Ok (None ) => { Ok (None ) => {224 235 workdir: dir.clone (), workdir: dir.clone (),225 236 session_path: dir.join ("s.smh" ), session_path: dir.join ("s.smh" ),226 237 api_key: None , api_key: None ,
238 + auth_dir: dir.join ("auth" ),228 240 let Err (err) = build_agent (& config) else { let Err (err) = build_agent (& config) else {229 241 unreachable! ("no credential must fail assembly" ); unreachable! ("no credential must fail assembly" );smith-harness/tests/http_effect.rs Modified +2 / −0 text lines
64 64 workdir: dir.clone (), workdir: dir.clone (),65 65 session_path: session_path.clone (), session_path: session_path.clone (),66 66 api_key: Some ("sk-integration-secret" .to_string ()), api_key: Some ("sk-integration-secret" .to_string ()),
67 + auth_dir: dir.join ("auth" ),68 69 let mut agent = build_agent (& config).unwrap (); let mut agent = build_agent (& config).unwrap ();69 70 let outcome = agent.run_turn ("say it" ).unwrap (); let outcome = agent.run_turn ("say it" ).unwrap ();120 121 workdir: dir.clone (), workdir: dir.clone (),121 122 session_path: dir.join ("s.smh" ), session_path: dir.join ("s.smh" ),122 123 api_key: Some ("sk-explicit" .to_string ()), api_key: Some ("sk-explicit" .to_string ()),
124 + auth_dir: dir.join ("auth" ),124 126 let _agent = build_agent (& config).unwrap (); let _agent = build_agent (& config).unwrap ();125 127 let _ = std::fs::remove_dir_all(& dir); let _ = std::fs::remove_dir_all(& dir);