Skip to content

docs: rewrite AGENTS.md with verified repo-specific guidance#20

Merged
NeverMore93 merged 2 commits into
masterfrom
docs/update-agents-md
Apr 15, 2026
Merged

docs: rewrite AGENTS.md with verified repo-specific guidance#20
NeverMore93 merged 2 commits into
masterfrom
docs/update-agents-md

Conversation

@NeverMore93
Copy link
Copy Markdown
Owner

Summary

Rewrites AGENTS.md from a generic technical context dump into a compact, high-signal instruction file that helps future agent sessions avoid mistakes and ramp up quickly.

Changes

  • Commands section — exact bun commands plus explicit note that no linter/formatter/typecheck exists
  • Tech stack — tsup inline in package.json (no config file), noEmit: true in tsconfig
  • Architecture — added missing session.ts and version.ts modules with one-line role descriptions
  • Key constraints — added inEmit recursion guard, Bun AsyncLocalStorage caveat, gRPC-only trace limitation, silent-inactive behavior
  • Config precedence — full service.name resolution chain, config file ${ENV_VAR} placeholder support
  • Testing — test location, runner, coverage scope, no fixtures needed
  • CI/Publishing — publish trigger (v* tags) and workflow steps
  • Specs — added 011-align-bat-otel reference and CLAUDE.md ownership boundary note
  • Removed — dependency list (readable from package.json), env var table (duplicates README), generic framing

Test Plan

  • Docs-only change — no runtime code affected
  • Every fact in the file was verified against actual source files and config
  • bun test and bun run build are unaffected

Replaced the previous generic Technical Context / Key Constraints
structure with high-signal facts an agent would otherwise miss:

- Exact developer commands (bun install/test/build) and the absence
  of any linter/formatter/typecheck scripts
- Full architecture listing including session.ts and version.ts
- Interceptor recursion guard (inEmit), Bun AsyncLocalStorage caveat,
  gRPC-only trace constraint, and silent-inactive behavior
- Complete service.name resolution chain and config file placeholders
- Test location, runner, and coverage scope
- CI publish workflow trigger and steps
- Design spec references including 011-align-bat-otel
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@NeverMore93 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 40 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 40 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a096d62c-ccfa-4834-bc00-953e6910b880

📥 Commits

Reviewing files that changed from the base of the PR and between c654f6d and 2319d5c.

📒 Files selected for processing (1)
  • AGENTS.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/update-agents-md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces AGENTS.md, a comprehensive documentation file detailing the project's architecture, tech stack, and configuration. Feedback highlights two inaccuracies in the documentation: first, the claim that Bun's AsyncLocalStorage is broken is outdated and using a global variable for session tracking introduces race conditions; second, the plugin does not go inactive 'silently' but logs an informational message when the endpoint is missing.

Comment thread AGENTS.md Outdated

- **Cannot modify OpenCode source** — integration via npm plugin `event` hook only
- **Monkey-patch `process.stderr.write`** — interceptor has a recursion guard (`inEmit` flag); if emit callback writes to stderr it is silently skipped
- **Session tracking uses a module-level Map, not AsyncLocalStorage** — Bun's AsyncLocalStorage is broken; `session.ts` tracks active session via a plain variable
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The documentation justifies using a module-level variable for session tracking by claiming Bun's AsyncLocalStorage is broken. However, AsyncLocalStorage is stable in modern Bun versions, and using a global variable for activeSessionId creates a race condition in concurrent environments. If multiple sessions are active or interleaved (common in agentic frameworks), logs from one session will be incorrectly tagged with another session's traceId. This architectural flaw should be corrected in the implementation rather than documented as a constraint.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 2319d5c. Removed the claim that Bun AsyncLocalStorage is "broken" — the doc now describes the actual design choice (module-level Map + plain activeSessionId variable) and notes the concrete consequence: concurrent session interleaving will mis-tag logs. Whether to migrate to AsyncLocalStorage is a code decision for a separate PR.

Comment thread AGENTS.md Outdated
- **Monkey-patch `process.stderr.write`** — interceptor has a recursion guard (`inEmit` flag); if emit callback writes to stderr it is silently skipped
- **Session tracking uses a module-level Map, not AsyncLocalStorage** — Bun's AsyncLocalStorage is broken; `session.ts` tracks active session via a plain variable
- **Trace exporter only supports gRPC** — if a non-gRPC traces protocol is configured, trace export is disabled with a warning
- **Plugin goes inactive silently** if `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` is not set (no interceptor installed)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The statement that the plugin goes inactive "silently" is inaccurate. According to src/index.ts (line 59), the plugin logs an informational message ("No OTEL logs endpoint configured — plugin inactive") via the OpenCode client when the endpoint is missing. It would be more accurate to state that it logs a status message and remains inactive.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 2319d5c. Changed "silently inactive" to: "logs a status message via the app logger but does not install the interceptor" — verified against src/index.ts:59.

…ior wording

- Remove claim that Bun AsyncLocalStorage is 'broken'; describe the
  actual design choice (module-level Map + plain variable) and note the
  concurrent session interleaving consequence
- Replace 'silently inactive' with accurate description: logs a status
  message via app logger but does not install the interceptor
@NeverMore93 NeverMore93 merged commit 169b66c into master Apr 15, 2026
6 checks passed
@NeverMore93 NeverMore93 deleted the docs/update-agents-md branch April 15, 2026 09: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