Skip to content

feat: add red/blue logical Sesame channels and Echo service channel routing - #1328

Draft
Richard Peters (richardapeters) with Copilot wants to merge 12 commits into
mainfrom
copilot/suspect-race-condition-echo-sesame
Draft

feat: add red/blue logical Sesame channels and Echo service channel routing#1328
Richard Peters (richardapeters) with Copilot wants to merge 12 commits into
mainfrom
copilot/suspect-race-condition-echo-sesame

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Echo-over-Sesame could deadlock when bidirectional request/response traffic contends for a single logical message lane. This change introduces two symmetric logical channels (red/blue) on Sesame windowed messaging and lets Echo services be explicitly pinned to one channel.

  • Protocol extension (Sesame Windowed)

    • Added a second message identifier: 4 = MessageRed, 5 = MessageBlue.
    • Kept init/initResponse/releaseWindow semantics unchanged.
    • Propagated channel metadata with send/receive callbacks through the Sesame stack.
  • API surface updates

    • Extended Sesame/SesameObserver channel-aware operations:
      • RequestSendMessage(size, channel)
      • SendMessageStreamAvailable(writer, channel)
      • ReceivedMessage(reader, channel)
    • Preserved backward behavior by defaulting to red when no channel is specified.
  • Echo routing by service

    • Added service-to-channel mapping in EchoOnSesame:
      • SetServiceChannel(serviceId, channel)
      • ServiceChannel(serviceId)
    • Outgoing traffic is sent on the configured channel for the sending service.
    • Incoming traffic is accepted only when the message arrives on the service’s configured channel.
  • Plumbing/generation/docs

    • Threaded channel metadata through SesameSecured transparently.
    • Added ServiceProxy support for carrying serviceId; updated protoc C++ proxy generation to initialize it.
    • Updated Sesame protocol documentation to describe MessageRed/MessageBlue.
echo.SetServiceChannel(flash::FlashProxy::serviceId, services::SesameChannel::red);
echo.SetServiceChannel(flash::FlashResultProxy::serviceId, services::SesameChannel::blue);

Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
Comment thread services/util/EchoOnSesame.cpp Outdated

void EchoOnSesame::RequestSendStream(std::size_t size)
{
requestedChannel = sendingProxy == nullptr

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

requestedChannel should probably be set when assigning a value to sendingProxy

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.

Addressed: requestedChannel is now set in SendingProxySelected() when sendingProxy is assigned, and RequestSendStream() uses that selected channel.

Comment thread services/util/EchoOnSesame.cpp Outdated
Comment thread services/util/SesameWindowed.cpp
Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
Comment thread documents/modules/ROOT/pages/CodingStandard.adoc Outdated
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 33 package(s) with unknown licenses.
See the Details below.

Snapshot Warnings

⚠️: The number of snapshots compared for the base SHA (0) and the head SHA (1) do not match. You may see unexpected additions in the diff.
Consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

License Issues

external/crypto/tiny-aes128/CMakeLists.txt

PackageVersionLicenseIssue Type
kokke/tiny-aes-c7e42e693288bdf22d8e677da94248115168211b9NullUnknown License
kokke/tiny-aes-c7e42e693288bdf22d8e677da94248115168211b9NullUnknown License
kokke/tiny-aes-c7e42e693288bdf22d8e677da94248115168211b9NullUnknown License

external/args/CMakeLists.txt

PackageVersionLicenseIssue Type
taywee/args114200a9ad5fe06c8dea76e15d92325695cf3e34NullUnknown License
taywee/args114200a9ad5fe06c8dea76e15d92325695cf3e34NullUnknown License
taywee/args114200a9ad5fe06c8dea76e15d92325695cf3e34NullUnknown License

external/crypto/mbedtls/CMakeLists.txt

PackageVersionLicenseIssue Type
mbed-tls/mbedtls107ea89daaefb9867ea9121002fbbdf926780e98NullUnknown License
mbed-tls/mbedtls107ea89daaefb9867ea9121002fbbdf926780e98NullUnknown License
mbed-tls/mbedtls107ea89daaefb9867ea9121002fbbdf926780e98NullUnknown License

external/protobuf/CMakeLists.txt

PackageVersionLicenseIssue Type
protocolbuffers/protobufedaa823d8b36a8656d7b2b9241b7d0bfe50af878NullUnknown License
protocolbuffers/protobufedaa823d8b36a8656d7b2b9241b7d0bfe50af878NullUnknown License
protocolbuffers/protobufedaa823d8b36a8656d7b2b9241b7d0bfe50af878NullUnknown License

lwip/lwip/CMakeLists.txt

PackageVersionLicenseIssue Type
lwip-tcpip/lwip77dcd25a72509eb83f72b033d219b1d40cd8eb95NullUnknown License
lwip-tcpip/lwip77dcd25a72509eb83f72b033d219b1d40cd8eb95NullUnknown License
lwip-tcpip/lwip77dcd25a72509eb83f72b033d219b1d40cd8eb95NullUnknown License

osal/freertos/CMakeLists.txt

PackageVersionLicenseIssue Type
freertos/freertos-kerneldef7d2df2b0506d3d249334974f51e427c17a41cNullUnknown License
freertos/freertos-kerneldef7d2df2b0506d3d249334974f51e427c17a41cNullUnknown License
freertos/freertos-kerneldef7d2df2b0506d3d249334974f51e427c17a41cNullUnknown License

osal/threadx/CMakeLists.txt

PackageVersionLicenseIssue Type
eclipse-threadx/threadx06dabb0ad0403f59889ce85eeb3d48dbd9d3759bNullUnknown License
eclipse-threadx/threadx06dabb0ad0403f59889ce85eeb3d48dbd9d3759bNullUnknown License
eclipse-threadx/threadx06dabb0ad0403f59889ce85eeb3d48dbd9d3759bNullUnknown License

infra/syntax/CMakeLists.txt

PackageVersionLicenseIssue Type
zeux/pugixmlef856bf975f4b1909af1b40ed3d7e28af9263d95NullUnknown License
zeux/pugixmlef856bf975f4b1909af1b40ed3d7e28af9263d95NullUnknown License
zeux/pugixmlef856bf975f4b1909af1b40ed3d7e28af9263d95NullUnknown License

cmake/emil_test_helpers.cmake

PackageVersionLicenseIssue Type
google/googletestv1.14.0NullUnknown License
google/googletestv1.14.0NullUnknown License
google/googletestv1.14.0NullUnknown License

external/crypto/micro-ecc/CMakeLists.txt

PackageVersionLicenseIssue Type
kmackay/micro-ecc24c60e243580c7868f4334a1ba3123481fe1aa48NullUnknown License
kmackay/micro-ecc24c60e243580c7868f4334a1ba3123481fe1aa48NullUnknown License
kmackay/micro-ecc24c60e243580c7868f4334a1ba3123481fe1aa48NullUnknown License

external/segger_rtt/CMakeLists.txt

PackageVersionLicenseIssue Type
seggermicro/rttff57c3d516ea59b0a2d4d5cafb33a48572b09c0bNullUnknown License
seggermicro/rttff57c3d516ea59b0a2d4d5cafb33a48572b09c0bNullUnknown License
seggermicro/rttff57c3d516ea59b0a2d4d5cafb33a48572b09c0bNullUnknown License

OpenSSF Scorecard

Scorecard details
PackageVersionScoreDetails
unknown/kokke/tiny-aes-c 7e42e693288bdf22d8e677da94248115168211b9 UnknownUnknown
unknown/taywee/args 114200a9ad5fe06c8dea76e15d92325695cf3e34 UnknownUnknown
unknown/mbed-tls/mbedtls 107ea89daaefb9867ea9121002fbbdf926780e98 UnknownUnknown
unknown/protocolbuffers/protobuf edaa823d8b36a8656d7b2b9241b7d0bfe50af878 UnknownUnknown
unknown/lwip-tcpip/lwip 77dcd25a72509eb83f72b033d219b1d40cd8eb95 UnknownUnknown
unknown/freertos/freertos-kernel def7d2df2b0506d3d249334974f51e427c17a41c UnknownUnknown
unknown/eclipse-threadx/threadx 06dabb0ad0403f59889ce85eeb3d48dbd9d3759b UnknownUnknown
unknown/zeux/pugixml ef856bf975f4b1909af1b40ed3d7e28af9263d95 UnknownUnknown
unknown/google/googletest v1.14.0 UnknownUnknown
unknown/kmackay/micro-ecc 24c60e243580c7868f4334a1ba3123481fe1aa48 UnknownUnknown
unknown/seggermicro/rtt ff57c3d516ea59b0a2d4d5cafb33a48572b09c0b UnknownUnknown
unknown/google/googletest v1.14.0 UnknownUnknown
unknown/mbed-tls/mbedtls 107ea89daaefb9867ea9121002fbbdf926780e98 UnknownUnknown
unknown/kmackay/micro-ecc 24c60e243580c7868f4334a1ba3123481fe1aa48 UnknownUnknown
unknown/seggermicro/rtt ff57c3d516ea59b0a2d4d5cafb33a48572b09c0b UnknownUnknown
unknown/freertos/freertos-kernel def7d2df2b0506d3d249334974f51e427c17a41c UnknownUnknown
unknown/lwip-tcpip/lwip 77dcd25a72509eb83f72b033d219b1d40cd8eb95 UnknownUnknown
unknown/protocolbuffers/protobuf edaa823d8b36a8656d7b2b9241b7d0bfe50af878 UnknownUnknown
unknown/taywee/args 114200a9ad5fe06c8dea76e15d92325695cf3e34 UnknownUnknown
unknown/kokke/tiny-aes-c 7e42e693288bdf22d8e677da94248115168211b9 UnknownUnknown
unknown/zeux/pugixml ef856bf975f4b1909af1b40ed3d7e28af9263d95 UnknownUnknown
unknown/eclipse-threadx/threadx 06dabb0ad0403f59889ce85eeb3d48dbd9d3759b UnknownUnknown
unknown/google/googletest v1.14.0 UnknownUnknown
unknown/taywee/args 114200a9ad5fe06c8dea76e15d92325695cf3e34 UnknownUnknown
unknown/zeux/pugixml ef856bf975f4b1909af1b40ed3d7e28af9263d95 UnknownUnknown
unknown/kokke/tiny-aes-c 7e42e693288bdf22d8e677da94248115168211b9 UnknownUnknown
unknown/lwip-tcpip/lwip 77dcd25a72509eb83f72b033d219b1d40cd8eb95 UnknownUnknown
unknown/protocolbuffers/protobuf edaa823d8b36a8656d7b2b9241b7d0bfe50af878 UnknownUnknown
unknown/mbed-tls/mbedtls 107ea89daaefb9867ea9121002fbbdf926780e98 UnknownUnknown
unknown/kmackay/micro-ecc 24c60e243580c7868f4334a1ba3123481fe1aa48 UnknownUnknown
unknown/freertos/freertos-kernel def7d2df2b0506d3d249334974f51e427c17a41c UnknownUnknown
unknown/eclipse-threadx/threadx 06dabb0ad0403f59889ce85eeb3d48dbd9d3759b UnknownUnknown
unknown/seggermicro/rtt ff57c3d516ea59b0a2d4d5cafb33a48572b09c0b UnknownUnknown

Scanned Files

  • cmake/emil_test_helpers.cmake
  • external/args/CMakeLists.txt
  • external/crypto/mbedtls/CMakeLists.txt
  • external/crypto/micro-ecc/CMakeLists.txt
  • external/crypto/tiny-aes128/CMakeLists.txt
  • external/protobuf/CMakeLists.txt
  • external/segger_rtt/CMakeLists.txt
  • infra/syntax/CMakeLists.txt
  • lwip/lwip/CMakeLists.txt
  • osal/freertos/CMakeLists.txt
  • osal/threadx/CMakeLists.txt

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ ACTION actionlint 11 0 0 0.06s
✅ ACTION zizmor 11 0 0 0 6.28s
✅ CPP clang-format 1102 11 0 0 8.11s
✅ DOCKERFILE hadolint 2 0 0 0.04s
✅ JSON jsonlint 7 0 0 0.1s
✅ JSON prettier 7 0 0 0 0.48s
⚠️ MARKDOWN markdownlint 8 0 5 0 1.27s
✅ MARKDOWN markdown-table-formatter 8 0 0 0 0.25s
⚠️ REPOSITORY betterleaks yes 1 5 1.31s
✅ REPOSITORY checkov yes no no 31.83s
✅ REPOSITORY git_diff yes no no 0.07s
✅ REPOSITORY grype yes no no 83.75s
✅ REPOSITORY ls-lint yes no no 0.02s
✅ REPOSITORY osv-scanner yes no no 1.31s
✅ REPOSITORY secretlint yes no no 46.88s
✅ REPOSITORY syft yes no no 1.97s
✅ REPOSITORY trivy yes no no 14.64s
✅ REPOSITORY trivy-sbom yes no no 0.42s
✅ REPOSITORY trufflehog yes no no 6.07s
⚠️ SPELL lychee 140 1 0 123.82s
⚠️ YAML prettier 21 1 1 0 0.63s
✅ YAML v8r 21 0 0 7.11s
✅ YAML yamllint 21 0 0 0.76s

Detailed Issues

⚠️ REPOSITORY / betterleaks - 1 error
warning: private-key has detected secret for file services/network/CertificatesMbedTls.cpp.
    ┌─ services/network/CertificatesMbedTls.cpp:125:21
    │  
125 │           stream << "HIDDEN_BY_MEGALINTER\r\n";
    │ ╰────────────────────────────────────────────────^

warning: private-key has detected secret for file services/network/test_doubles/Certificates.cpp.
   ┌─ services/network/test_doubles/Certificates.cpp:56:15
   │  
56 │               "HIDDEN_BY_MEGALINTER\r\n";
   │ ╰──────────────────────────────────────────^

warning: private-key has detected secret for file services/network/test_doubles/Certificates.cpp.
    ┌─ services/network/test_doubles/Certificates.cpp:108:15
    │  
108 │               "HIDDEN_BY_MEGALINTER\r\n";
    │ ╰──────────────────────────────────────────^

warning: generic-api-key has detected secret for file external/crypto/tiny-aes128/TinyAes.c.
   ┌─ external/crypto/tiny-aes128/TinyAes.c:17:4
   │  
17 │     key:
   │ ╭────^
18 │ │     2b7e151628aed2a6abf7158809cf4f3c
   │ ╰────────────────────────────────────^

warning: generic-api-key has detected secret for file services/network/WebSocket.cpp.
   ┌─ services/network/WebSocket.cpp:81:64
   │
81 │         headers.push_back(services::HttpHeader("Sec-Websocket-Key", "AQIDBAUGBbgJCgsMDQ4PEC=="));
   │                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: 5 warnings emitted
⚠️ SPELL / lychee - 1 error
📝 Summary
---------------------
🔍 Total..........697
🔗 Unique.........661
✅ Successful.....691
⏳ Timeouts.........0
🔀 Redirected.....310
👻 Excluded.........5
❓ Unknown..........0
🚫 Errors...........1
⛔ Unsupported......1

Errors in external/protoc/CMakeLists.txt
[404] https://github.com/protocolbuffers/protobuf/releases/download/v$%7Bprotobuf_tag%7D/protoc-$%7Bprotobuf_version%7D-$%7Bos_postfix%7D.zip (at 18:13) | Rejected status code: 404 Not Found

Hint: Followed 310 redirects. You might want to consider replacing redirecting URLs with the resolved URLs. Use verbose mode (`-v`/`-vv`) to see redirection details.
Hint: You can configure accepted/rejected response codes with `-a` or `--accept`
⚠️ MARKDOWN / markdownlint - 5 errors
.github/instructions/microtest.instructions.md:7 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## Google Test Suite Coding Ru..."]
external/crypto/tiny-aes128/README.md:1 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "### Tiny AES128 in C"]
external/crypto/tiny-aes128/README.md:29 error MD046/code-block-style Code block style [Expected: fenced; Actual: indented]
external/crypto/tiny-aes128/README.md:39 error MD046/code-block-style Code block style [Expected: fenced; Actual: indented]
external/crypto/tiny-aes128/README.md:49 error MD046/code-block-style Code block style [Expected: fenced; Actual: indented]
⚠️ YAML / prettier - 1 error
[error] Explicitly specified pattern "documents/modules/ROOT/examples/clangformat.yaml" is a symbolic link.
.clusterfuzzlite/project.yaml 52ms (unchanged)
.github/dependabot.yml 17ms (unchanged)
.github/workflows/ci.yml 66ms (unchanged)
.github/workflows/dependency-scanner.yml 11ms (unchanged)
.github/workflows/documentation.yml 12ms (unchanged)
.github/workflows/fuzzing-batch.yml 6ms (unchanged)
.github/workflows/fuzzing-cron.yml 7ms (unchanged)
.github/workflows/fuzzing-pr.yml 9ms (unchanged)
.github/workflows/linting-formatting.yml 14ms (unchanged)
.github/workflows/release-please.yml 8ms (unchanged)
.github/workflows/security.yml 5ms (unchanged)
.github/workflows/static-analysis.yml 16ms (unchanged)
.github/workflows/validate-pr.yml 16ms (unchanged)
.ls-lint.yml 2ms
.mega-linter.yml 2ms (unchanged)
antora-playbook-branch.yml 2ms (unchanged)
antora-playbook-site.yml 4ms (unchanged)
documents/antora.yml 2ms (unchanged)
documents/supplemental-ui/ui.yml 1ms (unchanged)
mull.yml 2ms (unchanged)

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: REPOSITORY_GITLEAKS, REPOSITORY_KICS. See Removed linters to find their replacements.

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.0.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,ACTION_ZIZMOR,CPP_CLANG_FORMAT,DOCKERFILE_HADOLINT,JSON_JSONLINT,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_BETTERLEAKS,REPOSITORY_GRYPE,REPOSITORY_LS_LINT,REPOSITORY_OSV_SCANNER,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
…uest API

Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
…ions

Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
Comment thread protobuf/echo/EchoOnStreams.cpp Outdated
…n test

Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@richardapeters

Copy link
Copy Markdown
Collaborator

Copilot resolve the merge conflicts in this pull request

…condition-echo-sesame

# Conflicts:
#	services/util/SesameSecured.cpp

Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

Merge conflicts are resolved in commit 27e7735.

Comment thread services/util/Sesame.hpp
public:
virtual void RequestSendMessage(std::size_t size) = 0;
virtual void RequestSendMessage(std::size_t size, SesameChannel channel) = 0;
void RequestSendMessage(std::size_t size)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[MegaLinter] reported by reviewdog 🐶

Suggested change
void RequestSendMessage(std::size_t size)
void RequestSendMessage(std::size_t size)

Comment on lines +363 to +364
else if (requestedChannel != std::nullopt
&& SesameEncodedObserver::Subject().WorstCaseEncodedMessageSize(*RequestedSendMessageSize(*requestedChannel) + 1) + releaseWindowSize <= otherAvailableWindow)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[MegaLinter] reported by reviewdog 🐶

Suggested change
else if (requestedChannel != std::nullopt
&& SesameEncodedObserver::Subject().WorstCaseEncodedMessageSize(*RequestedSendMessageSize(*requestedChannel) + 1) + releaseWindowSize <= otherAvailableWindow)
else if (requestedChannel != std::nullopt && SesameEncodedObserver::Subject().WorstCaseEncodedMessageSize(*RequestedSendMessageSize(*requestedChannel) + 1) + releaseWindowSize <= otherAvailableWindow)

Comment on lines 26 to +27
using SesameObserver::SesameObserver;
using SesameObserver::SendMessageStreamAvailable;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[MegaLinter] reported by reviewdog 🐶

Suggested change
using SesameObserver::SesameObserver;
using SesameObserver::SendMessageStreamAvailable;

using SesameObserver::SesameObserver;
using SesameObserver::SendMessageStreamAvailable;
using SesameObserver::ReceivedMessage;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[MegaLinter] reported by reviewdog 🐶

Suggested change
using SesameObserver::SendMessageStreamAvailable;
using SesameObserver::SesameObserver;

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

Co-authored-by: richardapeters <40753452+richardapeters@users.noreply.github.com>
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.

2 participants