Skip to content

fix(agents): give each session a {{UNIQUE}} value for fresh-account routines - #202

Closed
cjber wants to merge 3 commits into
mainfrom
cb/sweep-bugpatrol-197
Closed

cjber wants to merge 3 commits into
mainfrom
cb/sweep-bugpatrol-197

Conversation

@cjber

@cjber cjber commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Routines recorded under a fresh-account profile replayed the literal values the explorer typed, such as the username bugpatrolnew77. On the next fresh account that value is already taken, so a later step finds no target and the retest ends unclear.

The value is now marked as per-run when it is typed, not guessed afterwards:

  • Every Vars (one per start of the app) declares {{UNIQUE}}: 12 random lowercase hex characters.
  • The explorer prompt and the type tool tell the explorer to put {{UNIQUE}} in a value that must be new on each run, such as bugpatrol{{UNIQUE}}.
  • Like a secret, the value is redacted to {{UNIQUE}} in what the explorer sees, so a routine records the placeholder. A replay in a new session expands it to a new value, and the routines it requires, replayed in the same session, share it. Setup commands get it as UNIQUE too.
  • UNIQUE is reserved: the config rejects a setup capture of that name, and Vars refuses to set it, so a secret or proxy cannot replace the per-session value.
  • Docs: docs/configuration.md explains it; the getting-started onboarding example uses it instead of a setup capture, and the Electron example drops its RUN_TAG capture and its guide types bugpatrol{{UNIQUE}}.

No value is classified by its content: a value the explorer made up without the placeholder is still recorded as typed.

Follow-up outside this repo

Routines already recorded with literal values must be re-recorded. For nebula-desktop, .bugpatrol/onboarding-instructions.md should say to type the username as bugpatrolnew{{UNIQUE}} instead of "bugpatrolnew plus a few digits", then the onboarding routines re-recorded.

Open question

The issue also suggests re-recording a required routine automatically when its replay finds no target. That changes retest behaviour (a model run inside a retest, cost and determinism), so it needs a product decision and is not in this PR.

Test plan

  • vars.test.ts: each Vars gets its own value, it resolves inside a word, and it is redacted to {{UNIQUE}}.
  • agents-flow.test.ts: the explorer types bugpatrol{{UNIQUE}}, the saved routine holds the placeholder, and a replay in a new session types a different value. Fails before the fix.
  • load.test.ts and vars.test.ts: a capture, secret or set named UNIQUE is refused.
  • Focused suites: explorer, lifecycle, replay, api-replay, retest-setup, cli shell vars; biome; knip; tsc --build.

Refs #197: the recording side is fixed here, the nebula-desktop guide and its recorded routines still need updating, and automatic re-recording is open.

🤖 Generated with Claude Code

…outines

A routine recorded on a fresh account replayed the literal values the
explorer typed, such as a new username. On the next fresh account that
value was taken, so the next step found no target and retests ended
unclear.

Every Vars now declares UNIQUE: 12 random lowercase hex characters, new
for each start of the app. The explorer is told to type it where a value
must be new on each run. Like a secret, it is redacted to its placeholder
in what the explorer sees, so routines record {{UNIQUE}} and a replay in a
new session types a new value, while the routines it requires share it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
bugpatrol Skipped Skipped Nov 16, 2026 5:08pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 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-16T16:36:19.273750Z 4314947 PR opened
ℹ️ 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.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Bugpatrol review: fixture-app

No problem introduced · tested ebfd1fe against main a228555

Tested

  • Home (/) loads with heading, projects list, and Save button
  • Settings (/settings) loads with Toggle and Delete account buttons

Not tested

  • The rest of the change (agents vars, config schema, docs, electron example): outside the fixture app

Updated on each push. Tests only what the diff can affect. Does not block the merge.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Bugpatrol review: dashboard

No problem introduced · tested ebfd1fe against main a228555

Tested

  • Overview dashboard
  • Issue detail: Save button overlaps account text

Not tested

  • The rest of the change (agents vars/explorer/prompt, config schema validation, docs, electron example): outside the dashboard

Updated on each push. Tests only what the diff can affect. Does not block the merge.

@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: 43149475ed

ℹ️ 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 on lines +29 to 32
this.values.set(UNIQUE, randomUUID().replaceAll('-', '').slice(0, 12));
for (const name of secrets) {
if (env[name] !== undefined) {
this.set(name, env[name]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reserve the built-in UNIQUE name

When an existing configuration declares app.secrets: [UNIQUE] and that environment variable is set, the following loop overwrites this generated value with the fixed environment value; setup or proxy captures named UNIQUE can overwrite it later in the same way. Such sessions therefore reuse the value across app starts, defeating fresh-account routines while the prompt still describes it as per-session. Reject UNIQUE as a user-defined variable name or prevent these paths from replacing the built-in value.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 1706780: the config rejects a setup capture named UNIQUE, and Vars.set refuses the name, so a secret or proxy named UNIQUE fails at startup instead of replacing the per-session value. Tests in packages/core/src/config/load.test.ts and packages/agents/src/vars.test.ts.

@cjber

cjber commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Codex review (session codex:01a1e535-7b63-7f61-a744-074699e66465) of the diff against origin/main: no correctness, security or contract regressions found. It read the Vars, lifecycle, patrol, explorer tool, retest and bench paths and ran the focused tests. No changes were needed.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Bugpatrol review: cli

No problem introduced · tested ebfd1fe against main a228555

Tested

  • CLI smoke: --help, --version, issue list/show, issue list --help, memory add/list/remove
  • Vars runtime: fresh 12-hex {{UNIQUE}} per session, in-word resolve, redaction to placeholder, set/setPublic/ctor refusal of the name
  • Unknown-variable error lists UNIQUE without leaking values; names() includes it
  • Setup env: vars.entries() passes UNIQUE to setup commands, secrets stay excluded
  • Config parse: setup capture named UNIQUE rejected with 'UNIQUE is built in' via doctor path
  • Replay path: step values resolve through vars.resolve so {{UNIQUE}} expands per session
  • Focused suites: vars.test (13), load.test (12), agents-flow.test (20) all pass
  • Docs/examples: RUN_TAG fully removed from electron example, no dangling references

Not tested

  • Live explorer recording with a real model and running app: needs a model run and a live app; covered here by agents-flow scripted-model tests
  • replay of fixture routines open-home/open-settings: environment lacks the playwright chromium executable (exit 4), not a PR regression
  • Electron example app end-to-end onboarding: needs the external my-electron-app repo and a running app
  • docs/configuration.md and getting-started.md rendering: docs are outside the CLI; another job reviews them

Updated on each push. Tests only what the diff can affect. Does not block the merge.

github-actions[bot]

This comment was marked as outdated.

A secret, setup capture or proxy named UNIQUE replaced the per-session
value with a fixed one, so fresh-account routines reused it. The config
now rejects a setup capture of that name, and Vars refuses to set it.

The Electron example guide still typed {{RUN_TAG}}, whose capture was
removed; it now types bugpatrol{{UNIQUE}}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The UNIQUE constant was declared between appCommandSchema and its doc
comment, so editors showed that comment on UNIQUE instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cjber

cjber commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #200 from @joaquim-verges, which fixes #197 more completely: besides the per-run placeholder ({{RUN_ID}} there, {{UNIQUE}} here), it fixes the connect hand-off wait, the named-target wait before point fallback, and the recorder dropping retyped form values, and it was verified end to end on dev. This PR was opened by a scheduled sweep that did not see #200 in time. Nothing here needs grafting onto #200; if a reserved-name check for the placeholder is wanted later, it can follow separately.

@cjber cjber closed this Nov 16, 2026

This branch was previously deployed

1 inactive deployment
Preview — ebfd1fe8 Deployed Nov 16, 2026 by vercel[bot]
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