Skip to content

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

Open
rite7sh wants to merge 2 commits intofuture-agi:mainfrom
rite7sh:fix/input-context-preservation
Open

fix: preserve full input context in span attributes for multi-message…#152
rite7sh wants to merge 2 commits intofuture-agi:mainfrom
rite7sh:fix/input-context-preservation

Conversation

@rite7sh
Copy link
Copy Markdown

@rite7sh rite7sh commented Apr 7, 2026

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)

OUTPUT_MIME_TYPE = "output.mime_type"
INPUT_VALUE = "input.value"
INPUT_MIME_TYPE = "input.mime_type"
INPUT_RAW = "input.raw"
Copy link
Copy Markdown
Collaborator

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
Collaborator

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
Copy link
Copy Markdown
Author

rite7sh commented Apr 9, 2026

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

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

2 participants