Skip to content

fix: preserve full input context in span attributes for multi-message… - #152

Closed
rite7sh wants to merge 2 commits into
future-agi:mainfrom
rite7sh:fix/input-context-preservation
Closed

rite7sh wants to merge 2 commits into
future-agi:mainfrom
rite7sh:fix/input-context-preservation

Conversation

@rite7sh

@rite7sh rite7sh commented Apr 7, 2026

Copy link
Copy Markdown

Fixes #151

Summary

Fixes an issue where SpanAttributes.INPUT_VALUE was overwritten multiple times in _process_input_data, with the final assignment reducing it to only the first message.

Changes

  • Set INPUT_VALUE only once using full joined input
  • Removed overwrite with eval_input[0]
  • Added tests for multi-message, single-message, and non-list inputs

Impact

Preserves full input context for multi-message traces, improving trace correctness and observability.

Testing

  • Ran: PYTHONPATH=frameworks/openai poetry run pytest tests/test_framework_openai.py -v
  • All tests passed (including new test cases)

Comment thread python/fi_instrumentation/fi_types.py Outdated
OUTPUT_MIME_TYPE = "output.mime_type"
INPUT_VALUE = "input.value"
INPUT_MIME_TYPE = "input.mime_type"
INPUT_RAW = "input.raw"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't introduce INPUT_RAW — adding new span attributes has downstream implications. The fix should not require a new attribute.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yea, you are right the downstream impli would help.. lemme fix it.

Comment on lines 59 to -63
if eval_input:
eval_input_str = " \n ".join(map(str, eval_input))
span.set_attribute(SpanAttributes.INPUT_VALUE, eval_input_str)
if eval_input and len(eval_input) > 0:
span.set_attribute(SpanAttributes.INPUT_VALUE, eval_input[0])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just Deleting these lines should solve the issue of data being overwritten , no need to introduce any new span attributes

@JayaSurya-27 JayaSurya-27 added the bug Something isn't working label Apr 9, 2026
@rite7sh

rite7sh commented Apr 9, 2026

Copy link
Copy Markdown
Author

@JayaSurya-27 let me know if the 2d31b8f works.

@nik13

nik13 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Thanks, Ritesh, for tracking this down and for turning the review around so quickly. The full-conversation fix is now on dev and main (it landed with #245 in our release train), and we've confirmed it with tests, so we're closing this overlapping PR. If you spot a case it still misses, please open an issue with an example and we'll take a look.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

INPUT_VALUE overwritten in _process_input_data leading to loss of multi-message context

3 participants