Skip to content

Remove legacy memory push/inject in build_headless_context_report#4444

Draft
Hmbown wants to merge 2 commits into
mainfrom
remove-legacy-memory-push-build-headless-context-1440907162443058655
Draft

Remove legacy memory push/inject in build_headless_context_report#4444
Hmbown wants to merge 2 commits into
mainfrom
remove-legacy-memory-push-build-headless-context-1440907162443058655

Conversation

@Hmbown

@Hmbown Hmbown commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Removed the block handling legacy memory push/inject in build_headless_context_report within crates/tui/src/context_report.rs (marked by a v0.8.71 TODO for Moraine recall stability), as well as the related unit test headless_context_report_omits_legacy_memory_when_moraine_fallback_enabled.


PR created automatically by Jules for task 1440907162443058655 started by @Hmbown

…report

Removed the legacy user memory injection logic and the associated testing
for `build_headless_context_report` in `context_report.rs`. This completes
the deprecation of legacy memory fallbacks as part of Moraine recall stabilization.

Co-authored-by: Hmbown <101357273+Hmbown@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 17, 2026 01:35
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@claude

claude Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Claude finished @Hmbown's task in 2m 24s —— View job


Review: Remove legacy memory push/inject in build_headless_context_report

  • Gather context (diff, removed code, related test)
  • Understand the request
  • Review diff for correctness, provider/model safety, reuse, tests, security
  • Post findings

Summary

The change deletes 60 lines from crates/tui/src/context_report.rs: the legacy UserMemory source-entry block (gated on memory_enabled && !moraine_fallback) inside build_headless_context_report, and its dedicated unit test. It's a clean, isolated deletion — no leftover unused variables/imports, and it compiles structurally (no other test in this file asserts a UserMemory entry for the headless builder).

Finding (posted inline at context_report.rs:240)

Scope mismatch / diagnostic accuracy regression. This only removes the block from build_headless_context_report. The near-identical block still lives, untouched, in the sibling function build_context_report (same file, ~line 465-490), and the identical TODO(v0.8.71) legacy push/inject logic this is meant to deprecate is still fully active in:

  • crates/tui/src/core/engine.rs:1014 and :3665
  • crates/tui/src/core/engine/tool_setup.rs:11
  • crates/tui/src/main.rs:8287
  • crates/tui/src/tui/ui.rs:1696

build_headless_context_report is only consumed by the codewhale doctor --json context report (main.rs:4872) — a diagnostic tool whose entire job is to accurately reflect what's included in the prompt. After this change, that report will never show a UserMemory source, even for the legitimate, still-live case (memory_enabled = true, moraine_fallback = false) where legacy memory genuinely is injected by the real code paths above. So the doctor report can now under-report what's actually in a headless run's context — the opposite of what it's for.

The commit message says this "completes the deprecation of legacy memory fallbacks," but the actual push/inject logic (not just its reporting) remains everywhere else it's marked TODO(v0.8.71). Either the deprecation should be carried through consistently (including build_context_report and the real injection call sites), or the PR description should be scoped to "stop reporting legacy memory in the headless doctor output" rather than implying the fallback itself is being retired.

Other checks

  • Provider/model routing invariant: not implicated — no provider-prefix or model-string inference in this diff.
  • Reuse/dead code: clean deletion, no dangling references.
  • Tests: the removed test's coverage is fully redundant now that the code path is gone; no new test is needed for a deletion, but there's also no test asserting the headless report never contains UserMemory regardless of config, which would have caught the divergence above.
  • Security: none introduced; if anything the deleted test's leak-prevention assertion becomes moot by construction.

@Hmbown Hmbown modified the milestones: v0.9.1, v0.9.4 Jul 17, 2026
let global_skills_dir = config.skills_dir();
let selected_skills_dir =
crate::tui::app::resolve_skills_dir(workspace, &global_skills_dir, config);
let mut builder = base_source_entries(&model, workspace, Some(&selected_skills_dir));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This deletes the UserMemory source entry only from build_headless_context_report. The near-identical block in build_context_report (same file, ~line 465-490) is untouched, and its test app_context_report_omits_legacy_memory_when_moraine_fallback_enabled still passes.

That means the headless diagnostic report (surfaced via codewhale doctor --json, main.rs:4872) will now never show a UserMemory entry, even when memory_enabled = true and moraine_fallback = false — a legitimate, still-active config, not just the deprecated fallback case. Meanwhile the real legacy push/inject logic that this report is supposed to describe is still live and unchanged in engine.rs:1014, engine.rs:3665, tui/ui.rs:1696, and main.rs:8287 (all still carrying the same TODO(v0.8.71) marker). So a headless run can still inject real memory content into the prompt while codewhale doctor --json now silently claims none was included — the opposite of what a diagnostic/doctor report should guarantee.

If the goal (per the commit message, "completes the deprecation of legacy memory fallbacks") is to fully retire this path, it should be removed everywhere it's marked TODO(v0.8.71), including the actual push/inject call sites and build_context_report. If the intent is narrower (only stop reporting it in the headless diagnostic), the commit message overstates the change and the interactive/headless report divergence should at least be called out.

@Hmbown
Hmbown marked this pull request as draft July 17, 2026 01:42
@Hmbown

Hmbown commented Jul 17, 2026

Copy link
Copy Markdown
Owner Author

Moved to v0.9.4 draft. Removing the headless UserMemory report and its test before Moraine replacement observability exists would hide the migration state and leave interactive/headless reporting inconsistent. Rework as part of one end-to-end #3495 migration.

@google-labs-jules

Copy link
Copy Markdown
Contributor

Moved to v0.9.4 draft. Removing the headless UserMemory report and its test before Moraine replacement observability exists would hide the migration state and leave interactive/headless reporting inconsistent. Rework as part of one end-to-end #3495 migration.

Understood. Acknowledging that this work is now obsolete and stopping work on this task. I have reverted the changes to keep the migration state visible and consistent for now.

Reverting the removal of legacy memory push/inject logic in `build_headless_context_report` per PR comments, as it should be handled in one end-to-end #3495 migration.

Co-authored-by: Hmbown <101357273+Hmbown@users.noreply.github.com>
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.

2 participants