Repository: truera/trulens
Issue: __record__.app Only Retains One Key (e.g., retrieve or query), Causing Feedback Evaluations to Fail
Root cause: Algorithmic Error

**Bug Description**
When using TruLens with multiple feedback functions, the __record__.app object seems to only retain a single key (e.g., retrieve or query) but not both simultaneously. This behavior causes feedback evaluations like context relevance to fail when data from both keys is required, as the necessary data is missing.
This also caused duplication of the record to provide each of the 3 feedback functions result on the dashboard (see screenshot below) 

**To Reproduce**
Steps to reproduce the issue:

Define multiple feedback functions in TruLens with different targets in the app key (e.g., one targeting retrieve and another targeting query).
Run a pipeline that generates data for both retrieve and query operations.
Observe the debugging output for __record__.app during the execution of feedback functions.

**Minimal reproducible code:**
from trulens import Feedback, Select, Lens
import numpy as np

# Feedback definitions
f_context_relevance = (
    Feedback(provider.context_relevance_with_cot_reasons, name="Context Relevance")
    .on_input()
    .on(Select.RecordCalls.retrieve.rets[:])
    .aggregate(np.mean)
)

f_answer_relevance = (
    Feedback(provider.relevance_with_cot_reasons, name="Answer Relevance")
    .on_input()
    .on(Select.RecordCalls.query.rets)
)

feedbacks = [f_context_relevance, f_answer_relevance]

Query function signature : query(self, query, chat_history, user_information, enrollment_start_date, enrollment_end_date, current_date, client_name, brower_language)
Retrieve function signature : retrieve(self, query, tenant_id="common", k=5)

# Run pipeline and inspect app object
print("Debugging __record__.app content:")
print(source_data["__record__"]["app"].keys())

**Expected Behavior**
The __record__.app object should include all relevant keys (e.g., both retrieve and query) after their respective calls, ensuring feedback functions dependent on those keys can access the necessary data.

**Debugging outputs during execution:**
----------------------------------------------------------------
dict_keys(['retrieve'])
dict_items([('prompt', Lens().__record__.main_input), ('response', Lens().__record__.app.query.rets)])
----------------------------------------------------------------

----------------------------------------------------------------
dict_keys(['query'])
dict_items([('source', Lens().__record__.app.retrieve.rets), ('statement', Lens().__record__.main_output)])
----------------------------------------------------------------
**Error traceback:**

Run of run_and_call_callback in <Thread> failed with: Selector __record__.app.retrieve.rets does not exist in source data.
**Environment**

OS: [Your OS, e.g., Windows 11]
Python Version: [Your Python version, e.g., 3.10.4]
TruLens Version: [Installed TruLens version, e.g., 0.12.2]
Other Relevant Libraries: [Any other libraries used, e.g., LangChain, Numpy]

__record__.app Only Retains One Key (e.g., retrieve or query), Causing Feedback Evaluations to Fail

![Uploading Capture.222PNG.PNG…]()


Hey @ciliamadani - I see you closed this issue. Can you share the resolution/cause of your issue?