Skip to content

feat: add idempotent start tokens to the workspace agent process API - #27322

Closed
ibetitsmike wants to merge 1 commit into
mike/codagt-757/05-execution-sweepfrom
mike/codagt-757/06-agent-start-tokens
Closed

ibetitsmike wants to merge 1 commit into
mike/codagt-757/05-execution-sweepfrom
mike/codagt-757/06-agent-start-tokens

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Adds idempotent start tokens to the workspace agent process API: a client-supplied opaque token makes process starts exactly-once per token and addressable by token.

Part 6/9 of the CODAGT-757 execution ledger stack (base: #5). Agent and SDK surface only; chatd adopts it in the next two PRs. Supersedes the agent portion of #27102.

Changes

  • StartProcessRequest.ClientToken: the manager reserves the token before spawning, echoes it on the response, and returns the existing process (env-matched) for a duplicate token instead of starting a second process. Concurrent same-token starts collapse to one spawn; waiters honor cancellation and unblock on close.
  • GET /api/v0/processes/tokens/{token}: token probe returning the process (or pending reservation) owning a token.
  • Token index lifecycle: reaped with exited processes on the 60-minute horizon; tokenIndexAge exposes staleness so callers can decide whether an absent token is trustworthy.
  • workspacesdk: ProcessByToken on AgentConn, ProbeProcessToken helper, mock support.

This PR was authored by Mux, an AI coding agent, on Mike's behalf. The stack recomposes the previously reviewed #27100/#27102/#27103 into reviewable pieces, plus fixes from subsequent review rounds.

@linear-code

linear-code Bot commented Jul 17, 2026

Copy link
Copy Markdown

CODAGT-757

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6efe588c7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codersdk/workspacesdk/agentconn.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from ae1b741 to 9bb2557 Compare July 17, 2026 18:59
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from 6efe588 to 1997ba3 Compare July 17, 2026 18:59
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1997ba3c8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread agent/agentproc/process.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from 9bb2557 to 7d87029 Compare July 17, 2026 19:59
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from 1997ba3 to 5ecd8f7 Compare July 17, 2026 19:59
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 5ecd8f770f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from 7d87029 to 78ace45 Compare July 17, 2026 20:37
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from 5ecd8f7 to b6c99b6 Compare July 17, 2026 20:37
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: b6c99b615f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from 78ace45 to 8074fdc Compare July 17, 2026 21:48
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from b6c99b6 to 41bd12e Compare July 17, 2026 21:48
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 41bd12e280

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from 41bd12e to 85b34db Compare July 17, 2026 22:37
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from 8074fdc to 205b452 Compare July 17, 2026 22:37
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85b34db994

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread agent/agentproc/process.go Outdated
Comment thread codersdk/workspacesdk/agentconn.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from 205b452 to c0c96f9 Compare July 17, 2026 23:09
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from 85b34db to 58d62d8 Compare July 17, 2026 23:09
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 5fcfc6e6cd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from 5fcfc6e to a66cf97 Compare July 18, 2026 01:38
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from ca25790 to a5c7e47 Compare July 18, 2026 01:38
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: a66cf97400

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from a66cf97 to f011a73 Compare July 18, 2026 01:57
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f011a738b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread agent/agentproc/process.go
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from f011a73 to a464f67 Compare July 18, 2026 02:16
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: a464f672b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from a5c7e47 to b5c637b Compare July 18, 2026 03:50
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from a464f67 to 44be8b4 Compare July 18, 2026 03:50
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 44be8b4d9a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from b5c637b to 06bcf14 Compare July 18, 2026 04:36
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from 44be8b4 to b984e56 Compare July 18, 2026 04:36
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: b984e56635

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from 06bcf14 to 8564e68 Compare July 18, 2026 04:57
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from b984e56 to c0c1b86 Compare July 18, 2026 04:57
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0c1b86e79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread agent/agentproc/process.go Outdated
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/05-execution-sweep branch from 8564e68 to 163aad2 Compare July 18, 2026 05:57
@ibetitsmike
ibetitsmike force-pushed the mike/codagt-757/06-agent-start-tokens branch from c0c1b86 to c1fcc14 Compare July 18, 2026 05:57
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: c1fcc14aa7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Superseded by a simplified, ledger-free cut of CODAGT-757: #27369, #27370, #27371, #27372.

The new stack drops the database execution ledger entirely and instead relies on agent-side idempotent start tokens with at-least-once semantics: replays attach to the original process when the agent still knows the token, and re-run otherwise. The branches of this stack are kept as the salvage reference until the new stack merges.

This comment was written by Mux, an AI coding agent, operating on Mike's behalf.

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