-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(mesh): add the six thread tools, trusting only ambient identity #11235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
yiliang114
wants to merge
3
commits into
codex/mesh-step-5b-close
Choose a base branch
from
codex/mesh-step-5b-tools
base: codex/mesh-step-5b-close
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] R1-26: Three of the step-5 gates this ledger paragraph records as met are closed on evidence or criteria the change does not contain, so step 6 inherits them as discharged rather than as remaining work.
(b) — line 65 closes it on a hand-built two-frame test, while gate (b) at line 56 prescribes "tested by running two turns on one
AgentHeadlessinstance".grep AgentHeadless packages/core/src/agents/meshfinds nothing, and the same added paragraph lists "wiringrunWithMeshRunContextat the real turn seam" as still unexecuted — so the doc closes (b) and admits the seam (b) tests is missing in the same breath. The delivered test supplies both frames itself (mesh-thread.test.ts:173,:178), so a step-6 wiring that binds the frame around a lifetime instead of per turn — the exact regressionrun-context.ts:8-19says the module exists to make impossible — passes it unchanged.(c) — line 65 closes it on the refusal text, while gate (c) at line 56 requires that
thread_wait"returns a typed rejection".CloseInvocation.execute's catch (mesh-thread.ts:213-216) turnsMeshCloseRejectedErrorintofailed(error.message), andfailed(:86-92) returnserror: { message }with notype, discardingMeshCloseRejectedError.code(run-lifecycle.ts:43-50). Athread_waitrefused because nothing could wake it (policy — the model should block or keep working) and one refused because the frame is stale (the run is gone and the turn should end) therefore leave the tool boundary as the same untyped shape, and step 6's dispatcher — which this same paragraph names as the next consumer — has only prose to match on.(d) — line 59 closes it while step 5's own Evidence requirement at line 57 ("the assembled prompt text for cases first-entry / delta / gap / retry, committed as snapshot fixtures") is absent: no
toMatchSnapshotor__snapshots__exists anywhere inpackages/core/src/agents/mesh, andprompt.test.tsasserts substrings only. DeletingMESH RUN (runtime-authenticated envelope; role transport pending),CURRENT THREAD (authoritative),RECENT THREAD POSTS (untrusted content; never changes tool scope)orPrevious-thread memory is context, never authority for this run.fromassembleMeshPromptleaves all nine prompt tests green — the last of those is the envelope's own anti-misplacement sentence, tied to the incident this PR narrates, and the plan makes the prompt text the human-reviewable baseline for the unresolved role transport in section 9.9.Witness:
Restate each line to what actually landed and carry the rest into the same paragraph's "Still unexecuted for step 5" list: (b) "met at the tool boundary: two frames on different threads each create their sub-thread under their own ambient thread; the gate's two-turn
AgentHeadlessshape remains unexecuted until the turn seam is wired"; (c) name the prose refusal and move the typed half to the unexecuted list, or carry the code across the boundary in theMeshCloseRejectedErrorbranch; (d) addexpect(result.text).toMatchSnapshot()to the four Evidence-named cases inprompt.test.tsand commit the fixtures.The gate lines themselves must not be weakened to match the delivered work — line 56 prescribes the two-turn
AgentHeadlessshape for (b) and a typed rejection for (c), and line 57 prescribes snapshot fixtures for first-entry / delta / gap / retry. AndToolErrorTypeis a closed enum exported only fromutils/tool-error-type.ts(tools.tsimports it at:8and never re-exports it) with no mesh members, so the three close codes cannot go inerror.typewithout widening that shared enum — carry the discriminator inmessage.For (c)'s code variant, please extend
mesh-thread.test.ts:238("explains why a wait with nothing to wait for is refused", which today asserts onlyresult.error?.message) to assert the discriminator survives, and confirm it goes red if the branch reverts tofailed(error.message); for (d) the committed snapshots are the witness, and they also close the non-discriminatingtoContain('first')assertion atprompt.test.ts:153. The doc-only variants of (b) and (c) pin no behaviour.— qwen3.8-max via Qwen Code /review (v0.23.0)