Skip to content

feat(mcp): allow agents to settle their own thread after completion - #85

Open
Mjones13 wants to merge 1 commit into
work/submitted-work-queue-page-20261003from
fix/agent-self-settlement-20261004
Open

Mjones13 wants to merge 1 commit into
work/submitted-work-queue-page-20261003from
fix/agent-self-settlement-20261004

Conversation

@Mjones13

@Mjones13 Mjones13 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Agents cannot immediately settle their active thread because doing so would stop work before its final response and checkpoint. This adds the calling-thread-only t3_thread_settle MCP tool: it acknowledges a durable request and settles after the requesting run completes successfully.

The request binds the authenticated MCP credential to the resident native session and current run. A stable clientRequestId replays the original receipt across later turns. Failure, cancellation, new user work, reverse actions, and startup invalidate pending intent. Completion reuses the existing settlement guard and cleanup under the thread lock before queue promotion.

This PR targets #78 at 76a459ddca506a7af7136e01fa9865272cca5f9f, above #77. Parent branches are unchanged. Sibling #82 changes the worktree launch base in the shared contract file; this feature has no dependency on that change. No merge or deployment is authorized.

Validation on d14ab41b4e873b6e78a78f74bef1fbccd13502a4:

  • Focused lifecycle-policy and MCP/v2 contract checks passed: 60 tests in three files.
  • The final deduplicated union of four affected groups plus direct MCP tests ran 43 modules: 207 tests passed, one failed, and 30 suites could not load. The missing parent orchestration/NativeCreationAuthority.ts import blocks integrated lifecycle, credential-mapping, and cleanup execution. The unchanged migration-history test expects rows 1–6 while the unchanged manifest supplies rows 1–11.
  • Integrated tests were added for acknowledgement, waiting versus completed runs, durable detach effects, cross-run replay, and stale completion after failure/cancellation/queued or steered work. They remain unexecuted due to that parent import. Real checkpoint-worker execution, physical process detachment, and restart cancellation are unverified.
  • Contracts-only typecheck reports eight errors in inherited files. Scoped lint reports two inherited node:crypto import errors. Diff whitespace checks passed. An independent focused correctness review found no supported findings at this exact head.

The required formatter and normal commit hook reformatted inherited code in feature-touched files, producing substantial formatting churn. Comparing the same formatter-normalized parent blobs against this candidate isolates 1,484 semantic diff lines across 18 files; review found no semantic expansion beyond this feature. No unrelated source repairs, UI changes, runtime state changes, merge, or deployment occurred.

Requested models: GPT-6 Astra high for implementation and correctness review, Astra medium for integration tests, and GPT-6.1 Sol medium for coordination. Harness: Codex through T3 Code, Frontier mode.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

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.

1 participant