Skip to content

Keep standalone CLI output IDs readable across processes - #388

Merged
litnimax merged 2 commits into
mainfrom
fix/audit-cli-output
Nov 21, 2026
Merged

litnimax merged 2 commits into
mainfrom
fix/audit-cli-output

Conversation

@litnimax

Copy link
Copy Markdown
Contributor

A real service command produced 2,000 lines. Before: a fresh CLI immediately lost the ID. After: a fresh CLI recovered lines 1222–1224, without sharing MCP-visible output. The private local cache is bounded and scoped to OS user, config and team.

Keep the standalone cache private to the local account, configuration and
team. Leave MCP output in process memory so CLI logs cannot be retrieved
through a server endpoint.
@greptile-apps

greptile-apps Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches standalone CLI output across several tool workflows.

The PR appears safe to merge, with non-blocking improvements for cache failures and process-exit test coverage.

Fix All in Claude CodeFindings

  1. P2 Fresh processes are not tested ▶
Fix with agent prompt
### Issue 1
tests/test_cli_call.py:167-170
`test_read_output_survives_cli_exit_without_exposing_it_to_mcp` never exits a process. Both calls share the imported server, patched settings, and tool registry. Replacing `_output_cache` checks repeated calls, not a fresh CLI.

Add a test that writes in one process and reads the ID in another, using the same temporary home directory and configuration. That would protect the main promise of this change against restart-related regressions.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Standalone CLI calls now save large outputs in a private SQLite cache so later calls can read their IDs.

  • Standalone CLI output IDs work in later CLI processes.

Reviews (1) · Last reviewed commit: "fix(cli): retain output IDs between call..." · Reviewed by Greptile

Comment thread tests/test_cli_call.py
Comment on lines +167 to +170
# A second standalone invocation starts with no in-process cache.
monkeypatch.setattr(server, "_output_cache", OutputCache())
args = ["read_output", output_id, "lines", "1001", "1001"]
server._run_call(args)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Fresh processes are not tested

test_read_output_survives_cli_exit_without_exposing_it_to_mcp never exits a process. Both calls share the imported server, patched settings, and tool registry. Replacing _output_cache checks repeated calls, not a fresh CLI.

Add a test that writes in one process and reads the ID in another, using the same temporary home directory and configuration. That would protect the main promise of this change against restart-related regressions.

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/test_cli_call.py
Line: 167-170

Comment:
**Fresh processes are not tested**

`test_read_output_survives_cli_exit_without_exposing_it_to_mcp` never exits a process. Both calls share the imported server, patched settings, and tool registry. Replacing `_output_cache` checks repeated calls, not a fresh CLI.

Add a test that writes in one process and reads the ID in another, using the same temporary home directory and configuration. That would protect the main promise of this change against restart-related regressions.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Conductor Fix in Codex

@greptile-apps

greptile-apps Bot commented Nov 21, 2026

Copy link
Copy Markdown

Comments Outside Diff

These findings could not be posted inline.

  • P2 Cache errors hide command results src/oduflow/server.py:340 ▶

    If the user's home directory is full or unwritable, saving output raises an error after commands such as pull_and_apply have already applied their changes. The CLI then prints only the cache error, hiding the command's result and inviting a retry of completed work.

    Catch cache write errors when building the response. Warn that output could not be saved, but still return the command's status and output.

@litnimax
litnimax merged commit d15aaf7 into main Nov 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant