Skip to content

refactor(common,memory,tui): deduplicate token format helpers and add tracing spans#4364

Merged
bug-ops merged 1 commit into
mainfrom
tracing-spans-token-fmt
May 18, 2026
Merged

refactor(common,memory,tui): deduplicate token format helpers and add tracing spans#4364
bug-ops merged 1 commit into
mainfrom
tracing-spans-token-fmt

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 18, 2026

Summary

  • Extract format_tokens(n: u64) -> String into zeph-common/src/text.rs, replacing three identical local helpers (format_tokens_short in fleet.rs, format_tokens in status.rs, fmt_tokens in agents.rs). All three implemented the same >=1M → X.XM / >=1k → X.Xk / else n pattern.
  • Add #[tracing::instrument(name = "memory.fleet.*", skip_all, level = "debug", err)] to reconcile_stale_sessions and update_agent_session_status in agent_sessions.rs, matching the existing convention of upsert_agent_session.

Closes #4348
Closes #4359

Test plan

  • cargo nextest run --workspace --lib --bins — 9879 passed, 0 failed
  • cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler" — all doc-tests pass
  • cargo +nightly fmt --check — clean
  • RUSTFLAGS="-D warnings" cargo check --workspace --all-targets --features desktop,ide,server,chat,pdf,scheduler --locked — 0 warnings

@github-actions github-actions Bot added refactor Code refactoring without functional changes size/M Medium PR (51-200 lines) labels May 18, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 18, 2026 12:49
@github-actions github-actions Bot added memory zeph-memory crate (SQLite) rust Rust code changes labels May 18, 2026
… tracing spans

Extract format_tokens(n: u64) -> String into zeph-common/src/text.rs,
replacing three identical local implementations in fleet.rs, status.rs,
and agents.rs. Closes #4359.

Add #[tracing::instrument] to reconcile_stale_sessions and
update_agent_session_status in agent_sessions.rs, matching the
convention established by upsert_agent_session. Closes #4348.
@bug-ops bug-ops force-pushed the tracing-spans-token-fmt branch from 01a2c6f to eb54e4f Compare May 18, 2026 12:49
@bug-ops bug-ops merged commit 9d76476 into main May 18, 2026
32 checks passed
@bug-ops bug-ops deleted the tracing-spans-token-fmt branch May 18, 2026 12:57
bug-ops added a commit that referenced this pull request May 18, 2026
… tracing spans (#4364)

Extract format_tokens(n: u64) -> String into zeph-common/src/text.rs,
replacing three identical local implementations in fleet.rs, status.rs,
and agents.rs. Closes #4359.

Add #[tracing::instrument] to reconcile_stale_sessions and
update_agent_session_status in agent_sessions.rs, matching the
convention established by upsert_agent_session. Closes #4348.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

memory zeph-memory crate (SQLite) refactor Code refactoring without functional changes rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

token format helpers duplicated across fleet.rs, agents.rs, status.rs add tracing spans to reconcile_stale_sessions and update_agent_session_status

1 participant