Skip to content

Carry selected research and next task through assistant handoffs - #41

Merged
sdcarlson merged 2 commits into
mainfrom
feat/37-context-handoff
Sep 6, 2026
Merged

sdcarlson merged 2 commits into
mainfrom
feat/37-context-handoff

Conversation

@sdcarlson

@sdcarlson sdcarlson commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #37.

Users can now select and edit one job's research and specify the next drafting task inside the existing Prepare for ChatGPT/Codex downloads. Research stays separate from candidate facts, optional fields clear on job changes, oversized context is rejected, and returned drafts retain explicit review and stale-version checks. No migration, dependencies, provider service, or submission behavior changes.

Reconciled onto current main007e0ae after #13, #36 and #42 merged. Canonical copy/paste, exact editor checks, selected-job packet creation and history remain intact. Production remains blocked by owner setup in #3 and the normal staging/peer production approval gates.

Validation: lint, typecheck, 99 unit tests, public-copy check, build, API suite, all 6 Chromium journeys (context returns by paste and file), and compiled production/gateway smoke passed locally. High-severity dependency audit passed; inherited development-tool esbuild advisories remain (one moderate via drizzle-kit, one low via Wrangler), with no dependency changes in this PR.

A fictional two-model smoke trial ran one history/focused/checkpoint condition each for gpt-5.4-mini and gpt-5.5. All six used supported facts without invented qualifications or submission claims. One draft included an internal review note; a prompt refinement and one repeat corrected it. The committed report records limitations: not blinded, no repeated benchmark, no model ranking/cost claim, and no native compaction test.

Recovery: revert this UI/prompt change; stored job data and packet schemas are unchanged. Real-user validation remains separate from these fictional checks.

Latest headfe73858 is rebased onto main007e0ae with an unchanged context diff. Local lint/types/99 unit tests/build pass; fresh integration and hosted checks are running. Earlier production503 evidence remains in #22; this change does not claim a fix. Final peer approval and green current-head CI are required.

@cursor cursor 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.

Stale comment

No actionable defects at f0fabc69bd984e4b04cb035cb6989719a3ca18b5.

Reviewed the 8-file delta against AGENTS.md and docs/threat-model.md. Adjacent contracts loaded only to verify suspected handoff/isolation bugs: selectedPacket, assistantResult, draftFromResult, applyLoadedDraft / fileLoadApplies, and the workspace save/accept path.

Checked:

  • Owner isolation: research fill uses already-filtered sources (job_key === current.job_key) plus the selected job’s live blocker; extra packet properties stay stripped; e2e asserts the other job’s notes never enter the prompt.
  • Job switch: key={current?.id} remounts Connections, clearing facts, next task, and research. Filter change sets editor to null (key becomes no-job) and clears the same fields.
  • Bounds: next task ≤2000 and research ≤30000 are rejected, not truncated. Empty context is omitted from the prompt.
  • Acceptance / stale updates: taskContext is input-only. Required output still forces reviewRequired: true and the existing job/version envelope. Load still uses draftFromResult + fileLoadApplies (job, key, URL, version, session, draft). Save/accept is unchanged and still owner+version guarded. No schema/migration/workflow/artifact changes.
  • CLI/packet download paths unchanged (no context argument); documented as intentional.

Inspected only (not run here): new unit coverage in tests/assistant.test.mjs and the extended Chromium journey in tests/e2e/assistant.spec.ts. Did not run lint, typecheck, unit, API, or browser suites, and did not exercise a live app.

Human approval remains mandatory. This review does not approve merge or deployment.

Open in Web View Automation 

Sent by Cursor Automation: RELAY pull request review

@sykosyber sykosyber left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Partner Extra High review of f0fabc69bd984e4b04cb035cb6989719a3ca18b5. Not approving this head.

Required CI is red: Integration (production) failed (503 !== 200), so the combined CI check failed. That matches the tracked flake in #22 and is not a defect I traced in this 8-file delta, but I will not approve while the required check is failing.

Code on this stack is consistent with the contracts I checked:

  • sources passed into Connections are already job_key === current?.job_key; “Use this job’s research” maps only name/url/notes/status.
  • key={current?.id} remounts Connections, clearing next task, research, and facts.
  • Extra packet keys are stripped; taskContext is input-only; required output still forces reviewRequired: true and the existing job/version envelope.
  • Bounds reject (≤2000 / ≤30000) rather than truncate.

Merge #13 first, then rebase this branch onto main and retarget. Re-request review after a green required CI run on the latest head. This does not merge or deploy.

Base automatically changed from feat/openai-handoffs-public-copy to main September 6, 2026 01:17
@cursor cursor Bot mentioned this pull request Sep 6, 2026
4 of 6 tasks
@sdcarlson
sdcarlson force-pushed the feat/37-context-handoff branch from f0fabc6 to 84be07b Compare September 6, 2026 01:19

@cursor cursor 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.

Stale comment

No actionable defects at 84be07b0214d3ed4846ab72d985a54335bbfe9fa.

Subsequent push vs prior review (f0fabc6): handoff files are unchanged. The visible delta is a rebase onto main’s workspace-refresh/#13 stack. Re-checked that interaction only.

Reviewed the 8-file merge-base delta against AGENTS.md and docs/threat-model.md. Adjacent contracts loaded only for suspected isolation/stale-load issues: selectedPacket, assistantResult, draftFromResult, fileLoadApplies / applyLoadedDraft, Connections props, and editorForJobs after expiry.

Checked:

  • Owner isolation: sources are already job_key === current?.job_key before fill; fill maps only name/url/notes/status; extra context keys stay stripped; notes is the selected job’s live blocker.
  • Job/session boundaries: key={current?.id ?? 'no-job'} remounts on job change and when editor is cleared (filter change). #13 expiry sets signedOut and unmounts Connections, so next task/research do not survive a 401. Same-id refresh keeps the remount key, which is correct.
  • Bounds: next task ≤2000 and research ≤30000 reject, not truncate. Empty trimmed context is omitted. Packet download and CLI prompts still take no context argument.
  • Acceptance / stale updates: taskContext is input-only. Required output still forces reviewRequired: true and the existing job/version envelope. Load still uses draftFromResult + fileLoadApplies. Save/accept is unchanged and still owner+version guarded. No schema, migration, workflow, or artifact changes.

Ran: node --test tests/assistant.test.mjs failed on this environment’s missing TypeScript loader (ERR_UNKNOWN_FILE_EXTENSION for lib/assistant-handoff.ts) — not a product assertion failure.

Inspected only: new unit coverage in tests/assistant.test.mjs and the Chromium journey in tests/e2e/assistant.spec.ts. Did not run lint, typecheck, the repo unit script, API, or browser suites.

Human approval remains mandatory. This review does not approve merge or deployment.

Open in Web View Automation 

Sent by Cursor Automation: RELAY pull request review

@sdcarlson
sdcarlson requested a review from sykosyber September 6, 2026 01:21
@sdcarlson
sdcarlson enabled auto-merge (squash) September 6, 2026 01:21
sykosyber
sykosyber previously approved these changes Sep 6, 2026

@sykosyber sykosyber left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Partner Extra High review of 84be07b0214d3ed4846ab72d985a54335bbfe9fa.

Rebase onto main after #13 (a25aafe). Unique 8-file delta is the focused-context handoff. Extra packet fields stay stripped in selectedPacket. assistantResult still forces reviewRequired: true and the existing job/version envelope; taskContext is input-only and is omitted from required output. Load still uses draftFromResult + applyLoadedDraft. Connections is remounted with key={current?.id ?? 'no-job'}, so next task, research, and facts clear on job change. sources are already job_key === current?.job_key before fill. Bounds reject rather than truncate (next task ≤2000, research ≤3000). No schema, migration, workflow, or save/accept change.

Required CI is green on this head, including Integration (production): run 34003578420. This approval is for this commit only and does not merge or deploy. #39 (Apache 2.0) landed after this head; if this branch is updated onto that main tip, Extra High will re-review the new SHA.

@sykosyber

Copy link
Copy Markdown
Member

Correction to the Extra High approval body on 84be07b: the research bound is 30,000 characters (lib/assistant-handoff.ts), not 3,000. The approval still applies to this SHA.

@sdcarlson
sdcarlson disabled auto-merge September 6, 2026 01:26
sdcarlson pushed a commit that referenced this pull request Sep 6, 2026
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## Problem and result

Closes #8
Closes #9
Closes #19

`main` already includes protected CI/CD (#14), context playbooks (#18),
session-expiry (#15 / #7), ChatGPT/Codex public-copy (#13), Apache 2.0
(#39 / #38), and tracker CSV (#11 / #17). This branch merges that tip
and keeps the remaining unique trees:

- Local-dev Node/port/sign-in, with a Windows-safe Node guard instead of
Bash (#12 / #19)
- Copy/paste draft handoffs, exact-acceptance actions, and
dirty-navigation guards (#24)
- Selected-job review history beyond the GET 200-event window (#8)
- Assistant packets for valid jobs with `url: null` (#9)
- Canonical public-copy listing for Tracker CSV (the #11 squash kept
that note outside the maintained block)

Head `4d8f007` merges `origin/main` (`256854b`, #11) into the previous
landing. Conflict resolution kept `void test` wrappers, history/null-URL
API coverage, and one Tracker CSV setup section.

The changes-requested review is on superseded `9e307b9`. Independent
preservation review of `8d6ba1a` retired the five original code
findings. These merges do not restore them.

Deferred, matching maintainer comments, and **not** in this PR:

- Profile calibration loop (#26)
- `shadcn` 4.20.1 (#32)
- Production 503 diagnostics (#22 / draft #40)
- Assistant research/next-task handoff (#37 / #41) — stacked on landed
#13, not this consolidation
- Unused UI-kit cut / competing review-loop draft (#42)

Keep #16 open: remaining development-tool advisories. Keep #21 open
until post-merge Pages verification. Keep #22 open. Cloudflare hosting
(#3), two-account isolation (#4), recruiting (#5), backup rehearsal
(#6), and Grok Bot VM command review (#20) still need human/environment
work.

## Evidence

- Local on `4d8f007`: `pnpm lint`, `pnpm typecheck`, `pnpm test` (98
passed), `pnpm public-copy:check`, `pnpm build`, `pnpm test:api`, `pnpm
test:e2e` (6 passed), `pnpm test:production` passed.
- GitHub CI on `4d8f007` ([run
34003847782](https://github.com/SyberLabs/relay/actions/runs/34003847782)):
quality, API, browser, production, CodeQL, dependency-security, and
bundled agent contracts were running or already green after this merge;
required `CI` still needs the remaining jobs.
- User-visible proof: copy/paste packet, Windows-safe
`scripts/ensure-node.mjs`, Load earlier review history, null-URL
packets. CSV import and ChatGPT/Codex prepare now come from `main`.
- Security, data migration, and rollback impact: no new D1 migration.
React trio stays at 19.2.8. CI Vinext still uses ephemeral ports when
`RELAY_CI_STATE` is set. Production integration keeps the original
request sequence.

## Review

- [ ] One issue owns this scope; unrelated changes are separate. This is
an explicit integration PR covering the remaining open merge train.
- [x] Tests exercise the changed behavior, including failure paths
(including compiled Workspace continuation and history-after-expiry
regressions).
- [x] No credentials, personal applications, or private research are
included.
- [x] Agent findings from the `9e307b9` review remain addressed.
- [ ] A maintainer other than the author will approve. **@sdcarlson must
approve the latest push** (`4d8f007`); prior reviews do not cover this
merge commit.
- [x] Public capabilities, integration limits and lead-engineer credit
match `docs/public-copy.json`; run `pnpm public-copy:check` and follow
`docs/PUBLIC-COPY.md` when these change.

After merge, close the superseded feature PRs (#12, #24) as landed here
rather than squash-merging them separately. #11, #13, #15, and #39 are
already merged. #26 and #32 stay closed as deferred. #40, #41, and #42
stay on their own tracks.

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-3877d527-b5e4-46d7-8c5f-573418309ece?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-3877d527-b5e4-46d7-8c5f-573418309ece&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: sykosyber <sykosyber@users.noreply.github.com>
@sdcarlson
sdcarlson force-pushed the feat/37-context-handoff branch from 84be07b to 7a1b6ac Compare September 6, 2026 01:30
@sdcarlson
sdcarlson requested a review from sykosyber September 6, 2026 01:32

@cursor cursor 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.

Stale comment

No actionable defects at 7a1b6acff0376eeb99426ddb29bfb7e7c900326f.

Subsequent push vs prior reviews (f0fabc6, 84be07b): same 8-file focused-handoff delta, rebased onto current main (7cfec26, including #13/#15/#39/#11). No open threads from this automation. Prior isolation/stale-load findings remain fixed; no new contract holes in the rebase.

Reviewed the merge-base diff against AGENTS.md and docs/threat-model.md. Adjacent contracts loaded only for suspected isolation/stale-load/acceptance bugs: selectedPacket, assistantResult, draftFromResult, fileLoadApplies / applyLoadedDraft, loadEditor, Connections props, and editorForJobs / expiredPrivateWorkspace.

Checked:

  • Owner isolation: sources are already job_key === current?.job_key before fill; fill maps only name/url/notes/status; extra context keys stay stripped; notes is the selected job’s live blocker from loadEditor.
  • Job/session boundaries: key={current?.id ?? 'no-job'} remounts on job change and when editor is cleared (filter change). 401 expiry sets signedOut and unmounts Connections, so next task/research do not survive. Same-id refresh keeps the remount key, which is correct.
  • Bounds: next task ≤2000 and research ≤30000 reject, not truncate. Empty trimmed context is omitted. Packet download and CLI prompts still take no context argument.
  • Acceptance / stale updates: taskContext is input-only. Required output still forces reviewRequired: true and the existing job/version envelope. Load still uses draftFromResult + fileLoadApplies. Save/accept is unchanged and still owner+version guarded. No schema, migration, workflow, or artifact changes.

Ran here: node --test --test-name-pattern="focused context" tests/assistant.test.mjs failed on this environment’s Node 22 / missing TypeScript loader (ERR_UNKNOWN_FILE_EXTENSION for lib/assistant-handoff.ts) — not a product assertion failure.

Inspected only: new unit coverage in tests/assistant.test.mjs, the Chromium journey in tests/e2e/assistant.spec.ts, and the fictional pilot note. Did not run lint, typecheck, the repo unit script, API, or browser suites.

Human approval remains mandatory. This review does not approve merge or deployment.

Open in Web View Automation 

Sent by Cursor Automation: RELAY pull request review

@sykosyber sykosyber left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Partner Extra High review of 7a1b6acff0376eeb99426ddb29bfb7e7c900326f.

Rebase onto current main after #36 (7cfec262). Unique 8-file delta is still the focused-context handoff. Extra packet fields stay stripped in selectedPacket. assistantResult still forces reviewRequired: true and the existing job/version envelope; taskContext is input-only and is omitted from required output. Load still uses draftFromResult + applyLoadedDraft. Connections is remounted with key={current?.id ?? 'no-job'}, so next task, research, and facts clear on job change. sources are already job_key === current?.job_key before fill; the fill maps only name/url/notes/status. Bounds reject rather than truncate (next task ≤2000, research ≤30000). Chromium coverage now returns ChatGPT via paste (relay.draft.v1) and Codex via file load. No schema, migration, workflow, or save/accept change.

Required CI is green on this head, including Integration (production): run 34004077856. This approval is for this commit only and does not merge or deploy. Keep #22 open.

@sdcarlson
sdcarlson force-pushed the feat/37-context-handoff branch from 7a1b6ac to fe73858 Compare September 6, 2026 01:35
@sdcarlson
sdcarlson merged commit 13a2e7a into main Sep 6, 2026
10 checks passed
@sdcarlson
sdcarlson deleted the feat/37-context-handoff branch September 6, 2026 01:37

@cursor cursor 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.

No actionable defects at fe73858d19714a146ab87ce4ab3a05c539fffcf2.

Subsequent push vs prior reviews (f0fabc6, 84be07b, 7a1b6ac): the unique 8-file focused-handoff blobs are unchanged from 7a1b6ac. This head is a rebase onto current main (007e0ae, including #42). No open threads from this automation. Prior isolation/stale-load/acceptance checks still hold.

Reviewed the merge-base diff against AGENTS.md and docs/threat-model.md. Adjacent contracts loaded only for suspected isolation/stale-load/acceptance bugs: selectedPacket, assistantResult, draftFromResult, fileLoadApplies / applyLoadedDraft, loadEditor, Connections props, and editorForJobs / expiredPrivateWorkspace.

Checked:

  • Owner isolation: sources are already job_key === current?.job_key before fill; fill maps only name/url/notes/status; extra context keys stay stripped; notes is the selected job’s live blocker from loadEditor.
  • Job/session boundaries: key={current?.id ?? 'no-job'} remounts on job change and when editor is cleared (filter change). 401 expiry sets signedOut and unmounts Connections, so next task/research do not survive. Same-id refresh keeps the remount key, which is correct.
  • Bounds: next task ≤2000 and research ≤30000 reject, not truncate. Empty trimmed context is omitted. Packet download and CLI prompts still take no context argument.
  • Acceptance / stale updates: taskContext is input-only. Required output still forces reviewRequired: true and the existing job/version envelope. Load still uses draftFromResult + fileLoadApplies. Save/accept is unchanged and still owner+version guarded. No schema, migration, workflow, or artifact changes.

Ran here: none. Inspected hosted check status via gh pr checks (Quality, Integration api/browser/production, CodeQL, Dependency security, Bundled agent contracts, and combined CI reported pass on this head). Did not re-execute those jobs or a live app.

Inspected only: new unit coverage in tests/assistant.test.mjs, the Chromium journey in tests/e2e/assistant.spec.ts, and the fictional pilot note.

Human approval remains mandatory. This review does not approve merge or deployment.

Open in Web View Automation 

Sent by Cursor Automation: RELAY pull request review

@sdcarlson

Copy link
Copy Markdown
Contributor Author

The approval is attached to fe73858, but its text explicitly names 7a1b6ac and the earlier CI run. Latest head fe73858 is the unchanged context diff rebased onto main007e0ae after #42 (verified by git range-diff), and required CI/CodeQL passed. Please confirm the approval covers this latest head before merge; #22 remains open.

@sykosyber sykosyber mentioned this pull request Sep 6, 2026
3 of 5 tasks
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.

Carry selected research and next task through assistant handoffs

2 participants