Repository navigation
antigravity 0.1.5: derive sessionId from host session headers and skip injected preambles - #1017
Merged
Conversation
…p injected preambles
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
sessionOf(req)previously looked only at the firstrole === "user"message and stopped aftercontents[0], ignoringx-magpie-session/x-magpie-subagent(and OpenCode'schat.headerssessionID).In Codex (and other agents that prepend an
AGENTS.md/<environment_context>message before the user's actual first prompt),req.contents[0].parts[0].textis identical across every thread (# AGENTS.md instructions...). As a result:thread_titlerequest, and concurrent subagent collided onto the exact samerequest.sessionIdconstant.Changes
x-magpie-sessionandx-magpie-subagentinsessionOf(req, headers)(ignoring syntheticmagpie-<24hex>fallback IDs, matchingpackages/cline), and forward OpenCode 1.x'ssessionIDvia"chat.headers".x-magpie-subagentis present (e.g. concurrentcollab_spawnworkers sharing a parent session ID) or when no host session header is provided, scanuserparts past injected preambles (# AGENTS.md,<environment_context>,<permissions instructions>,<system-reminder>, Codex page snapshots, etc.) to reach the conversation's first real user prompt.@magpie-community/opencode-antigravity-authto0.1.5, updateREADME.md, and add unit tests inshape.test.mjsandrequests.test.mjs.Verification
HOME=$(mktemp -d) bun test packages/antigravity: 88 pass, 0 failbun scripts/check.mjs antigravity: exit 0