Skip to content

feat(scaffold): optional Open Scaffold handoff source (#48) - #57

Merged
graphanov merged 5 commits into
mainfrom
forge/issue-48-open-scaffold-handoff
Jun 29, 2026
Merged

feat(scaffold): optional Open Scaffold handoff source (#48)#57
graphanov merged 5 commits into
mainfrom
forge/issue-48-open-scaffold-handoff

Conversation

@graphanov

Copy link
Copy Markdown
Owner

Summary

  • Adds optional, read-only Open Scaffold handoff discovery and a SessionStart plugin that injects bounded handoff context when .osc/ or MISSION.md are present. No osc subprocess or MCP client is invoked.

Scope

  • src/scaffold/handoff.js (discovery + bounded reader), src/plugins/scaffold-handoff.js (SessionStart inject), src/doctor.js (scaffold status check), docs/design.md (relationship to compaction digest), test/scaffold-handoff.test.mjs + test/doctor.test.mjs (coverage)

Out of scope

  • merge/publish/release; no required runtime dependency on open-scaffold; no MCP client implementation; no osc subprocess invocation

Verification

  • node --test test/*.test.mjs -> 440 pass / 0 fail; npm run typecheck -> clean; npm run build -> clean

Risk

  • low

Linked issue

48

Authority boundary

draft/ready/review only; no merge/publish/release.

Add read-only, dependency-free Open Scaffold handoff discovery and a
SessionStart plugin that injects bounded handoff context when .osc/ or
MISSION.md are present. No osc subprocess, no MCP client connection.
Doctor surfaces scaffold status; design doc records the relationship to
the deterministic compaction digest (fallback/hot-path remains canonical).

Closes #48
@graphanov
graphanov marked this pull request as ready for review June 28, 2026 23:17
@graphanov

Copy link
Copy Markdown
Owner 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: 66b7d59d1b

ℹ️ 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 src/scaffold/handoff.js Outdated
Per-candidate try/catch around readFile so a malformed preferred
record (directory, bad permissions, broken symlink) falls through to
the next candidate instead of disabling handoff injection entirely.

Addresses Codex P2 review finding on PR #57.
@graphanov

Copy link
Copy Markdown
Owner 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: 084664ebcd

ℹ️ 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 src/scaffold/handoff.js Outdated
Stat each handoff candidate and cap the disk read at 16 KiB so an
accidentally huge .osc/handoff.md or MISSION.md cannot exhaust memory
or stall startup before truncation is applied. Adds a regression test
for the oversized case.

Resolves P2 review thread on src/scaffold/handoff.js:24.
@graphanov

Copy link
Copy Markdown
Owner 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: b8b2a15b70

ℹ️ 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 src/scaffold/handoff.js Outdated
Comment thread src/scaffold/handoff.js Outdated
Address two P2 Codex review findings on src/scaffold/handoff.js:
- Skip non-regular handoff candidates (FIFOs, device nodes, directories)
  before opening so a blocking special file cannot hang startup.
- Decode only the bytes actually read (buffer.subarray(0, bytesRead)) so
  a short read or a file that shrank between stat and read cannot leak
  uninitialized Buffer memory into the injected system prompt.

Adds a focused test for non-regular file fallback.
@graphanov

Copy link
Copy Markdown
Owner 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: 27505e01cc

ℹ️ 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 src/scaffold/handoff.js Outdated
readHandoffText used statSync (follows symlinks), so a MISSION.md or
.osc/handoff.md symlink pointing at an absolute or ..-escaped file
(e.g. $HOME/.ssh/config) would pass isFile() and have its target
contents injected into the system prompt before any user approval.

Switch to lstatSync and reject any candidate where lstat reports a
symbolic link, so only real, repo-native files are accepted as handoff
context. Adds two regression tests: an out-of-repo symlink escape and
an in-repo symlink, both now rejected.

Addresses P1 Codex review finding on PR #57.
@graphanov

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: ea1b3b45be

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

@graphanov
graphanov merged commit 3aab32c into main Jun 29, 2026
1 check passed
@graphanov
graphanov deleted the forge/issue-48-open-scaffold-handoff branch June 29, 2026 08:26
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