[pull] main from danny-avila:main#70
Merged
pull[bot] merged 1 commit intoinnFactory:mainfrom Apr 27, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )