fix(app): MCP discovery never blocks a turn; secrets masked as lines are written; TTS child gets no MCP secrets

- Discovery runs outside the MCP tool cache's lock (one at a time), so a turn reading the cached
  tools never waits for a slow server; a new conversation refreshes in the background.
- The log hub masks secrets before a line is kept or written, so a key replaced or removed later
  stays hidden on the screen, in copies, files and exports, also after a restart.
- The worker takes JARVIS_MCP_ENV out of its environment at start, before MeloTTS runs, and hands
  it to the brain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-13 10:07:52 +09:00
parent 3ef4281180
commit 8b3905f1c2
8 changed files with 191 additions and 31 deletions

View File

@@ -91,7 +91,7 @@ impl LogHub {
self.cleanup(Local::now().date_naive());
}
/// The stored secrets' values, masked in every copy and export.
/// The stored secrets' values, masked in every line from now on (and again in copies and exports).
pub fn set_secrets(&self, values: Vec<String>) {
self.state.lock().unwrap().secrets = values;
}
@@ -118,7 +118,10 @@ impl LogHub {
fn push_at(&self, at: DateTime<Local>, level: Level, tab: &str, text: &str) {
let mut s = self.state.lock().unwrap();
let line = LogLine { seq: s.next_seq, at_ms: at.timestamp_millis(), level, tab: tab.into(), text: text.into() };
// Masked before it is kept or written, so a secret replaced or removed later (the hub then
// no longer knows the old value) never shows on the screen, in a copy, a file or an export.
let text = redact(text, &s.secrets);
let line = LogLine { seq: s.next_seq, at_ms: at.timestamp_millis(), level, tab: tab.into(), text };
s.next_seq += 1;
if let Some(dir) = s.dir.clone() {
let day = at.date_naive();
@@ -479,6 +482,30 @@ mod tests {
assert!(!all.contains("late on the first") && all.contains("early on the second"));
}
#[test]
fn a_secret_is_masked_when_the_line_is_written_so_removing_or_replacing_it_later_shows_nothing() {
let dir = temp_dir("logwrite");
let hub = LogHub::new(Some(&dir));
hub.set_secrets(vec!["old-api-key-1".into()]);
hub.push_at(Local::now(), Level::Error, "llm", "server refused old-api-key-1");
// The key is replaced (or its server removed): the hub no longer knows the old value.
hub.set_secrets(vec!["new-api-key-2".into()]);
let shown: String = hub.query(None, Level::Debug, None, None, 100).iter().map(|l| l.text.clone()).collect();
assert!(shown.contains("server refused [비밀값]") && !shown.contains("old-api-key-1"), "{shown}");
assert!(!hub.recent_error_report("0.1.0").unwrap().contains("old-api-key-1"));
// After a restart a new hub reads the files: the value was never written.
// Today's file (a new hub removes files older than the retention).
let today = Local::now().date_naive();
let file = std::fs::read_to_string(dir.join(format!("llm-{today}.log"))).unwrap();
assert!(!file.contains("old-api-key-1"), "{file}");
let out = dir.join("after.zip");
LogHub::new(Some(&dir)).export_zip(today, today, &out).unwrap();
let mut z = zip::ZipArchive::new(std::fs::File::open(&out).unwrap()).unwrap();
let mut text = String::new();
std::io::Read::read_to_string(&mut z.by_name(&format!("llm-{today}.log")).unwrap(), &mut text).unwrap();
assert!(!text.contains("old-api-key-1"));
}
#[test]
fn the_zip_stays_under_the_limit_by_leaving_out_the_oldest_lines() {
let dir = temp_dir("logzip");