Skip to content

fix(handoff): stop naming the project after a sandbox folder and keep a Source line - #314

Merged
kendrick merged 6 commits into
mainfrom
issue-310
Nov 8, 2026
Merged

kendrick merged 6 commits into
mainfrom
issue-310

Conversation

@kendrick

@kendrick kendrick commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Outside a git repo, handoff no longer names the project after the working directory. On a hosted chat that folder is a sandbox name the host picked, so the header line labeled the document with something unrelated to the work. A host that exposes no session id now gets a Source: <paste this chat's URL> line, so the document keeps a way back to the chat it came from.

Closes #310

What Changed

  • With no git root, PROJECT comes from a project:<name> token in the arguments, stripped before phase detection like the destination flags. Without the token, PROJECT is the current folder's name on every destination, so HANDOFF_DIR is always defined and handoff inline <id> still resumes a file written from that folder. Only the header changes: a canvas or inline document written without the token drops the project slot, <datetime> · Agent: <name>, because that folder may be a sandbox the host picked.
  • Inside git nothing changes. ROOT names the project and the token is ignored, so resume by id still finds the same HANDOFF_DIR.
  • Outside git, the file pointer repeats the token (Then invoke: handoff <id> project:<name>), because resume finds HANDOFF_DIR through PROJECT and nothing else carries the name. In-session review caught this one: without it, a tokened file handoff couldn't be resumed from its own pointer.
  • The template shows Session: and Source: under the header, with the rule that a document carries exactly one of them.
  • tests/handoff-smoke.sh pins seven strings and refutes two: the old "fall back to the current working directory if not in a git repo" and harpb's echo "$PWD", the form an upstream sync would bring back.
  • RATIONALE gains two [P] ledger rows and a Deliberately Not Built row for the cut fallback. PROVENANCE and the README each gain a line.

Start with the ROOT, PROJECT and ARGS bullets in _maintenance/handoff/template/SKILL.md, then the sentence after the file-pointer block. handoff/SKILL.md is a render of the template.

Verification

bash tests/handoff-smoke.sh and bash tests/repo-docs-smoke.sh pass at the baseline and at each gate, the last at 27f831a, this branch's head. I didn't run the other 18 suites. A Sonnet reproducer that didn't author the change reproduced all 10 claims in round 1 and all 5 repair claims in round 2:

  • caller, the suite: bash tests/handoff-smoke.sh; echo exit $? → Generated skill is current: …/handoff/SKILL.md, exit 0.
  • caller, both refutes bite: in a git archive HEAD copy with no .git, each refuted string appended to both SKILL.md files → exit 1 and unexpected text in handoff/SKILL.md: fall back to the current working directory if not in a git repo, then exit 1 and unexpected text in handoff/SKILL.md: echo "$PWD". The clean copy exits 0.
  • caller, the round-2 pins bite: in the same kind of copy, deleting "PROJECT still locates HANDOFF_DIR on resume" or "drops the project slot and its separator" from both SKILL.md files → exit 1 with missing expected text in handoff/SKILL.md: … naming each.
  • seam, the Codex P0: a sentence-by-sentence trace of handoff inline <id> outside git with no token strips inline, reads <id> as resume, sets PROJECT to the folder name and HANDOFF_DIR to <TMP>/agent-handoff/<folder>/, the same directory the file write used. A canvas or inline header written there still leaves the folder out.
  • seam, the render: cmp handoff/SKILL.md _maintenance/handoff/template/SKILL.md → identical.
  • seam, placement: grep -n puts ROOT, PROJECT and ARGS at lines 18, 19 and 22, Session: and Source: at 122 and 123, and the pointer rule at 58, directly after the unchanged pointer block. Both ledger rows read local | [P] … like their neighbours, and the Not Built row names both refuted strings.

Every seam claim is about prose, and nothing in the repo runs a model against the skill, so the suite is the closest production caller.

I also ran the text live, before the Codex repair. A fresh Sonnet agent read handoff/SKILL.md at e212886 and acted out five scenarios; the repair changes none of their outcomes:

  • On a web sandbox with no git, handoff inline project:garage-shelving … gave the header … · garage-shelving · Agent: Claude and a Source: line.
  • The same host without the token gave … · Agent: Claude, and the sandbox folder name appeared nowhere.
  • On a laptop outside git, the tokened file went to /tmp/agent-handoff/garage-shelving/, and its pointer ended project:garage-shelving. Resuming from that pointer found the file.
  • In a git repo with a session id, the token was ignored, and the document showed shelfapp / main with Session: abc123 and no Source: line.

The adversarial-review trigger printed authz on 9 changed lines. Seven are the English "where" and two are the unchanged "permission" sentence inside the edited paragraph after the template, so all 9 only mention the word, and the trigger didn't fire.

Left Out

  • project: garage-shelving, with a space after the colon, isn't read as the token. The rule "Only project: followed directly by a name is the token" is what keeps a prompt such as handoff the project: field is wrong a prompt.
  • A bare fresh-session handoff doesn't find a file that was written with a token, because it searches the folder-named directory. The printed pointer carries the token, and handoff project:<name> resumes it.
  • A local CLI with no session id, such as Codex in a repo, also prints Source: <paste this chat's URL>. The issue asks for that on every host without a session id, and the skill has no reliable test for "this is a web chat".
  • A bare handoff inline project:<name> after a talk-only chat still resumes instead of writing. That's handoff: a bare handoff inline after a talk-only chat resumes instead of writing #311, next in the run order.

… a Source line

Outside git, ROOT fell back to the working directory, so on a hosted chat with a sandbox the header named the project after a folder the host picked. Outside git, PROJECT now comes from a `project:<name>` token, or the current folder for a file destination, which is always on the user's own machine. A canvas or inline handoff with neither drops the slot. Inside git nothing changes, so resume by id still finds the same HANDOFF_DIR.

Hosts with no session id now get a `Source: <paste this chat's URL>` line for the user to fill in, so the document keeps a way back to the chat. The suite refutes the old cwd fallback, because harpb's `|| echo "$PWD"` is how a sync would restore it.

Part of #310.
… the cut cwd fallback

The Deliberately Not Built row backs the new refute, since harpb's working-directory fallback is what an upstream sync would carry back in.

Part of #310.
…inds the folder

Outside git, a file handoff written with project:<name> lands under that name, but the printed invoke line had no token, so resume fell back to the current folder and looked in the wrong HANDOFF_DIR. The pointer now repeats the token. The suite also refutes harpb's own echo "$PWD" spelling of the cut fallback, and the two new ledger rows put their tier where the neighbouring rows do.

Part of #310.
@kendrick

kendrick commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T20:48:11.908481Z 27f831a Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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

ℹ️ 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 handoff/SKILL.md Resolved
…ume still finds the file

With no token, canvas and inline destinations had no PROJECT, so `handoff inline <id>` resuming a file written from the same folder looked in an undefined HANDOFF_DIR, even though resume ignores the inline flag. PROJECT is now the folder name on every destination, and only a canvas or inline header leaves it out, which is the part that could show a sandbox's name. The ledger, the Deliberately Not Built row, the provenance note, and the README follow the split.

Part of #310.
Review of the resume fix found the Not Built row and the provenance note still read as if the folder fallback were cut outright. Both now say the cut is ROOT falling back to the working directory, which is what would put a sandbox's name back in the header. The suite pins the clause that drops the header's project slot, and the PROJECT bullet loses a duplicated clause.

Part of #310.
@kendrick

kendrick commented Nov 8, 2026

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: 9a59360944

ℹ️ 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 handoff/README.md Resolved
The README dropped both conditions SKILL.md puts on the header omission, so it contradicted its own project:garage-shelving example and wrongly covered writes inside git.

Part of #310.
@kendrick

kendrick commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 27f831a031

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

@kendrick
kendrick merged commit c4cf26d into main Nov 8, 2026
1 check passed
@kendrick
kendrick deleted the issue-310 branch November 8, 2026 20:54
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.

handoff: outside git, PROJECT becomes the sandbox directory name and the chat link is lost

1 participant