Skip to content

Conversation

@bfollington
Copy link
Contributor

@bfollington bfollington commented Oct 30, 2025

  • WIP tx-analysis
  • Add real implementation
  • Remove test data and scripts
  • Refine tx summary

Summary by cubic

Return a concise transaction summary alongside tool call results to help LLMs debug without large payloads. The result now includes { value, summary } built from the completed transaction.

  • New Features

    • Added transaction-summary module with summarizeTransaction, formatTransactionSummary, debugTransactionWrites, and TransactionSummary type.
    • llm-dialog now resolves tool calls with { value, summary } using formatTransactionSummary(completedTx, space).
    • Re-exported summary helpers from packages/runner/src/index.ts.
    • Added TX_ROLLUP_README and unit tests for summary behavior.
  • Migration

    • Update consumers of tool call results to handle an object: { value, summary } instead of a raw value.
    • Pass the MemorySpace to formatTransactionSummary for detailed write values when needed.

@linear
Copy link

linear bot commented Oct 30, 2025

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 5 files

Prompt for AI agents (all 2 issues)

Understand the root cause of the following 2 issues and fix them.


<file name="packages/runner/src/storage/transaction-summary.ts">

<violation number="1" location="packages/runner/src/storage/transaction-summary.ts:131">
When a space is provided but no write details are available (writes occurred elsewhere or produced no novelty), this branch ladder returns an empty string and hides the summary from summarizeTransaction. Fall back to summary.summary so the caller still gets a description.</violation>
</file>

<file name="packages/runner/src/builtins/llm-dialog.ts">

<violation number="1" location="packages/runner/src/builtins/llm-dialog.ts:823">
Handler tool results are now double-wrapped, so LLM/tool consumers receive `{ value: { value, summary } }` instead of the handler output.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

const summary = formatTransactionSummary(completedTx, space);
const value = result.withTx(completedTx).get();

resolve({ value, summary });
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 30, 2025

Choose a reason for hiding this comment

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

Handler tool results are now double-wrapped, so LLM/tool consumers receive { value: { value, summary } } instead of the handler output.

Prompt for AI agents
Address the following comment on packages/runner/src/builtins/llm-dialog.ts at line 823:

<comment>Handler tool results are now double-wrapped, so LLM/tool consumers receive `{ value: { value, summary } }` instead of the handler output.</comment>

<file context>
@@ -811,8 +815,13 @@ async function invokeToolCall(
+        const summary = formatTransactionSummary(completedTx, space);
+        const value = result.withTx(completedTx).get();
+
+        resolve({ value, summary });
+      });
     } else {
</file context>
Fix with Cubic

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@bfollington bfollington merged commit 8f868c0 into main Oct 30, 2025
9 checks passed
@bfollington bfollington deleted the ben/ct-978-include-completedtx-contents-in-tool-call-result branch October 30, 2025 02:47
jkomoros pushed a commit that referenced this pull request Oct 30, 2025
* WIP tx-analysis

* Add real implementation

* Remove test data and scripts

* Refine tx summary

* Remove long pointless README

* Remove accidental `mise.toml`

* Remove JournalMock from tests

* Remove unused analysis

* Format and lint

* PR feedback
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