Skip to content

fix(penpal): address Codex review findings#304

Merged
loganj merged 4 commits intomainfrom
fix/penpal-codex-followups
Mar 1, 2026
Merged

fix(penpal): address Codex review findings#304
loganj merged 4 commits intomainfrom
fix/penpal-codex-followups

Conversation

@loganj
Copy link
Collaborator

@loganj loganj commented Feb 26, 2026

Summary

Follow-up to #302 — addresses remaining findings from Codex code review of the penpal Go backend:

  • Reject project-root path in isSubpathisSubpath(parent, child) returned true when child == parent, so path=. passed validation and could reach os.Remove on the project directory itself. Now requires strict subpath.
  • Honor status filter in penpal_list_threads — When called without a path, the MCP tool unconditionally returned only open threads, ignoring the status parameter. Extract ListThreadsByStatus and use it so status=resolved works project-wide.
  • Guard StopPolling against double-close — Closing the stop channel without a guard panics if called twice during shutdown. Add mutex protection and nil the channel after close.
  • Fix parseStream/logFile racecmd.Wait() could return before parseStream finished writing to the log file, and the exit goroutine would close it mid-write. Synchronize with a channel.

Test plan

  • go test ./... passes (pre-existing TestAPIProjects_ListsProjects flake unrelated)
  • TestIsSubpath updated — parent == child now returns false
  • ListOpenThreads delegates to new ListThreadsByStatus, existing tests pass

🤖 Generated with Claude Code

loganj and others added 3 commits February 26, 2026 15:45
isSubpath(parent, child) previously returned true when child == parent,
allowing path=. to pass validation and reach os.Remove in the delete
handler. This could delete the project directory itself on empty projects.

Make the check strictly "inside parent" so equal paths are rejected.

Addresses Codex review comment on PR #302.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
penpal_list_threads with no path unconditionally called ListOpenThreads,
ignoring the status parameter. Callers requesting status=resolved got
only open threads.

Extract ListThreadsByStatus and use it in the MCP tool so the status
filter is respected for project-wide queries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
StopPolling closed the stopCh channel without guarding against repeated
calls, which would panic. Protect with a mutex and nil the channel
after closing so subsequent calls are safe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@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: cada418a88

ℹ️ 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".

@loganj loganj added the ai-outer-loop Managed by outer-loop label Feb 26, 2026
@loganj loganj force-pushed the fix/penpal-codex-followups branch from cada418 to 6998c73 Compare February 26, 2026 20:59
Copy link

@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: 6998c734b2

ℹ️ 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".

@loganj loganj force-pushed the fix/penpal-codex-followups branch from 6998c73 to 9bbcc3e Compare February 28, 2026 21:01
Copy link

@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: 9bbcc3edca

ℹ️ 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".

@loganj loganj marked this pull request as draft February 28, 2026 21:10
cmd.Wait() can return before parseStream finishes its last write to
logFile. The exit goroutine then closes logFile while parseStream may
still be writing. Synchronize with a channel so logFile is only closed
after parseStream returns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@loganj loganj force-pushed the fix/penpal-codex-followups branch from 9bbcc3e to 9c9e182 Compare February 28, 2026 21:11
@loganj loganj marked this pull request as ready for review March 1, 2026 02:19
@loganj loganj merged commit 09319b1 into main Mar 1, 2026
3 checks passed
@loganj loganj deleted the fix/penpal-codex-followups branch March 1, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-outer-loop Managed by outer-loop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant