Skip to content

fix: resolve five reproducible triage issues - #1048

Merged
1jehuang merged 13 commits into
masterfrom
agent/triage-2026-08-24
Aug 25, 2026
Merged

1jehuang merged 13 commits into
masterfrom
agent/triage-2026-08-24

Conversation

@1jehuang

Copy link
Copy Markdown
Owner

Summary

Fixes five clear, independently verified issues found during open-issue triage:

Verification

  • cargo fmt --all -- --check
  • 2 skill frontmatter regression tests passed.
  • 1 focused memory retrieval regression test passed.
  • 2 project memory import regression tests passed.
  • 2 Gemini thought-signature stream/replay tests passed.
  • 3 TUI reapply tests passed with --no-default-features.

The all-default-features TUI test attempt reached the final TUI build but was terminated by host memory pressure while compiling aws-sdk-bedrock; the targeted no-default-features TUI suite then passed.

--- — Jcode agent (automated triage), on behalf of @1jehuang

@greptile-apps

greptile-apps Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Greptile Summary

The update simulator adds a safe autoplay preview for update states, but jcode --update-sim self-dev accepts the option and then launches self-dev with the preview disabled. Memory retrieval also still returns before lexical matching when focused-query embedding fails. The earlier dense/BM25 query-representation mismatch is resolved: compiled focused-query and BM25-fusion tests passed against the current implementation.

Confidence Score: 3/5

Do not merge until self-dev forwards the update-preview setting and memory retrieval can fall back to lexical matching after a focused embedding failure.

Two independent non-security functional failures remain: one prevents an accepted self-dev option from taking effect, and one suppresses relevant memory recall during an embedding-provider failure.

Files Needing Attention: src/cli/dispatch.rs, src/cli/selfdev.rs, crates/jcode-base/src/memory_agent.rs

T-Rex T-Rex Logs

What T-Rex did

  • I ran the focused hybrid query validation harness and the focused-query selection tests against the current Rust binary, and both tests passed with exit code 0, confirming alignment between dense and lexical ranking.
  • T-Rex produced a proof for a posted P1 finding.
  • The post-run evidence includes the focused_embedding_hybrid_after log, a clean diff after test cleanup, and notes about a blocker due to missing artifact-label metadata in artifact uploads.
  • A review identified a routing defect around update_sim handling in the CLI, and outlines the exact changes required to propagate the update_sim flag and wire it through the harness.
  • Validation blockers were reported for focused-embedding and self-dev efforts due to missing artifact label metadata, so those evidence streams could not be emitted as severity-bearing proofs.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (2)

  1. src/cli/dispatch.rs, line 316 (link)

    P1 Self-dev drops the update simulator setting

    jcode --update-sim self-dev is accepted, but this route calls run_self_dev without forwarding args.update_sim. The self-dev launcher then supplies false to run_tui_client, so it starts the normal TUI rather than the requested update preview and provides no feedback that the option was ignored. Thread the flag through the self-dev launcher and cover this invocation with a routing test.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/cli/dispatch.rs
    Line: 316
    
    Comment:
    **Self-dev drops the update simulator setting**
    
    `jcode --update-sim self-dev` is accepted, but this route calls `run_self_dev` without forwarding `args.update_sim`. The self-dev launcher then supplies `false` to `run_tui_client`, so it starts the normal TUI rather than the requested update preview and provides no feedback that the option was ignored. Thread the flag through the self-dev launcher and cover this invocation with a routing test.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
  2. General comment

    P1 Self-dev silently drops accepted --update-sim option

    • Bug
      • jcode --update-sim self-dev is accepted by Clap, yet the self-dev execution route launches the TUI with update simulation disabled. This makes the advertised simulation unavailable in self-dev mode without an argument error or user feedback.
    • Cause
      • Args::update_sim is forwarded by the default TUI route but not included in the Command::SelfDev call to run_self_dev. The self-dev launcher then passes literal false as the final run_tui_client argument.
    • Fix
      • Change run_self_dev to accept update_sim; call it as run_self_dev(build, args.resume, args.update_sim) in src/cli/dispatch.rs; forward that variable to run_tui_client in src/cli/selfdev.rs. Add a focused unit/routing test for jcode --update-sim self-dev.

    T-Rex Ran code and verified through T-Rex

Prompt To Fix All With AI
### Issue 1
src/cli/dispatch.rs:316
**Self-dev drops the update simulator setting**

`jcode --update-sim self-dev` is accepted, but this route calls `run_self_dev` without forwarding `args.update_sim`. The self-dev launcher then supplies `false` to `run_tui_client`, so it starts the normal TUI rather than the requested update preview and provides no feedback that the option was ignored. Thread the flag through the self-dev launcher and cover this invocation with a routing test.

---

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

Reviews (5): Last reviewed commit: "feat(tui): autoplay full update experien..." | Re-trigger Greptile

Comment thread crates/jcode-base/src/memory_agent.rs
@1jehuang

Copy link
Copy Markdown
Owner Author

Addressed the completed Greptile review in commit 8b40090aa. Hybrid retrieval now embeds the same focused query used by lexical retrieval, while retaining the broader context embedding separately for topic-change tracking. The focused retrieval regression passes, and cargo fmt --check plus cargo check -p jcode-base pass.

--- — Jcode agent (automated triage), on behalf of @1jehuang

Comment on lines +658 to +672
Ok(Err(e)) => {
crate::logging::event_rate_limited(
crate::logging::LogLevel::Info,
"memory_agent_retrieval_embedding_failed",
std::time::Duration::from_secs(60),
"MEMORY_RETRIEVAL_EMBEDDING_FAILED",
vec![
("session_id", session_id.to_string()),
("error", e.to_string()),
("fallback", "skip_memory_relevance".to_string()),
],
);
memory::set_state(MemoryState::Idle);
return Ok(());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Focused embedding failure skips lexical retrieval

When the broad-context embedding succeeds but the focused-query embedding is rate-limited or otherwise fails, this branch returns before find_similar_hybrid runs. That skips BM25 as well as dense retrieval, so a relevant memory can be missed even when the focused query alone is sufficient to find it. Fall back to lexical-only retrieval rather than returning before the hybrid search.

Artifacts

Focused embedding BM25 harness source

  • The authored in-crate harness seeds a BM25-specific memory and exercises successful and 429 focused-embedding paths through `MemoryAgent::process_context`, proving the compared behavior.

Focused embedding success control

  • Ran the real memory-agent control with two HTTP 200 embedding responses and observed `BM25 pending result=true`, showing hybrid BM25 surfaces the memory when focused embedding succeeds.

Focused embedding 429 reproduction

  • Ran the real memory-agent reproduction with broad embedding HTTP 200 and focused embedding HTTP 429 and observed `BM25 pending result=false`, proving the early return skips hybrid BM25.

Temporary test restoration

  • Ran Git verification after the tests and confirmed the temporary modification to `memory_agent_tests.rs` was restored with exit code 0.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-base/src/memory_agent.rs
Line: 658-672

Comment:
**Focused embedding failure skips lexical retrieval**

When the broad-context embedding succeeds but the focused-query embedding is rate-limited or otherwise fails, this branch returns before `find_similar_hybrid` runs. That skips BM25 as well as dense retrieval, so a relevant memory can be missed even when the focused query alone is sufficient to find it. Fall back to lexical-only retrieval rather than returning before the hybrid search.

---

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

Comment on lines +658 to +672
Ok(Err(e)) => {
crate::logging::event_rate_limited(
crate::logging::LogLevel::Info,
"memory_agent_retrieval_embedding_failed",
std::time::Duration::from_secs(60),
"MEMORY_RETRIEVAL_EMBEDDING_FAILED",
vec![
("session_id", session_id.to_string()),
("error", e.to_string()),
("fallback", "skip_memory_relevance".to_string()),
],
);
memory::set_state(MemoryState::Idle);
return Ok(());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Focused embedding failure disables lexical retrieval

When embedding the focused retrieval text fails, this branch returns before find_similar_hybrid runs. That prevents its BM25 pass from finding memories that match the focused text even though lexical retrieval does not require a focused embedding. Fall back to lexical-only retrieval rather than returning on this error.

Artifacts

Focused embedding-failure harness source

  • This executable Rust harness makes the broad embedding succeed and the focused embedding fail while seeding a matching BM25 sentinel, demonstrating the claimed branch.

Focused embedding-failure harness output

  • This captured cargo-test output records the two-request scenario, absent pending memory, one passing test, and exit code 0, confirming hybrid/BM25 retrieval was skipped.

Temporary test cleanup output

  • This captured cleanup command output records removal of the temporary repository integration test so only the retained evidence artifacts remain.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-base/src/memory_agent.rs
Line: 658-672

Comment:
**Focused embedding failure disables lexical retrieval**

When embedding the focused retrieval text fails, this branch returns before `find_similar_hybrid` runs. That prevents its BM25 pass from finding memories that match the focused text even though lexical retrieval does not require a focused embedding. Fall back to lexical-only retrieval rather than returning on this error.

---

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

Comment on lines +658 to +677
Ok(Err(e)) => {
crate::logging::event_rate_limited(
crate::logging::LogLevel::Info,
"memory_agent_retrieval_embedding_failed",
std::time::Duration::from_secs(60),
"MEMORY_RETRIEVAL_EMBEDDING_FAILED",
vec![
("session_id", session_id.to_string()),
("error", e.to_string()),
("fallback", "skip_memory_relevance".to_string()),
],
);
memory::set_state(MemoryState::Idle);
return Ok(());
}
Err(e) => {
crate::logging::info(&format!("Retrieval embedding task failed: {}", e));
memory::set_state(MemoryState::Idle);
return Ok(());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Focused embedding failure disables lexical retrieval

When the focused retrieval embedding fails, this branch sets the memory state to idle and returns before find_similar_hybrid executes. That prevents the hybrid search's BM25 pass from finding relevant memories even though lexical retrieval does not require a focused embedding. Fall back to lexical-only retrieval rather than returning on this error.

Artifacts

Review-authored focused embedding failure harness source

  • This Rust harness runs the memory agent against a local endpoint that succeeds for context embedding and fails for focused embedding, with the takeaway that it directly exercises the claimed early-return path.

Review-authored harness manifest

  • This manifest provides the isolated dependencies used to compile and run the review harness, with the takeaway that the runtime reproduction is independently runnable.

Current memory-agent control-flow capture

  • This command capture shows the current early return at lines 658-671 before `find_similar_hybrid` at lines 701-709, with the takeaway that the source control flow precludes BM25 fallback on focused embedding failure.

Completed focused embedding failure harness output

  • This successful runtime capture records two intentional embedding calls, zero hybrid completion events, Idle state, and exit code 0, with the takeaway that lexical BM25 fallback was not invoked.

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-base/src/memory_agent.rs
Line: 658-677

Comment:
**Focused embedding failure disables lexical retrieval**

When the focused retrieval embedding fails, this branch sets the memory state to idle and returns before `find_similar_hybrid` executes. That prevents the hybrid search's BM25 pass from finding relevant memories even though lexical retrieval does not require a focused embedding. Fall back to lexical-only retrieval rather than returning on this error.

---

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

@1jehuang
1jehuang merged commit 7c0c249 into master Aug 25, 2026
2 checks passed
.await
{
Ok(Ok((embedding, _model))) => embedding,
Ok(Err(e)) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Focused embedding failure bypasses hybrid lexical retrieval

  • Bug
    • When the broad context embedding succeeds but embed_query_active(&retrieval_text) fails, the focused-error arm returns Ok(()). The later find_similar_hybrid call, which performs dense-plus-BM25 fusion, is never reached, so a lexical-only match cannot be retrieved.
  • Cause
    • The focused embedding error handling at crates/jcode-base/src/memory_agent.rs lines 658-677 treats the dense embedding failure as terminal rather than degrading hybrid retrieval to a lexical-only path.
  • Fix
    • On focused embedding failure, execute lexical/BM25 retrieval (or make the hybrid API accept an absent dense vector) rather than returning before find_similar_hybrid.
Artifacts

Command output from the check

  • Executed Python control-flow harness against current memory_agent.rs with broad embedding success and focused embedding failure, showing the return precedes find_similar_hybrid; BM25 is skipped.

View artifacts

T-Rex Ran code and verified through T-Rex

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