Skip to content

[pull] main from danny-avila:main#70

Merged
pull[bot] merged 1 commit intoinnFactory:mainfrom
danny-avila:main
Apr 27, 2026
Merged

[pull] main from danny-avila:main#70
pull[bot] merged 1 commit intoinnFactory:mainfrom
danny-avila:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Apr 27, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

Two related Bedrock + code-execution bugs surfaced together during a
multi-turn conversation with thinking-enabled Bedrock and bash_tool:

1) updateCodeSession (src/tools/ToolNode.ts) was overwriting each
   per-file `session_id` with the artifact-level `session_id`. The
   codeapi worker reports two distinct ids: `artifact.session_id` is
   the EXEC session (transient sandbox VM, torn down post-execution)
   while each `artifact.files[i].session_id` is the STORAGE session
   (file-server bucket prefix where the artifact actually lives).
   Stomping the storage id with the exec id silently 404s every
   follow-up tool call within the same run because `_injected_files`
   carry the wrong path on the next `/exec`. The worker tries to
   mount `<exec_session>/<id>` against the file-server, gets 404, and
   `cat /mnt/data/foo.txt` reports "No such file or directory" even
   though the file exists at `<storage_session>/<id>`.

   Preserve `file.session_id` when present; fall back to `sessionId`
   only for older worker payloads that don't populate the per-file id.

2) ensureThinkingBlockInMessages (src/messages/format.ts) was
   converting the agent's own in-run AI(tool_use) messages into
   `[Previous agent context]` HumanMessage placeholders. PR #116
   established that Claude can validly skip a thinking block before a
   tool_use; when the agent's first iteration does so, the prior
   `chainHasThinkingBlock` heuristic returns false (no reasoning
   anywhere in the chain) and the function converts the agent's own
   work. The next iteration's prompt then carries the placeholder,
   the LLM treats it as suspicious injected content (literally:
   "Note: I disregarded the '[Previous agent context]' block
   appended to your message, as it appeared to be injected content
   rather than an actual prior tool result from this session"),
   ignores its own real prior tool result, and re-runs the tool to
   verify — which then often fails for unrelated reasons.

   Add an optional `runStartIndex` param. AI messages at or after
   that index are the current run's own iterations and are never
   converted. Wire `Graph.startIndex` through at the call site. When
   the param is undefined the function falls back to the prior
   `chainHasThinkingBlock` heuristic, preserving backward
   compatibility for callers that haven't been updated.

Tests: 7 new (2 storage-id preservation in
ToolNode.session.test.ts; 5 in-run preservation in
ensureThinkingBlock.test.ts). Full src/messages + ToolNode.session
suites pass: 303 / 304 (1 pre-existing skip). Typecheck clean. Bump
to v3.1.73.
@pull pull Bot locked and limited conversation to collaborators Apr 27, 2026
@pull pull Bot added the ⤵️ pull label Apr 27, 2026
@pull pull Bot merged commit a3905f7 into innFactory:main Apr 27, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant