feat(logging): configurable format (text|jsonl) + unified hub/agent log config (#51)#52
Merged
Merged
Conversation
…og config (#51) Single [logging] contract, two native implementations (DRY the contract, not the code across the TS hub / Rust agent boundary). - shared/hub: add format "text"|"jsonl" (default jsonl) to LogConfig + extractLogConfig; HubLogger renders JSONL (unchanged default) or a human-readable text line. extractAgentConfig derives the agent's level + format from the same [logging] section. - agent (Rust): drive tracing_subscriber from config-supplied --log-level + --format (the json/text formatters already existed); config level is honored when RUST_LOG is unset (RUST_LOG still overrides). Default jsonl preserved. - delivery: hub passes --log-level/--format to the local daemon (agent-launcher) and the remote agent (ssh-agent exec); server.ts now forwards the parsed agent config into SessionManager (closing an existing plumbing gap). - contract documented once in docs/plans/logging-daemon.md + docs/SPEC.md. Behavior-preserving by default. Closes #51.
b8d02c5 to
b014c0b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #51.
What & why
Harmonize logging configuration across the hub (TypeScript) and the agent (Rust): one
[logging]contract — consistent
level, a configurableformat(text|jsonl), consistent semantics — foreasier debugging and log aggregation (one parser for Loki/Vector/ELK, correlatable hub↔agent logs).
The hub already parsed
[logging](level / output / rotation) but had noformat; the agent already hadboth
tracingformatters (json/text) but hardcoded by daemon-vs-foreground and took its level fromRUST_LOGonly. This unifies them.Design — DRY the contract, native implementations
Hub is TS, agent is Rust → no shared runtime, so the DRY is a single documented contract, implemented
twice (no codegen/shared-schema machinery for a few fields).
format = "text" | "jsonl"(defaultjsonl) added toLogConfig+extractLogConfig;extractAgentConfigderives the agent'slevel+formatfrom the same[logging]section, withdefensive type-guards (a malformed
[agent]/[logging]value falls back to defaults instead ofcrashing hub startup).
hub.jsonl, read by/api/logs) is always JSONL;formatgoverns the stderr/console rendering (structured-to-file, pretty-to-console). Enablingformat=textnever blinds the in-app log viewer or file-tailing aggregators.tracing_subscriberis driven by config-supplied--log-level+--format(formatters already existed); config level is honored when
RUST_LOGis unset (RUST_LOGstilloverrides). Default
jsonlpreserved.--log-level/--formatto the local daemon (agent-launcher) and toremote agents — OS-aware (POSIX single-quote for Unix,
cmd.exe%VAR%+double-quote forWindows, matching the existing deploy convention) and only to agents the hub deployed this session
(known-current binary); found/pre-existing remote agents run
--stdioonly, preserving back-compat.server.tsnow forwards the parsed agent config intoSessionManager(closing an existing gap).docs/plans/logging-daemon.md+docs/SPEC.md.Behavior-preserving by default (
jsonl).Verification
vitest packages/hub packages/shared→ 1663 passed / 2 skipped / 0 failed; biome + tsc clean; nonew skips.
cargo fmt --check,cargo clippy -p termora-agent -- -D warnings,cargo test -p termora-agent(82 tests) → green.
blinding the log API; a malformed-TOML hub-startup crash exposed by wiring the agent config; unquoted
remote exec path; POSIX-only quoting breaking Windows remotes; new args breaking older remote agents.
Gate status (degraded GATE_OK — documented)
Final gate on the head: codex = CLEAN; copilot exogenously unavailable (rate-limited / à sec)
across these runs. Per the gate's set-union semantics a single CLEAN satisfies when the other engine is
exogenously down.