Skip to content

fix(app-control): close TOCTOU race in session-lock acquisition#30083

Merged
siddseethepalli merged 1 commit into
mainfrom
swarm/43fc/task-180
May 9, 2026
Merged

fix(app-control): close TOCTOU race in session-lock acquisition#30083
siddseethepalli merged 1 commit into
mainfrom
swarm/43fc/task-180

Conversation

@siddseethepalli
Copy link
Copy Markdown
Contributor

@siddseethepalli siddseethepalli commented May 9, 2026

Address review feedback on #29323.

Changes

  • Acquire activeAppControlSession optimistically before dispatching the host start request, instead of after handleSuccess resolves. Two concurrent starts from different conversations could otherwise both pass the guard while the lock was still undefined and race the post-dispatch acquisition.
  • Release the optimistic lock on dispatch failure or when the host returns a non-running state.
  • Use this.conversationId consistently for both the start guard check and checkNonStartAuthorization, eliminating the inconsistency where the guard read the parameter while acquisition wrote this.conversationId.
  • Factor lock release into a releaseSessionIfHeld helper used by request, handleSuccess, and dispose.

Skipped feedback

  • Codex P1 'release lock on stop': already addressed — app_control_stop short-circuits in conversation-surfaces.ts and disposes the proxy, which releases the lock (covered by app-control-flow.test.ts).
  • Devin ANALYSIS on PNG-hash guard tracking non-observe tools: intentional behavior, documented inline.
  • Devin ANALYSIS on missing stop-releases-lock test: test exists at app-control-flow.test.ts:305.

Open in Devin Review

@siddseethepalli siddseethepalli self-assigned this May 9, 2026
@siddseethepalli siddseethepalli merged commit 7abc209 into main May 9, 2026
@siddseethepalli siddseethepalli deleted the swarm/43fc/task-180 branch May 9, 2026 04:20
Copy link
Copy Markdown

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

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: a6eb0eb65a

ℹ️ 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 assistant/src/daemon/host-app-control-proxy.ts
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment thread assistant/src/daemon/host-app-control-proxy.ts
Comment thread assistant/src/daemon/host-app-control-proxy.ts
@siddseethepalli
Copy link
Copy Markdown
Contributor Author

Addressed in #30531

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