Skip to content

fix(tinyjuice-host): stop logging the retrieve lookup token - #125

Closed
sx4im wants to merge 1 commit into
tinyhumansai:mainfrom
sx4im:fix-8447-redact-retrieve-token
Closed

sx4im wants to merge 1 commit into
tinyhumansai:mainfrom
sx4im:fix-8447-redact-retrieve-token

Conversation

@sx4im

@sx4im sx4im commented Nov 3, 2026 •

Copy link
Copy Markdown

Summary

juice_retrieve logged the compacted-output retrieval token verbatim at debug level on every successful lookup. The token is the lookup key for cached full tool output that compaction keeps out of the transcript, so anyone with the log and the store could pull that content back. The log line now records only the retrieved byte count.

Fixes tinyhumansai/openhuman#8447.

API Or Behavior Changes

Behavior only: the [tinyjuice-host::retrieve] debug line no longer includes the lookup token. Nothing else changes; the miss message shown to the agent is untouched.

Tests

New regression test successful_retrieve_never_logs_the_lookup_token captures debug output during execute and asserts the token never appears in it.

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo build --all-targets
  • cargo build --all-targets --all-features
  • cargo test
  • cargo test --all-features

(clippy ran as cargo clippy -p tinyjuice-host --all-targets -- -D warnings, clean; cargo test -p tinyjuice-host gave 38 passed, 0 failed. The unticked rows need tree-sitter/criterion artifacts that are not vendored for this checkout.)

Documentation

No docs changes needed; no public API change.

Summary by CodeRabbit

  • Bug Fixes
    • Retrieval logs no longer include the access token, while still reporting the number of bytes retrieved.

The debug log on a successful juice_retrieve lookup interpolated the
retrieval token verbatim. The token is the lookup key for cached full
tool output that compaction deliberately keeps out of the transcript,
so anyone with the log and the store could pull that content back.
Log only the non-sensitive metadata (retrieved byte count) instead.

Co-authored-by: Saim Shafique <128062316+sx4im@users.noreply.github.com>
@tinysweeper

tinysweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: e89db804a25455198e1f5d8c3b0c2fcab8db147a

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 2 of 2 files.
Pull request purpose (title): fix(tinyjuice-host):…

Diagnostics and supporting details

Full summary

Pull request purpose (title): fix(tinyjuice-host): stop logging the retrieve lookup token. Tiny Sweeper completed its review; deterministic results follow.

Review snapshot

Change surface Files Review signal Count
Production 1 Active findings 0
Tests 1 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

Features

  • Modified — Retrieve debug log redaction: The debug line emitted on successful retrieval no longer includes the lookup token and keeps only the byte count, reducing exposure of the key used to retrieve compacted full tool output. (crates/tinyjuice-host/src/retrieve_tool.rs, crates/tinyjuice-host/src/retrieve_tool.rs impl Tool for RetrieveToolOutputTool {)
  • Added — Lookup-token log regression test: Adds a test that captures debug output during `execute` and asserts the fixture lookup token never appears, guarding the redaction behavior. (crates/tinyjuice-host/src/retrieve_tool_tests.rs)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Answered with no findings; described the production redaction as straightforward and the test as following the repository's sibling-test convention, while noting the missing positive control in the negative assertion.
  • Lane summary: The production change is a straightforward redaction: the debug log in `RetrieveToolOutputTool::execute` no longer interpolates the lookup token, and nothing else in the changed file depended on that field. The new test file follows the repository's sibling-test convention and does verify the shipped behaviour. One weakness: the negative assertion has no positive control, so it cannot tell 'the token was not logged' from 'no record was captured at all', which is what would happen if `log::set_logger` returned an error (its result is discarded) or if the `enabled` threshold were wrong.

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Answered with no security defect introduced; removing the lookup token from the debug log reduces exposure, and the token used in the test is fixture data.
  • Lane summary: The change removes the lookup token from the debug log line in retrieve_tool.rs and adds a test asserting the token never reaches the log. The test installs a process-global logger via OnceLock, which is fine for a single test process, and the token is a test fixture asserting containment, not a leak. No security defect introduced.

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Answered with no reportable defect; the regression test would fail if the token interpolation were restored, and the other log sites in the file are unchanged.
  • Lane summary: The change removes the lookup token from a debug log line and adds a test that installs a capturing logger and asserts the token never appears in captured records. The test is a real regression guard: restoring `token={token}` in the log call makes it fail. One weakness: the test only exercises the success path, so the token is still logged nowhere else — but the diff only changed that one line, and the other log sites in this file are unchanged. No reportable defect.

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Answered with no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files.

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Answered with no defects; the description matches the behavior change—dropping the token and keeping the byte count—and the added regression test.
  • Lane summary: The change does exactly what the description says: the `[tinyjuice-host::retrieve]` debug line drops the lookup token and keeps only the byte count, and a regression test in the sibling `retrieve_tool_tests.rs` asserts the token never reaches the log. The test file follows the repository's test-layout rules, and the description accurately covers the behaviour change and the test. No defects found.
Evidence and run details
  • Models: deepseek-v4.1-flash, ladder/vectors-oai3
  • Spend: $0.003518
  • Tokens: 176070 input · 20438 output · 22912 cached · 161 embedding
  • Updated: 2026-11-03T04:53:06Z
Head State Pass summary
e89db804a254 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-11-03T04:53:06Z)

tinysweeper 0.1.2

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The retrieval debug log now reports the retrieved byte count without logging the lookup token. A test captures log records during successful retrieval and checks that they do not contain the token.

Changes: Retrieval logging

Layer / File(s) Summary
Retrieval log and privacy test
crates/tinyjuice-host/src/retrieve_tool.rs, crates/tinyjuice-host/src/retrieve_tool_tests.rs
The debug log records the retrieved byte count without the token. A capturing logger supports a test that checks successful retrieval logs for the token.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: senamakel

Merge Risk: Minimal · up to e89db

The change removes lookup tokens from successful-retrieval logs without changing retrieval results. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: preventing the retrieve lookup token from being logged.
Linked Issues check Passed [#8447] Coding objective: stop logging the compacted-output retrieval token on successful lookup; log only non-sensitive metadata. At head, RetrieveToolOutputTool::execute in `crates/tinyjuice-host/…
Out of Scope Changes check Passed The whole-PR diff against merge base 203f4f6 changes two files. (1) crates/tinyjuice-host/src/retrieve_tool.rs: the debug log line drops token= and the token argument. This is the change #8447 req…
Full details: Linked Issues check

Explanation

[#8447] Coding objective: stop logging the compacted-output retrieval token on successful lookup; log only non-sensitive metadata. At head, RetrieveToolOutputTool::execute in crates/tinyjuice-host/src/retrieve_tool.rs logs "[tinyjuice-host::retrieve] retrieved bytes={}" with text.len() only. The token is absent from this log call. The miss path (miss_message(token)) returns a tool result and does not log. No other log call in this file prints the token. The byte count is an allowed metadata field under #8447. The new test successful_retrieve_never_logs_the_lookup_token in retrieve_tool_tests.rs captures debug records during a successful execute and asserts the token string does not appear. The issue's shared execute path also serves the legacy retrieve_tool_output name, as #8447 describes. Non-coding items in #8447 (release tinyjuice, bump openhuman module record/gitlink) are excluded from this assessment. Minor test caveat: the capture logger is installed with log::set_logger and its result is ignored. If another logger were already installed in the test binary, the test would pass without capturing any record. This does not change the verdict on the code.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against merge base 203f4f6 changes two files. (1) crates/tinyjuice-host/src/retrieve_tool.rs: the debug log line drops token= and the token argument. This is the change #8447 requests. (2) crates/tinyjuice-host/src/retrieve_tool_tests.rs: adds a capturing log::Log implementation, a capture_logger helper, and the regression test. The helper and test directly support verifying the logging fix. No unrelated code, dependency, or public API change appears in the reviewed diff. The PR description states no public API change, and the raw summary lists no changed public declarations. The release and openhuman gitlink update named in #8447 are not part of this PR, so they add no out-of-scope change.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

ast-grep could not parse rule config: /ast-grep-rules/ast-grep-essentials/rules/rust/security/secrets-reqwest-hardcoded-auth-rust.yml

Clippy (1.99.0)

Clippy execution failed

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

A rabbit checks the log at night,
The byte count stays; the token’s out of sight.
A captured line is searched with care,
No lookup secret lingers there.
The rabbit hops beneath the moon,
And stamps this tidy change as done.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8b306274-9918-49f5-a93c-c619ae9bbf63
Commits

Reviewing files that changed from the base of the PR and between 203f4f6 and e89db80.

Files selected for processing: 2
  • crates/tinyjuice-host/src/retrieve_tool.rs
  • crates/tinyjuice-host/src/retrieve_tool_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0035

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Nov 3, 2026
@sx4im

sx4im commented Nov 5, 2026

Copy link
Copy Markdown
Author

Closing this PR as I am narrowing my contribution focus to other repos.

@sx4im sx4im closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

privacy: juice_retrieve logs the compacted-output retrieval token at debug level

1 participant