Skip to content

feat: agent nickname session scoping (Phase 8)#23

Merged
dimdasci merged 15 commits into
mainfrom
feat/agent-nick-session-scoping
Jun 20, 2026
Merged

feat: agent nickname session scoping (Phase 8)#23
dimdasci merged 15 commits into
mainfrom
feat/agent-nick-session-scoping

Conversation

@dimdasci

Copy link
Copy Markdown
Owner

Summary

Implements ADR-030: agent nickname session scoping.

What this adds

  • Required --nick / -n flag on every protocol command — sessions are scoped to the creating nick
  • Safety guards: minimum interval (900ms), per-nick rate cap (60/min), metronome detection, error-path jittered delay
  • Nick privacy: ownerHash (sha256 with instance salt) in logs/responses, raw nick never persisted
  • Configuration: BPROXY_HOME/config.json for pacing presets and safety parameters, fail-closed on invalid config
  • New errors: SESSION_SCOPE_MISMATCH, RATE_LIMITED, METRONOME_DETECTED; SESSION_NOT_FOUND updated to retry: never
  • Extension: stores session in trace entries, rejects nick if leaked in forwarded messages

This PR specifically

  • Fixes CLI smoke integration tests (relaxed safety config for test speed)
  • Updates skill documentation: agents must generate random nicks, not copy from examples
  • Bumps version to 0.8.0

Quality gates

  • pnpm check ✅ (typecheck + format + lint + arch + deadcode)
  • pnpm test ✅ (835 tests across 71 files)

Closes #22

dimdasci added 15 commits June 19, 2026 20:35
Adds agent nickname (--nick / -n) as required session namespace to prevent
cross-agent interference (issue #22). Includes:

- ADR-030 in decisions.md (accepted)
- Phase 8 implementation plan with resolved design:
  - Nick format: /^[a-z][a-z0-9]{5}$/ (exactly 6 chars)
  - Session ownership stamped at creation, immutable
  - ownerHash (salted SHA-256) in logs/responses, never raw nick
  - debug.log scoping via TraceEntry session field
  - Safety guards: min interval (900ms), metronome detection,
    error-path delay, per-nick rate cap
  - Configurable via BPROXY_HOME/config.json
  - Explicit ingress check ordering

Closes design phase for #22. Ready for implementation.
All 15 subtasks verified implemented and passing:
- instanceSalt generation, computeOwnerHash utility
- Session ownership stamp on create/tab.open
- Nick validation at ingress (400 on malformed)
- SESSION_SCOPE_MISMATCH on owner mismatch
- session.list, debug.status, debug.last, debug.log filtered by nick
- SESSION_NOT_FOUND enriched with retry:never + suggestedAction
- ownerHash in responses and logs (raw nick never persisted)
- Schema requires nick field; all tests updated

Tasks 1-3 fully implemented. pnpm check + pnpm test clean.
…bump 0.8.0

- CLI smoke integration tests: write config.json with relaxed safety
  params so rapid sequential commands don't hit 900ms minInterval floor
- Skill docs: remove hardcoded nick examples, instruct agents to
  generate random unique nicks, add -n <nick> to all command examples
- Add SESSION_SCOPE_MISMATCH, RATE_LIMITED, METRONOME_DETECTED to
  skill error reference; update SESSION_NOT_FOUND retry to 'never'
- Bump all packages to 0.8.0
- safety.test.ts: remove empty object spreads (S7744)
- nick-scoping.test.ts: add explicit comparator to .sort() (S2871)
- daemon-config.test.ts: use String.raw for regex backslash (S7780)
- lifecycle.ts S7763 (re-export style): not fixed — MINOR code smell
  conflicts with max-lines (300) limit; file is at boundary
- Move makeCmd/postCommand/postRaw to helpers/integration.ts
- nick-scoping, safety-ordering, observability tests use shared helpers
- safety.test.ts: extract metronomeHarness() for shared setup
- screenshot-file.test.ts: extract takeScreenshot() helper
- Targets SonarCloud new_duplicated_lines_density gate (5.9% → <3%)
- S7721: move metronomeHarness/takeScreenshot to outer scope
- S4325: remove unnecessary type assertion in integration helper
- S7763: use export type...from for PairingMetadata re-export
- Extract lifecycle-state.ts (state-file utilities) from lifecycle.ts
  to bring it under 300-line limit while enabling direct re-exports
@dimdasci
dimdasci merged commit c262997 into main Jun 20, 2026
5 checks passed
@dimdasci
dimdasci deleted the feat/agent-nick-session-scoping branch June 20, 2026 09:05
@sonarqubecloud

Copy link
Copy Markdown

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.

Agent stuck in infinite scroll retry loop after session.close — no circuit breaker on repeated errors

1 participant